about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2022-09-18T20·07-0400
committergrfn <grfn@gws.fyi>2022-09-18T22·13+0000
commitd42d8f3089c524cfa9e2fc332a81af5c0686db8d (patch)
treeda8c036c520c67c9f5578d2e47a5b9d701697c4b
parente720545e5b32683a3cdb135b6004a06304e025aa (diff)
docs(tvix/eval): Document OpAttrs r/4912
Document the OpAttrs op, paying special attention to the (perhaps
confusing) behavior of taking the number of *pairs*, not the number
of *values*, which will be popped off the stack into the resulting attr
set.

Change-Id: I64df0290308ecae7a5c7e14ead37091d32701507
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6654
Autosubmit: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
-rw-r--r--tvix/eval/src/opcode.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs
index 458ea6dd3feb..9ddd1953210c 100644
--- a/tvix/eval/src/opcode.rs
+++ b/tvix/eval/src/opcode.rs
@@ -86,6 +86,10 @@ pub enum OpCode {
     OpJumpIfNotFound(JumpOffset),
 
     // Attribute sets
+    /// Construct an attribute set from the given number of key-value pairs on the top of the stack
+    ///
+    /// Note that this takes the count of *pairs*, not the number of *stack values* - the actual
+    /// number of values popped off the stack will be twice the argument to this op
     OpAttrs(Count),
     OpAttrPath(Count),
     OpAttrsUpdate,