Skip to content

Commit 8246282

Browse files
authored
Merge pull request #406 from griffpatch/bugfix/end-warp-bug
Runtime does not exit warp mode if at end of loop #398
2 parents de40350 + c6a872e commit 8246282

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/engine/sequencer.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,17 @@ Sequencer.prototype.stepThread = function (thread) {
131131
// If no next block has been found at this point, look on the stack.
132132
while (!thread.peekStack()) {
133133
thread.popStack();
134+
134135
if (thread.stack.length === 0) {
135136
// No more stack to run!
136137
thread.status = Thread.STATUS_DONE;
137138
return;
138139
}
139-
if (thread.peekStackFrame().isLoop) {
140+
141+
var stackFrame = thread.peekStackFrame();
142+
isWarpMode = stackFrame.warpMode;
143+
144+
if (stackFrame.isLoop) {
140145
// The current level of the stack is marked as a loop.
141146
// Return to yield for the frame/tick in general.
142147
// Unless we're in warp mode - then only return if the
@@ -151,7 +156,7 @@ Sequencer.prototype.stepThread = function (thread) {
151156
// since loops need to be re-executed.
152157
continue;
153158
}
154-
} else if (thread.peekStackFrame().waitingReporter) {
159+
} else if (stackFrame.waitingReporter) {
155160
// This level of the stack was waiting for a value.
156161
// This means a reporter has just returned - so don't go
157162
// to the next block for this level of the stack.

0 commit comments

Comments
 (0)