@@ -3716,6 +3716,7 @@ merge(Compressor.prototype, {
|
|||||||
if (!def.value) {
|
if (!def.value) {
|
||||||
head.push(def);
|
head.push(def);
|
||||||
} else if (compressor.option("functions")
|
} else if (compressor.option("functions")
|
||||||
|
&& !compressor.option("ie8")
|
||||||
&& def.value === def.name.fixed_value()
|
&& def.value === def.name.fixed_value()
|
||||||
&& def.value instanceof AST_Function
|
&& def.value instanceof AST_Function
|
||||||
&& !(def.value.name && def.value.name.definition().assignments)
|
&& !(def.value.name && def.value.name.definition().assignments)
|
||||||
@@ -6183,7 +6184,9 @@ merge(Compressor.prototype, {
|
|||||||
var fn = node.fixed_value();
|
var fn = node.fixed_value();
|
||||||
if (!(fn instanceof AST_Lambda)) return;
|
if (!(fn instanceof AST_Lambda)) return;
|
||||||
if (!fn.name) return;
|
if (!fn.name) return;
|
||||||
if (fixed.variables.get(fn.name.name) !== fn.name.definition()) return;
|
var fn_def = fn.name.definition();
|
||||||
|
if (fn_def.scope !== fn.name.scope) return;
|
||||||
|
if (fixed.variables.get(fn.name.name) !== fn_def) return;
|
||||||
fn.name = fn.name.clone();
|
fn.name = fn.name.clone();
|
||||||
var value_def = value.variables.get(fn.name.name) || value.def_function(fn.name);
|
var value_def = value.variables.get(fn.name.name) || value.def_function(fn.name);
|
||||||
node.thedef = value_def;
|
node.thedef = value_def;
|
||||||
|
|||||||
@@ -1013,3 +1013,71 @@ issue_3468_ie8: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "function"
|
expect_stdout: "function"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3471: {
|
||||||
|
options = {
|
||||||
|
ie8: false,
|
||||||
|
functions: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var c = 1;
|
||||||
|
function f() {
|
||||||
|
var a = function g() {
|
||||||
|
--c && f();
|
||||||
|
g.p = 0;
|
||||||
|
};
|
||||||
|
for (var p in a)
|
||||||
|
a[p];
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var c = 1;
|
||||||
|
(function f() {
|
||||||
|
function a() {
|
||||||
|
--c && f();
|
||||||
|
a.p = 0;
|
||||||
|
}
|
||||||
|
for (var p in a)
|
||||||
|
a[p];
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: true
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_3471_ie8: {
|
||||||
|
options = {
|
||||||
|
ie8: true,
|
||||||
|
functions: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var c = 1;
|
||||||
|
function f() {
|
||||||
|
var a = function g() {
|
||||||
|
--c && f();
|
||||||
|
g.p = 0;
|
||||||
|
};
|
||||||
|
for (var p in a)
|
||||||
|
a[p];
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var c = 1;
|
||||||
|
(function f() {
|
||||||
|
var a = function g() {
|
||||||
|
--c && f();
|
||||||
|
g.p = 0;
|
||||||
|
};
|
||||||
|
for (var p in a)
|
||||||
|
a[p];
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: true
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user