fix pre-existing issue
- chained assignment
This commit is contained in:
parent
79d533a560
commit
2bdf3dc1c0
|
|
@ -297,7 +297,9 @@ merge(Compressor.prototype, {
|
||||||
&& node.operator == "="
|
&& node.operator == "="
|
||||||
&& node.left instanceof AST_SymbolRef) {
|
&& node.left instanceof AST_SymbolRef) {
|
||||||
var d = node.left.definition();
|
var d = node.left.definition();
|
||||||
if (HOP(safe_ids, d.id) && safe_to_assign(d, node.right)) {
|
if (HOP(safe_ids, d.id)
|
||||||
|
&& safe_to_read(d)
|
||||||
|
&& safe_to_assign(d, node.right)) {
|
||||||
d.references.push(node.left);
|
d.references.push(node.left);
|
||||||
d.fixed = function() {
|
d.fixed = function() {
|
||||||
return node.right;
|
return node.right;
|
||||||
|
|
|
||||||
|
|
@ -2110,6 +2110,27 @@ var_assign_5: {
|
||||||
expect_stdout: "2 undefined"
|
expect_stdout: "2 undefined"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var_assign_6: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
!function() {
|
||||||
|
var a = function(){}(a = 1);
|
||||||
|
console.log(a);
|
||||||
|
}();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
!function() {
|
||||||
|
var a = function(){}(a = 1);
|
||||||
|
console.log(a);
|
||||||
|
}();
|
||||||
|
}
|
||||||
|
expect_stdout: "undefined"
|
||||||
|
}
|
||||||
|
|
||||||
immutable: {
|
immutable: {
|
||||||
options = {
|
options = {
|
||||||
evaluate: true,
|
evaluate: true,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user