feat(tvix/eval): emit instructions to close with at scope end

Change-Id: I340b7a0964a4d4c5be58f46d00d2376ec5682517
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6220
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-08-15 00:45:21 +03:00 committed by tazjin
parent 19878c5fef
commit 83e5f3b0d3

View file

@ -850,6 +850,13 @@ impl Compiler {
if pops > 0 {
self.chunk.push_op(OpCode::OpCloseScope(pops));
}
while !scope.with_stack.is_empty()
&& scope.with_stack[scope.with_stack.len() - 1].depth > scope.scope_depth
{
self.chunk.push_op(OpCode::OpPopWith);
scope.with_stack.pop();
}
}
fn push_local<S: Into<String>>(&mut self, name: S) {