about summary refs log tree commit diff
path: root/tvix/eval/src/chunk.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-01T13·54+0300
committertazjin <tazjin@tvl.su>2022-09-07T19·23+0000
commit72adcdf9652d75f9499e311beec128f9e3627301 (patch)
tree98fba4bc0ed4d6f55ddd680834bb356d617e1175 /tvix/eval/src/chunk.rs
parentc5a8b93eaff144d34361193a125a2da2a4a93ef7 (diff)
feat(tvix/eval): add methods for emitting code with tracked spans r/4712
These are not actually used yet; this is in preparation for a
multi-commit chain for emitting all the right spans in the right
locations.

Change-Id: Ie99d6add2696c1cc0acb9ab928917a10237159de
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6379
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/chunk.rs')
-rw-r--r--tvix/eval/src/chunk.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/tvix/eval/src/chunk.rs b/tvix/eval/src/chunk.rs
index 9075db11b3..fbb9f7c37f 100644
--- a/tvix/eval/src/chunk.rs
+++ b/tvix/eval/src/chunk.rs
@@ -29,12 +29,19 @@ pub struct Chunk {
 }
 
 impl Chunk {
-    pub fn push_op(&mut self, data: OpCode) -> CodeIdx {
+    pub fn push_op_old(&mut self, data: OpCode) -> CodeIdx {
         let idx = self.code.len();
         self.code.push(data);
         CodeIdx(idx)
     }
 
+    pub fn push_op(&mut self, data: OpCode, span: codemap::Span) -> CodeIdx {
+        let idx = self.code.len();
+        self.code.push(data);
+        self.push_span(span);
+        CodeIdx(idx)
+    }
+
     pub fn push_constant(&mut self, data: Value) -> ConstantIdx {
         let idx = self.constants.len();
         self.constants.push(data);