From b7153df9bed3ae35a2e84e34a4d67afa87bd70f5 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 19 Oct 2024 01:04:53 -0400 Subject: [PATCH] Pass tests --- dust-lang/src/parser.rs | 3 ++- dust-lang/tests/expressions.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dust-lang/src/parser.rs b/dust-lang/src/parser.rs index 2990b18..1b86c34 100644 --- a/dust-lang/src/parser.rs +++ b/dust-lang/src/parser.rs @@ -695,9 +695,10 @@ impl<'src> Parser<'src> { self.emit_instruction(previous_instruction, previous_position); self.emit_instruction( - Instruction::set_local(previous_instruction.a(), local_index), + Instruction::set_local(self.current_register, local_index), start_position, ); + self.increment_register()?; self.parsed_expression = false; } else { diff --git a/dust-lang/tests/expressions.rs b/dust-lang/tests/expressions.rs index f04868e..5632359 100644 --- a/dust-lang/tests/expressions.rs +++ b/dust-lang/tests/expressions.rs @@ -818,7 +818,7 @@ fn set_local() { (Instruction::define_local(0, 0, true), Span(8, 9)), (Instruction::load_constant(1, 1, false), Span(20, 22)), (Instruction::set_local(1, 0), Span(16, 17)), - (Instruction::get_local(1, 0), Span(24, 25)), + (Instruction::get_local(2, 0), Span(24, 25)), (Instruction::r#return(true), Span(25, 25)), ], vec![Value::integer(41), Value::integer(42)],