added type-assertions for Boolean OR reporter

pull/95/head
jmoenig 2020-05-24 13:58:54 +02:00
rodzic ef9b826d7e
commit 257c5d23a3
1 zmienionych plików z 17 dodań i 9 usunięć

Wyświetl plik

@ -788,16 +788,24 @@ Process.prototype.reportOr = function (block) {
if (inputs.length < 1) {
this.evaluateNextInput(block);
} else if (inputs[0]) {
if (this.flashContext()) {return; }
this.returnValueToParentContext(true);
this.popContext();
} else if (inputs.length < 2) {
this.evaluateNextInput(block);
} else {
if (this.flashContext()) {return; }
this.returnValueToParentContext(inputs[1] === true);
this.popContext();
if (inputs.length === 1) {
this.assertType(inputs[0], 'Boolean');
if (inputs[0]) {
if (this.flashContext()) {return; }
this.returnValueToParentContext(true);
this.popContext();
return;
}
}
if (inputs.length < 2) {
this.evaluateNextInput(block);
} else {
this.assertType(inputs[1], 'Boolean');
if (this.flashContext()) {return; }
this.returnValueToParentContext(inputs[1] === true);
this.popContext();
}
}
};