about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-26T17·58+0300
committerclbot <clbot@tvl.fyi>2022-09-03T13·27+0000
commit2f93ed297e3cef8486e9160f5d3d68be1939d7d5 (patch)
tree70b54f27eccbc6a5d4a709ade21b2f5c0ca17a0a /tvix/eval/src/vm.rs
parentc73e84d95777c304f1b208cbc43b01012df73262 (diff)
refactor(tvix/eval): add opcode::Count type for less ambiguity r/4622
Change-Id: Ibde0b2baa1128a74c1364ee9a6330b62db3da699
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6288
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index 28b1636488af..85f81bac6efa 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -6,7 +6,7 @@ use std::rc::Rc;
 use crate::{
     chunk::Chunk,
     errors::{ErrorKind, EvalResult},
-    opcode::{JumpOffset, OpCode, StackIdx},
+    opcode::{Count, JumpOffset, OpCode, StackIdx},
     value::{Closure, Lambda, NixAttrs, NixList, Value},
 };
 
@@ -199,8 +199,8 @@ impl VM {
                 OpCode::OpTrue => self.push(Value::Bool(true)),
                 OpCode::OpFalse => self.push(Value::Bool(false)),
 
-                OpCode::OpAttrs(count) => self.run_attrset(count)?,
-                OpCode::OpAttrPath(count) => self.run_attr_path(count)?,
+                OpCode::OpAttrs(Count(count)) => self.run_attrset(count)?,
+                OpCode::OpAttrPath(Count(count)) => self.run_attr_path(count)?,
 
                 OpCode::OpAttrsUpdate => {
                     let rhs = unwrap_or_clone_rc(self.pop().to_attrs()?);
@@ -252,7 +252,7 @@ impl VM {
                     self.push(Value::Bool(result));
                 }
 
-                OpCode::OpList(count) => {
+                OpCode::OpList(Count(count)) => {
                     let list =
                         NixList::construct(count, self.stack.split_off(self.stack.len() - count));
                     self.push(Value::List(list));
@@ -264,7 +264,7 @@ impl VM {
                     self.push(Value::List(lhs.concat(&rhs)))
                 }
 
-                OpCode::OpInterpolate(count) => self.run_interpolate(count)?,
+                OpCode::OpInterpolate(Count(count)) => self.run_interpolate(count)?,
 
                 OpCode::OpJump(JumpOffset(offset)) => {
                     self.frame_mut().ip += offset;
@@ -306,7 +306,7 @@ impl VM {
 
                 // Remove the given number of elements from the stack,
                 // but retain the top value.
-                OpCode::OpCloseScope(count) => {
+                OpCode::OpCloseScope(Count(count)) => {
                     // Immediately move the top value into the right
                     // position.
                     let target_idx = self.stack.len() - 1 - count;