fix: incorrect continue jump location in for loops
This commit is contained in:
parent
e93498fed5
commit
f1997e4584
@ -30,6 +30,7 @@ public class ForNode extends Node {
|
|||||||
@Override public void compile(CompileResult target, boolean pollute) {
|
@Override public void compile(CompileResult target, boolean pollute) {
|
||||||
if (declaration != null) declaration.compile(target, false, BreakpointType.STEP_OVER);
|
if (declaration != null) declaration.compile(target, false, BreakpointType.STEP_OVER);
|
||||||
|
|
||||||
|
var continueTarget = new DeferredIntSupplier();
|
||||||
int start = target.size();
|
int start = target.size();
|
||||||
int mid = -1;
|
int mid = -1;
|
||||||
if (condition != null) {
|
if (condition != null) {
|
||||||
@ -39,9 +40,10 @@ public class ForNode extends Node {
|
|||||||
|
|
||||||
var end = new DeferredIntSupplier();
|
var end = new DeferredIntSupplier();
|
||||||
|
|
||||||
LabelContext.pushLoop(target.env, loc(), label, end, start);
|
LabelContext.pushLoop(target.env, loc(), label, end, continueTarget);
|
||||||
body.compile(target, false, BreakpointType.STEP_OVER);
|
body.compile(target, false, BreakpointType.STEP_OVER);
|
||||||
|
|
||||||
|
continueTarget.set(target.size());
|
||||||
if (assignment != null) assignment.compile(target, false, BreakpointType.STEP_OVER);
|
if (assignment != null) assignment.compile(target, false, BreakpointType.STEP_OVER);
|
||||||
int endI = target.size();
|
int endI = target.size();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user