drop assignments to constant expressions only (#2839)

fixes #2838
This commit is contained in:
Alex Lam S.L
2018-01-23 02:49:54 +08:00
committed by GitHub
parent 5e2cd07d6f
commit ec4202590d
2 changed files with 31 additions and 2 deletions

View File

@@ -694,3 +694,30 @@ issue_2678: {
}
expect_stdout: "PASS"
}
issue_2838: {
options = {
pure_getters: true,
side_effects: true,
}
input: {
function f(a, b) {
(a || b).c = "PASS";
(function() {
return f(a, b);
}).prototype.foo = "bar";
}
var o = {};
f(null, o);
console.log(o.c);
}
expect: {
function f(a, b) {
(a || b).c = "PASS";
}
var o = {};
f(null, o);
console.log(o.c);
}
expect_stdout: "PASS"
}