diff --git a/src/compiler.rs b/src/compiler.rs index aac2dd1..28b6e15 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -559,7 +559,7 @@ impl Compiler { let before_load_dict_idx = self.len(); self.emit_byte(0xff); let mut jump_idxes = vec![]; - let dict_stack_pos = self.stack_depth; + let dict_stack_pos = self.stack_depth - 1; for pair in pairs { let (PairPattern(key, pattern), _) = pair else { unreachable!() diff --git a/src/main.rs b/src/main.rs index 135752a..c7f6466 100644 --- a/src/main.rs +++ b/src/main.rs @@ -74,8 +74,8 @@ pub fn run(src: &'static str) { pub fn main() { env::set_var("RUST_BACKTRACE", "1"); let src = " -let #{:a x} = #{:a 1} -x +let #{a, :b #{c}} = #{:a 1, :b #{:c 3}} +[a, c] "; run(src); } diff --git a/src/vm.rs b/src/vm.rs index 30c1a7f..1136ab1 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -313,6 +313,7 @@ impl<'a> Vm<'a> { }; let value = dict.get(&key).unwrap_or(&Value::Nil); self.push(value.clone()); + self.ip += 2; } MatchDict => { let idx = self.stack.len() - self.match_depth as usize - 1;