From fc1c50498e81292948ce641bc8289130dba79c61 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 3 Sep 2022 05:02:20 +0300 Subject: feat(tvix/eval): thunk function applications Change-Id: I18065ed234ec104ac74d0e1c2d0937c2d78ca7db Reviewed-on: https://cl.tvl.fyi/c/depot/+/6433 Reviewed-by: sterni Tested-by: BuildkiteCI --- tvix/eval/src/compiler/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tvix/eval') 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); } -- cgit 1.4.1