feat(tvix/eval): track source spans for scopes
Change-Id: Iaedb0742940e4c2b9f4210579ed28e6deb32d5c8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6401 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
c269b44f41
commit
1ea88fcb65
1 changed files with 6 additions and 6 deletions
|
@ -755,7 +755,7 @@ impl Compiler<'_> {
|
||||||
|
|
||||||
// Deal with the body, then clean up the locals afterwards.
|
// Deal with the body, then clean up the locals afterwards.
|
||||||
self.compile(slot, node.body().unwrap());
|
self.compile(slot, node.body().unwrap());
|
||||||
self.end_scope();
|
self.end_scope(&node);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile_ident(&mut self, slot: Option<LocalIdx>, node: ast::Ident) {
|
fn compile_ident(&mut self, slot: Option<LocalIdx>, node: ast::Ident) {
|
||||||
|
@ -849,7 +849,7 @@ impl Compiler<'_> {
|
||||||
|
|
||||||
self.push_op(OpCode::OpPopWith, &node);
|
self.push_op(OpCode::OpPopWith, &node);
|
||||||
self.scope_mut().pop_with();
|
self.scope_mut().pop_with();
|
||||||
self.end_scope();
|
self.end_scope(&node);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile_lambda(&mut self, slot: Option<LocalIdx>, node: ast::Lambda) {
|
fn compile_lambda(&mut self, slot: Option<LocalIdx>, node: ast::Lambda) {
|
||||||
|
@ -876,7 +876,7 @@ impl Compiler<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.compile(slot, node.body().unwrap());
|
self.compile(slot, node.body().unwrap());
|
||||||
self.end_scope();
|
self.end_scope(&node);
|
||||||
|
|
||||||
// TODO: determine and insert enclosing name, if available.
|
// TODO: determine and insert enclosing name, if available.
|
||||||
|
|
||||||
|
@ -932,7 +932,7 @@ impl Compiler<'_> {
|
||||||
self.contexts.push(LambdaCtx::new());
|
self.contexts.push(LambdaCtx::new());
|
||||||
self.begin_scope();
|
self.begin_scope();
|
||||||
content(self, node, slot);
|
content(self, node, slot);
|
||||||
self.end_scope();
|
self.end_scope(node);
|
||||||
|
|
||||||
let thunk = self.contexts.pop().unwrap();
|
let thunk = self.contexts.pop().unwrap();
|
||||||
|
|
||||||
|
@ -1032,7 +1032,7 @@ impl Compiler<'_> {
|
||||||
self.scope_mut().scope_depth += 1;
|
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");
|
debug_assert!(self.scope().scope_depth != 0, "can not end top scope");
|
||||||
|
|
||||||
// If this scope poisoned any builtins or special identifiers,
|
// If this scope poisoned any builtins or special identifiers,
|
||||||
|
@ -1071,7 +1071,7 @@ impl Compiler<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if pops > 0 {
|
if pops > 0 {
|
||||||
self.push_op_old(OpCode::OpCloseScope(Count(pops)));
|
self.push_op(OpCode::OpCloseScope(Count(pops)), node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue