1
0

Pass tests

This commit is contained in:
Jeff 2024-10-19 01:04:53 -04:00
parent bfade78a0d
commit b7153df9be
2 changed files with 3 additions and 2 deletions

View File

@ -695,9 +695,10 @@ impl<'src> Parser<'src> {
self.emit_instruction(previous_instruction, previous_position); self.emit_instruction(previous_instruction, previous_position);
self.emit_instruction( self.emit_instruction(
Instruction::set_local(previous_instruction.a(), local_index), Instruction::set_local(self.current_register, local_index),
start_position, start_position,
); );
self.increment_register()?;
self.parsed_expression = false; self.parsed_expression = false;
} else { } else {

View File

@ -818,7 +818,7 @@ fn set_local() {
(Instruction::define_local(0, 0, true), Span(8, 9)), (Instruction::define_local(0, 0, true), Span(8, 9)),
(Instruction::load_constant(1, 1, false), Span(20, 22)), (Instruction::load_constant(1, 1, false), Span(20, 22)),
(Instruction::set_local(1, 0), Span(16, 17)), (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)), (Instruction::r#return(true), Span(25, 25)),
], ],
vec![Value::integer(41), Value::integer(42)], vec![Value::integer(41), Value::integer(42)],