fix unsafe evaluation of AST_Sub (#2389)
This commit is contained in:
@@ -4468,6 +4468,7 @@ merge(Compressor.prototype, {
|
||||
});
|
||||
}
|
||||
}
|
||||
if (is_lhs(self, compressor.parent())) return self;
|
||||
var ev = self.evaluate(compressor);
|
||||
if (ev !== self) {
|
||||
ev = make_node_from_constant(ev, self).optimize(compressor);
|
||||
|
||||
@@ -805,7 +805,7 @@ issue_2256: {
|
||||
}
|
||||
}
|
||||
|
||||
lhs_prop: {
|
||||
lhs_prop_1: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
unsafe: true,
|
||||
@@ -822,3 +822,22 @@ lhs_prop: {
|
||||
}
|
||||
expect_stdout: "2"
|
||||
}
|
||||
|
||||
lhs_prop_2: {
|
||||
options = {
|
||||
evaluate: true,
|
||||
inline: true,
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
unsafe: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
(function(a) {
|
||||
a[2] = "g";
|
||||
})("abc");
|
||||
}
|
||||
expect: {
|
||||
"abc"[2] = "g";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user