about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-03T02·02+0300
committertazjin <tazjin@tvl.su>2022-09-08T20·17+0000
commitfc1c50498e81292948ce641bc8289130dba79c61 (patch)
tree20b40c9f4d31c87d3803877f4166d65cf65b4872
parente129ce15d766d95ac2eb91c9e58520d88f16d7fc (diff)
feat(tvix/eval): thunk function applications r/4766
Change-Id: I18065ed234ec104ac74d0e1c2d0937c2d78ca7db
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6433
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
-rw-r--r--tvix/eval/src/compiler/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index f40d3855f7fb..aacb7143d3b6 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -172,7 +172,9 @@ impl Compiler<'_> {
             ast::Expr::Ident(ident) => self.compile_ident(slot, ident),
             ast::Expr::With(with) => self.compile_with(slot, with),
             ast::Expr::Lambda(lambda) => self.compile_lambda(slot, lambda),
-            ast::Expr::Apply(apply) => self.compile_apply(slot, apply),
+            ast::Expr::Apply(apply) => {
+                self.thunk(slot, &apply, move |c, a, s| c.compile_apply(s, a.clone()))
+            }
 
             // Parenthesized expressions are simply unwrapped, leaving
             // their value on the stack.
@@ -933,6 +935,7 @@ impl Compiler<'_> {
         // to enter the function call straight away.
         self.compile(slot, node.argument().unwrap());
         self.compile(slot, node.lambda().unwrap());
+        self.emit_force(&node.lambda().unwrap());
         self.push_op(OpCode::OpCall, &node);
     }