From 320bfd0c990ea60e1dcf6bfdbe7538b203283709 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 26 Nov 2014 16:26:53 +0100 Subject: [PATCH] Fixed #656 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make sure to always evaluate the “report” block’s input, even if used inside a custom command definition, because hardware extensions (and other reporters with side-effects) rely on it. --- history.txt | 4 ++++ threads.js | 39 +++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/history.txt b/history.txt index 7d876c8b..39a801d0 100755 --- a/history.txt +++ b/history.txt @@ -2358,3 +2358,7 @@ ______ ------- * Threads: Evaluator optimizations (reducing the stack size for reporters) * Threads: Full TCO (tail-call-elimination), now Snap! *is* Scheme :-) + +1411225 +------- +* Threads: Fixed #656 diff --git a/threads.js b/threads.js index bdb780a2..59dd23a3 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-November-25'; +modules.threads = '2014-November-26'; var ThreadManager; var Process; @@ -551,28 +551,31 @@ Process.prototype.reportAnd = function (block) { }; Process.prototype.doReport = function (block) { + var outer = this.context.outerContext; if (this.context.expression.partOfCustomCommand) { this.doStopCustomBlock(); this.popContext(); - return; - } - var outer = this.context.outerContext; - while (this.context && this.context.tag !== 'exit') { - if (this.context.expression === 'doStopWarping') { - this.doStopWarping(); - } else { - this.popContext(); - } - } - if (this.context) { - if (this.context.expression === 'expectReport') { - // pop off inserted top-level exit context - this.popContext(); - } else { - // un-tag and preserve original caller - this.context.tag = null; + } else { + while (this.context && this.context.tag !== 'exit') { + if (this.context.expression === 'doStopWarping') { + this.doStopWarping(); + } else { + this.popContext(); + } + } + if (this.context) { + if (this.context.expression === 'expectReport') { + // pop off inserted top-level exit context + this.popContext(); + } else { + // un-tag and preserve original caller + this.context.tag = null; + } } } + // in any case evaluate (and ignore) + // the input, because it could be + // and HTTP Request for a hardware extension this.pushContext(block.inputs()[0], outer); };