mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Handle actual looping cases
And it starts to get a little less elegant :/ Wondering if this should not be handled better in another part of the codebase? We don't want to be duplicating existing code stepping functionality locally at the end of the promise script really... What do you think?
This commit is contained in:
parent
362a231279
commit
c5eb8ece16
1 changed files with 9 additions and 1 deletions
|
@ -241,7 +241,15 @@ var execute = function (sequencer, thread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var nextBlockId = thread.target.blocks.getNextBlock(popped);
|
var nextBlockId = thread.target.blocks.getNextBlock(popped);
|
||||||
} while (nextBlockId === null);
|
if (nextBlockId !== null) {
|
||||||
|
// A next block exists so break out this loop
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Investigate the next block and if not in a loop,
|
||||||
|
// then repeat and pop the next item off the stack frame
|
||||||
|
var stackFrame = thread.peekStackFrame();
|
||||||
|
} while (stackFrame !== null && !stackFrame.isLoop);
|
||||||
|
|
||||||
thread.pushStack(nextBlockId);
|
thread.pushStack(nextBlockId);
|
||||||
} else {
|
} else {
|
||||||
thread.popStack();
|
thread.popStack();
|
||||||
|
|
Loading…
Reference in a new issue