additional fixes in tuple and dict patterns
This commit is contained in:
parent
bf97a34771
commit
f9e4b4623b
|
@ -1,12 +1,14 @@
|
||||||
let command = (:forward, 100)
|
let command = [:forward, 100]
|
||||||
|
|
||||||
match command with {
|
match command with {
|
||||||
(:goto, (x, y)) -> "goto: {x} and {y}"
|
(:goto, (x, y)) -> "goto: {x} and {y}"
|
||||||
|
[:one, :two] -> :no
|
||||||
(:home) -> "go home!"
|
(:home) -> "go home!"
|
||||||
& (:clear) -> "clear the screen"
|
& (:clear) -> "clear the screen"
|
||||||
& (:right, turns) -> "make {turns} to the right"
|
& (:right, turns) -> "make {turns} to the right"
|
||||||
& (:left, turns) -> "turn left! by {turns}"
|
& (:left, turns) -> "turn left! by {turns}"
|
||||||
(:forward, steps) -> "forward {steps} turtle paces"
|
(:forward, steps) -> "forward {steps} turtle paces"
|
||||||
(:back, steps) -> "flip it and reverse it {steps}"
|
(:back, steps) -> "flip it and reverse it {steps}"
|
||||||
|
[...xs] -> :splatted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -662,7 +662,7 @@ impl<'a> Compiler<'a> {
|
||||||
let jump_idx = self.stub_jump(Op::Jump);
|
let jump_idx = self.stub_jump(Op::Jump);
|
||||||
|
|
||||||
for idx in jump_idxes {
|
for idx in jump_idxes {
|
||||||
self.patch_jump(idx, self.len() - idx - 2)
|
self.patch_jump(idx, self.len() - idx - 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.emit_op(Op::PopN);
|
self.emit_op(Op::PopN);
|
||||||
|
@ -736,7 +736,7 @@ impl<'a> Compiler<'a> {
|
||||||
let jump_idx = self.stub_jump(Op::Jump);
|
let jump_idx = self.stub_jump(Op::Jump);
|
||||||
|
|
||||||
for idx in jump_idxes {
|
for idx in jump_idxes {
|
||||||
self.patch_jump(idx, self.len() - idx - 2);
|
self.patch_jump(idx, self.len() - idx - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.emit_op(Op::PopN);
|
self.emit_op(Op::PopN);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user