kopia lustrzana https://github.com/backface/turtlestitch
experimental hyperized reporter-if, commented out for now
rodzic
a368bec787
commit
ec07508937
|
@ -8,7 +8,7 @@
|
|||
<script src="src/symbols.js?version=2020-07-21"></script>
|
||||
<script src="src/widgets.js?version=2020-07-27"></script>
|
||||
<script src="src/blocks.js?version=2020-08-04"></script>
|
||||
<script src="src/threads.js?version=2020-08-01"></script>
|
||||
<script src="src/threads.js?version=2020-08-05"></script>
|
||||
<script src="src/objects.js?version=2020-07-26"></script>
|
||||
<script src="src/gui.js?version=2020-08-04"></script>
|
||||
<script src="src/paint.js?version=2020-05-17"></script>
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Ładowanie…
Reference in New Issue