whitelist calls to functions that always throw an exception

This commit is contained in:
Erik Krogh Kristensen
2019-10-08 11:49:07 +02:00
parent a2993f1849
commit 0933235132
2 changed files with 23 additions and 3 deletions

View File

@@ -56,4 +56,16 @@
var oneOfEach = Math.random() > 0.5 ? onlySideEffects : returnsValue;
var g = oneOfEach(); // OK
console.log(g);
function alwaysThrows() {
if (Math.random() > 0.5) {
console.log("Whatever!")
} else {
console.log("Boo!")
}
throw new Error("Important error!")
}
var h = returnsValue() || alwaysThrows(); // OK!
console.log(h);
})();