@@ -1537,6 +1537,12 @@ var AST_Assign = DEFNODE("Assign", null, {
|
|||||||
throw new Error("left must be assignable: " + node.TYPE);
|
throw new Error("left must be assignable: " + node.TYPE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (!(this.left instanceof AST_Infinity
|
||||||
|
|| this.left instanceof AST_NaN
|
||||||
|
|| this.left instanceof AST_PropAccess && !this.left.optional
|
||||||
|
|| this.left instanceof AST_SymbolRef
|
||||||
|
|| this.left instanceof AST_Undefined)) {
|
||||||
|
throw new Error("left must be assignable");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}, AST_Binary);
|
}, AST_Binary);
|
||||||
|
|||||||
@@ -7795,6 +7795,7 @@ Compressor.prototype.compress = function(node) {
|
|||||||
var defs = defs_by_id[node.definition().id];
|
var defs = defs_by_id[node.definition().id];
|
||||||
if (!defs) return;
|
if (!defs) return;
|
||||||
if (node.fixed_value() !== defs.value) return;
|
if (node.fixed_value() !== defs.value) return;
|
||||||
|
if (is_lhs(node, this.parent())) return;
|
||||||
return make_node(AST_Object, node, { properties: [] });
|
return make_node(AST_Object, node, { properties: [] });
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -1957,3 +1957,37 @@ issue_5192: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5222: {
|
||||||
|
options = {
|
||||||
|
hoist_props: true,
|
||||||
|
inline: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
side_effects: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function f() {
|
||||||
|
do {
|
||||||
|
(function() {
|
||||||
|
var a = {
|
||||||
|
p: [ a ] = [],
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
} while (console.log("PASS"));
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function() {
|
||||||
|
do {
|
||||||
|
a = void 0,
|
||||||
|
[ a ] = [];
|
||||||
|
} while (console.log("PASS"));
|
||||||
|
var a;
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user