feat(tvix/eval): thunk function applications

Change-Id: I18065ed234ec104ac74d0e1c2d0937c2d78ca7db
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6433
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-09-03 05:02:20 +03:00 committed by tazjin
parent e129ce15d7
commit fc1c50498e

View file

@ -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);
}