@@ -4315,10 +4315,11 @@ merge(Compressor.prototype, {
|
||||
var prev = Object.create(null);
|
||||
var tw = new TreeWalker(function(node, descend) {
|
||||
if (node instanceof AST_Assign) {
|
||||
if (node.operator != "=") return;
|
||||
var sym = node.left;
|
||||
if (!(sym instanceof AST_SymbolRef)) return;
|
||||
node.right.walk(tw);
|
||||
mark(sym, node.operator == "=");
|
||||
mark(sym, true);
|
||||
return true;
|
||||
}
|
||||
if (node instanceof AST_Binary) {
|
||||
|
||||
@@ -260,3 +260,30 @@ read_before_assign_2: {
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_4103: {
|
||||
options = {
|
||||
merge_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
function f(a) {
|
||||
console.log(a);
|
||||
}
|
||||
var b = 0;
|
||||
var c = f(b++ + (c %= 1 >> console.log(c = 0)));
|
||||
b;
|
||||
}
|
||||
expect: {
|
||||
function f(a) {
|
||||
console.log(a);
|
||||
}
|
||||
var b = 0;
|
||||
var c = f(b++ + (c %= 1 >> console.log(c = 0)));
|
||||
}
|
||||
expect_stdout: [
|
||||
"0",
|
||||
"NaN",
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user