Fix (typeof side_effect()) in boolean context

Fixes #1289 with suggestion by @rvanvelzen
This commit is contained in:
kzc
2016-10-02 10:46:09 -04:00
committed by Richard van Velzen
parent 4761d07e0b
commit fc9804b909
2 changed files with 28 additions and 0 deletions

View File

@@ -23,3 +23,25 @@ typeof_evaluation: {
h='undefined';
}
}
typeof_in_boolean_context: {
options = {
booleans : true,
evaluate : true,
conditionals : true,
};
input: {
function f1(x) { return typeof x ? "yes" : "no"; }
function f2() { return typeof g()? "Yes" : "No"; }
typeof 0 ? foo() : bar();
!typeof console.log(1);
var a = !typeof console.log(2);
}
expect: {
function f1(x) { return "yes"; }
function f2() { return g(), "Yes"; }
foo();
!(console.log(1), !0);
var a = !(console.log(2), !0);
}
}