Skip to content

Commit

Permalink
Handle actual looping cases
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
griffpatch committed Feb 20, 2017
1 parent 362a231 commit c5eb8ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/engine/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit c5eb8ec

Please sign in to comment.