update stack discipline in dict patterns

This commit is contained in:
Scott Richmond 2025-06-23 00:07:04 -04:00
parent f9e4b4623b
commit f576868a7a
2 changed files with 5 additions and 15 deletions

View File

@ -1,14 +1,3 @@
let command = [:forward, 100]
match command with {
(:goto, (x, y)) -> "goto: {x} and {y}"
[:one, :two] -> :no
(:home) -> "go home!"
& (:clear) -> "clear the screen"
& (:right, turns) -> "make {turns} to the right"
& (:left, turns) -> "turn left! by {turns}"
(:forward, steps) -> "forward {steps} turtle paces"
(:back, steps) -> "flip it and reverse it {steps}"
[...xs] -> :splatted
}
let #{a, b, ...} = #{:a 1, :b 2, :c 3}
(a, b)

View File

@ -739,8 +739,9 @@ impl<'a> Compiler<'a> {
self.patch_jump(idx, self.len() - idx - 3);
}
self.emit_op(Op::PopN);
self.emit_byte(pairs.len());
self.pop_n(pairs.len());
// self.emit_op(Op::PopN);
// self.emit_byte(pairs.len());
self.patch_jump(before_load_dict_idx, self.len() - before_load_dict_idx - 3);
self.patch_jump(jump_idx, self.len() - jump_idx - 3);