fix typeof side effects (#1696)

`statement_to_expression()` drops `typeof` even if it operates on undeclared variables.

Since we now have `drop_side_effect_free()`, replace and remove this deprecated functionality.
This commit is contained in:
Alex Lam S.L
2017-03-27 04:37:42 +08:00
committed by GitHub
parent f5952933a0
commit 581630e0a7
3 changed files with 30 additions and 24 deletions

View File

@@ -579,3 +579,17 @@ issue_1690_2: {
}
expect_stdout: "PASS"
}
if_switch_typeof: {
options = {
conditionals: true,
dead_code: true,
side_effects: true,
}
input: {
if (a) switch(typeof b) {}
}
expect: {
a;
}
}