diff --git a/snap.html b/snap.html index 2a7ff3c1..c24b390b 100755 --- a/snap.html +++ b/snap.html @@ -8,7 +8,7 @@ - + diff --git a/src/threads.js b/src/threads.js index a70b8958..800df3e7 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2020-August-01'; +modules.threads = '2020-August-05'; var ThreadManager; var Process; @@ -2137,6 +2137,52 @@ Process.prototype.reportIfElse = function (block) { } }; +/* +// Process - hyperized reporter-if, experimental, commented out for now + +Process.prototype.reportIfElse = function (block) { + var inputs = this.context.inputs; + + if (inputs.length < 1) { + this.evaluateNextInput(block); + } else if (inputs.length > 1) { + if (this.flashContext()) {return; } + if (inputs[0] instanceof List && this.enableHyperOps) { + if (inputs.length < 3) { + this.evaluateNextInput(block); + } else { + this.returnValueToParentContext( + this.hyperIf.apply(this, inputs) + ); + this.popContext(); + } + } else { + this.returnValueToParentContext(inputs.pop()); + this.popContext(); + } + } else { + if (inputs[0] instanceof List && this.enableHyperOps) { + this.evaluateNextInput(block); + } else { + // this.assertType(inputs[0], ['Boolean']); + if (inputs[0]) { + this.evaluateNextInput(block); + } else { + inputs.push(null); + this.evaluateNextInput(block); + } + } + } +}; + +Process.prototype.hyperIf = function (test, trueValue, falseValue) { + if (test instanceof List) { + return test.map(each => this.hyperIf(each, trueValue, falseValue)); + } + return test ? trueValue : falseValue; +}; +*/ + // Process process related primitives Process.prototype.doStop = function () {