@@ -6821,18 +6821,14 @@ merge(Compressor.prototype, {
|
|||||||
if (vars_found > 0) {
|
if (vars_found > 0) {
|
||||||
// collect only vars which don't show up in self's arguments list
|
// collect only vars which don't show up in self's arguments list
|
||||||
var defs = [];
|
var defs = [];
|
||||||
|
if (self instanceof AST_Lambda) self.each_argname(function(argname) {
|
||||||
|
vars.del(argname.name);
|
||||||
|
});
|
||||||
vars.each(function(def, name) {
|
vars.each(function(def, name) {
|
||||||
if (self instanceof AST_Lambda
|
def = def.clone();
|
||||||
&& !all(self.argnames, function(argname) {
|
def.value = null;
|
||||||
return argname.name != name;
|
defs.push(def);
|
||||||
})) {
|
vars.set(name, def);
|
||||||
vars.del(name);
|
|
||||||
} else {
|
|
||||||
def = def.clone();
|
|
||||||
def.value = null;
|
|
||||||
defs.push(def);
|
|
||||||
vars.set(name, def);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (defs.length > 0) {
|
if (defs.length > 0) {
|
||||||
// try to merge in assignments
|
// try to merge in assignments
|
||||||
@@ -6856,7 +6852,7 @@ merge(Compressor.prototype, {
|
|||||||
&& vars.has(sym.name)) {
|
&& vars.has(sym.name)) {
|
||||||
var def = vars.get(sym.name);
|
var def = vars.get(sym.name);
|
||||||
if (def.value) break;
|
if (def.value) break;
|
||||||
def.value = expr.right;
|
def.value = expr.right.clone();
|
||||||
remove(defs, def);
|
remove(defs, def);
|
||||||
defs.push(def);
|
defs.push(def);
|
||||||
body.shift();
|
body.shift();
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ issue_4487: {
|
|||||||
functions: true,
|
functions: true,
|
||||||
hoist_vars: true,
|
hoist_vars: true,
|
||||||
keep_fnames: true,
|
keep_fnames: true,
|
||||||
|
passes: 2,
|
||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
toplevel: true,
|
toplevel: true,
|
||||||
unused: true,
|
unused: true,
|
||||||
@@ -207,3 +208,35 @@ issue_4517: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "2boolean"
|
expect_stdout: "2boolean"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4736: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
evaluate: true,
|
||||||
|
hoist_vars: true,
|
||||||
|
merge_vars: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a;
|
||||||
|
function f() {
|
||||||
|
(function g() {
|
||||||
|
var b = (a = 0, 1 << 30);
|
||||||
|
var c = (a = 0, console.log(b));
|
||||||
|
var d = c;
|
||||||
|
})(f);
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function() {
|
||||||
|
(function() {
|
||||||
|
0,
|
||||||
|
console.log(1073741824);
|
||||||
|
})();
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: "1073741824"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user