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.
pull/3/merge
jmoenig 2014-11-26 16:26:53 +01:00
rodzic 723c232f3d
commit 320bfd0c99
2 zmienionych plików z 25 dodań i 18 usunięć

Wyświetl plik

@ -2358,3 +2358,7 @@ ______
------- -------
* Threads: Evaluator optimizations (reducing the stack size for reporters) * Threads: Evaluator optimizations (reducing the stack size for reporters)
* Threads: Full TCO (tail-call-elimination), now Snap! *is* Scheme :-) * Threads: Full TCO (tail-call-elimination), now Snap! *is* Scheme :-)
1411225
-------
* Threads: Fixed #656

Wyświetl plik

@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.threads = '2014-November-25'; modules.threads = '2014-November-26';
var ThreadManager; var ThreadManager;
var Process; var Process;
@ -551,28 +551,31 @@ Process.prototype.reportAnd = function (block) {
}; };
Process.prototype.doReport = function (block) { Process.prototype.doReport = function (block) {
var outer = this.context.outerContext;
if (this.context.expression.partOfCustomCommand) { if (this.context.expression.partOfCustomCommand) {
this.doStopCustomBlock(); this.doStopCustomBlock();
this.popContext(); this.popContext();
return; } else {
} while (this.context && this.context.tag !== 'exit') {
var outer = this.context.outerContext; if (this.context.expression === 'doStopWarping') {
while (this.context && this.context.tag !== 'exit') { this.doStopWarping();
if (this.context.expression === 'doStopWarping') { } else {
this.doStopWarping(); this.popContext();
} else { }
this.popContext(); }
} if (this.context) {
} if (this.context.expression === 'expectReport') {
if (this.context) { // pop off inserted top-level exit context
if (this.context.expression === 'expectReport') { this.popContext();
// pop off inserted top-level exit context } else {
this.popContext(); // un-tag and preserve original caller
} else { this.context.tag = null;
// 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); this.pushContext(block.inputs()[0], outer);
}; };