From 5f100129b6e5513c8a171099e919d5b3b740bf1e Mon Sep 17 00:00:00 2001 From: griffpatch Date: Thu, 26 Jan 2017 11:29:58 +0000 Subject: [PATCH] Fix for ending warp bug When popping down the stack frame it is assumed that you keep using the previous warp state rather than looking at the warp state of the level you just popped out to. This causes the loss of screen updates if the warping block was the last statement in a loop as the loop does not obey it's 'non warp' status. --- src/engine/sequencer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/engine/sequencer.js b/src/engine/sequencer.js index 16e07110e..730b03b2f 100644 --- a/src/engine/sequencer.js +++ b/src/engine/sequencer.js @@ -131,12 +131,17 @@ Sequencer.prototype.stepThread = function (thread) { // If no next block has been found at this point, look on the stack. while (!thread.peekStack()) { thread.popStack(); + if (thread.stack.length === 0) { // No more stack to run! thread.status = Thread.STATUS_DONE; return; } - if (thread.peekStackFrame().isLoop) { + + var stackFrame = thread.peekStackFrame(); + isWarpMode = stackFrame.warpMode; + + if (stackFrame.isLoop) { // The current level of the stack is marked as a loop. // Return to yield for the frame/tick in general. // Unless we're in warp mode - then only return if the @@ -151,7 +156,7 @@ Sequencer.prototype.stepThread = function (thread) { // since loops need to be re-executed. continue; } - } else if (thread.peekStackFrame().waitingReporter) { + } else if (stackFrame.waitingReporter) { // This level of the stack was waiting for a value. // This means a reporter has just returned - so don't go // to the next block for this level of the stack.