about summary refs log tree commit diff
path: root/tvix/eval/src
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-01T16·07+0300
committertazjin <tazjin@tvl.su>2022-09-07T20·04+0000
commit1ea88fcb6587c110acd8c798a5c198b492e04bad (patch)
tree862e1a867d5f29da0556dd2c230e17ae56278f32 /tvix/eval/src
parentc269b44f411cc19042cc5087d3e7404057195b27 (diff)
feat(tvix/eval): track source spans for scopes r/4734
Change-Id: Iaedb0742940e4c2b9f4210579ed28e6deb32d5c8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6401
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src')
-rw-r--r--tvix/eval/src/compiler/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 92507b5703f3..09123d3a99fb 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -755,7 +755,7 @@ impl Compiler<'_> {
 
         // Deal with the body, then clean up the locals afterwards.
         self.compile(slot, node.body().unwrap());
-        self.end_scope();
+        self.end_scope(&node);
     }
 
     fn compile_ident(&mut self, slot: Option<LocalIdx>, node: ast::Ident) {
@@ -849,7 +849,7 @@ impl Compiler<'_> {
 
         self.push_op(OpCode::OpPopWith, &node);
         self.scope_mut().pop_with();
-        self.end_scope();
+        self.end_scope(&node);
     }
 
     fn compile_lambda(&mut self, slot: Option<LocalIdx>, node: ast::Lambda) {
@@ -876,7 +876,7 @@ impl Compiler<'_> {
         }
 
         self.compile(slot, node.body().unwrap());
-        self.end_scope();
+        self.end_scope(&node);
 
         // TODO: determine and insert enclosing name, if available.
 
@@ -932,7 +932,7 @@ impl Compiler<'_> {
         self.contexts.push(LambdaCtx::new());
         self.begin_scope();
         content(self, node, slot);
-        self.end_scope();
+        self.end_scope(node);
 
         let thunk = self.contexts.pop().unwrap();
 
@@ -1032,7 +1032,7 @@ impl Compiler<'_> {
         self.scope_mut().scope_depth += 1;
     }
 
-    fn end_scope(&mut self) {
+    fn end_scope<N: AstNode>(&mut self, node: &N) {
         debug_assert!(self.scope().scope_depth != 0, "can not end top scope");
 
         // If this scope poisoned any builtins or special identifiers,
@@ -1071,7 +1071,7 @@ impl Compiler<'_> {
         }
 
         if pops > 0 {
-            self.push_op_old(OpCode::OpCloseScope(Count(pops)));
+            self.push_op(OpCode::OpCloseScope(Count(pops)), node);
         }
     }