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:
griffpatch 2017-02-20 09:40:32 +00:00
parent 362a231279
commit c5eb8ece16

View file

@ -241,7 +241,15 @@ var execute = function (sequencer, thread) {
return;
}
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);
} else {
thread.popStack();