fix delete related issues in collapse_vars and reduce_vars (#1689)
This commit is contained in:
@@ -894,7 +894,8 @@ collapse_vars_unary: {
|
||||
}
|
||||
expect: {
|
||||
function f0(o, p) {
|
||||
delete o[p];
|
||||
var x = o[p];
|
||||
delete x;
|
||||
}
|
||||
function f1(n) {
|
||||
return n > +!!n
|
||||
|
||||
@@ -1544,3 +1544,30 @@ issue_1670_6: {
|
||||
}
|
||||
expect_stdout: "1"
|
||||
}
|
||||
|
||||
unary_delete: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
reduce_vars: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
var b = 10;
|
||||
function f() {
|
||||
var a;
|
||||
if (delete a) b--;
|
||||
}
|
||||
f();
|
||||
console.log(b);
|
||||
}
|
||||
expect: {
|
||||
var b = 10;
|
||||
function f() {
|
||||
var a;
|
||||
if (delete a) b--;
|
||||
}
|
||||
f();
|
||||
console.log(b);
|
||||
}
|
||||
expect_stdout: true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user