diff options
-rw-r--r-- | compiler.c | 8 | ||||
-rw-r--r-- | tests/custom/04_bugs/10_break_stack_mismatch | 12 |
2 files changed, 12 insertions, 8 deletions
@@ -2242,10 +2242,10 @@ uc_compiler_compile_for_in(uc_compiler_t *compiler, bool local, uc_token_t *kvar if (vvar) uc_compiler_emit_insn(compiler, 0, I_POP); - uc_compiler_leave_scope(compiler); - /* patch up break/continue */ uc_compiler_backpatch(compiler, chunk->count, skip_jmp + 5); + + uc_compiler_leave_scope(compiler); } static void @@ -2355,10 +2355,10 @@ uc_compiler_compile_for_count(uc_compiler_t *compiler, bool local, uc_token_t *v if (test_off) uc_compiler_set_jmpaddr(compiler, test_off, chunk->count); - uc_compiler_leave_scope(compiler); - /* patch up break/continue */ uc_compiler_backpatch(compiler, chunk->count, incr_off); + + uc_compiler_leave_scope(compiler); } static void diff --git a/tests/custom/04_bugs/10_break_stack_mismatch b/tests/custom/04_bugs/10_break_stack_mismatch index ae16dac..c9c82c5 100644 --- a/tests/custom/04_bugs/10_break_stack_mismatch +++ b/tests/custom/04_bugs/10_break_stack_mismatch @@ -13,12 +13,14 @@ values or segmentation faults at runtime. for (let y in [2]) break; - print(x, "\n"); + let z = 3; + + print([ x, z ], "\n"); %} -- End -- -- Expect stdout -- -1 +[ 1, 3 ] -- End -- @@ -29,10 +31,12 @@ values or segmentation faults at runtime. for (let y = 0; y < 1; y++) break; - print(x, "\n"); + let z = 3; + + print([ x, z ], "\n"); %} -- End -- -- Expect stdout -- -1 +[ 1, 3 ] -- End -- |