Skip to content

Commit dcdefbc

Browse files
committed
Nil var before loop
Signed-off-by: Stefan Marr <[email protected]>
1 parent 13435b7 commit dcdefbc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/som/compiler/bc/method_generation_context.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -685,21 +685,23 @@ def inline_to_do(self, parser):
685685
block_literal_idx = self._bytecode[-1]
686686

687687
to_be_inlined = self._literals[block_literal_idx]
688+
to_be_inlined.merge_scope_into(self)
689+
690+
block_arg = to_be_inlined.get_argument(1, 0)
691+
i_var_idx = self.get_inlined_local_idx(block_arg, 0)
688692

689693
self._remove_last_bytecodes(1) # remove push_block*
690694

691695
self._is_currently_inlining_a_block = True
692696
emit_dup_second(self)
693697

698+
emit_nil_local(self, i_var_idx)
699+
694700
loop_begin_idx = self.offset_of_next_instruction()
695701
jump_offset_idx_to_end = emit_jump_if_greater_with_dummy_offset(self)
696702

697703
emit_dup(self)
698704

699-
to_be_inlined.merge_scope_into(self)
700-
701-
block_arg = to_be_inlined.get_argument(1, 0)
702-
i_var_idx = self.get_inlined_local_idx(block_arg, 0)
703705
emit_pop_local(self, i_var_idx, 0)
704706

705707
to_be_inlined.inline(self, False)

0 commit comments

Comments
 (0)