about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-01T14·20+0300
committertazjin <tazjin@tvl.su>2022-09-07T19·23+0000
commitd1e0c6f680163b11582356f96ec7b5ae419e53f0 (patch)
tree0334447069eb8fd73d5a46875e0ee85cb22f5dd1
parenteb169c51a757a0bbf100030deeac300dd1d6dfb2 (diff)
feat(tvix/eval): track source spans for attrsets r/4721
Change-Id: I0fcb07146b5a38c67bc46ed3f67533b056858390
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6388
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
-rw-r--r--tvix/eval/src/compiler/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 688013f439cb..b72a7c7eda77 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -469,7 +469,7 @@ impl Compiler<'_> {
                         self.compile(slot, from.expr().unwrap());
                         self.emit_force();
                         self.emit_literal_ident(&ident);
-                        self.push_op_old(OpCode::OpAttrsSelect);
+                        self.push_op(OpCode::OpAttrsSelect, &ident);
                     }
                 }
 
@@ -505,7 +505,10 @@ impl Compiler<'_> {
             // otherwise we need to emit an instruction to construct
             // the attribute path.
             if key_count > 1 {
-                self.push_op_old(OpCode::OpAttrPath(Count(key_count)));
+                self.push_op(
+                    OpCode::OpAttrPath(Count(key_count)),
+                    &kv.attrpath().unwrap(),
+                );
             }
 
             // The value is just compiled as normal so that its
@@ -514,7 +517,7 @@ impl Compiler<'_> {
             self.compile(slot, kv.value().unwrap());
         }
 
-        self.push_op_old(OpCode::OpAttrs(Count(count)));
+        self.push_op(OpCode::OpAttrs(Count(count)), &node);
     }
 
     fn compile_select(&mut self, slot: Option<LocalIdx>, node: ast::Select) {