When compiling continue statements nested in switches, the compiler only
emitted pop statements for the local variables in the switch body scope,
but not for the locals in the scope(s) leading up to the containing loop
body.
Extend the compilers internal patchlist structure to keep track of the
type of scope tied to the patchlist and extend continue statement
compilation logic to select the appropriate parent patch list in order
to determine the amount of locals (stack slots) to clear before the
emitted jump instruction.
As a result, the uc_compiler_backpatch() implementation can be simplified
somewhat since we do not need to propagate entries to parent lists anymore.
Also add a further regression test case to cover this issue.
When compiling continue statements nested in switches, the compiler only emitted pop statements for the local variables in the switch body scope, but not for the locals in the scope(s) leading up to the containing loop body.
Extend the compilers internal patchlist structure to keep track of the type of scope tied to the patchlist and extend
continue
statement compilation logic to select the appropriate parent patch list in order to determine the amount of locals (stack slots) to clear before the emitted jump instruction.As a result, the
uc_compiler_backpatch()
implementation can be simplified somewhat since we do not need to propagate entries to parent lists anymore.Also add a further regression test case to cover this issue.
Signed-off-by: Jo-Philipp Wich jo@mein.io