reset loop counter after last run

This commit is contained in:
sec65 2022-06-05 17:22:42 +02:00
parent 3f57711c39
commit 1fea9a25a5
2 changed files with 5 additions and 0 deletions

View File

@ -64,6 +64,7 @@ class ConditionalJump extends Operation {
jmpIndex = getLabelIndex(label, state);
if (state.numJumps >= maxJumps || jmpIndex === -1) {
state.numJumps = 0;
return state;
}
@ -74,6 +75,9 @@ class ConditionalJump extends Operation {
state.progress = jmpIndex;
state.numJumps++;
}
else {
state.numJumps = 0;
}
}
return state;

View File

@ -52,6 +52,7 @@ class Jump extends Operation {
const jmpIndex = getLabelIndex(label, state);
if (state.numJumps >= maxJumps || jmpIndex === -1) {
state.numJumps = 0;
return state;
}