@@ -4449,7 +4449,9 @@ merge(Compressor.prototype, {
|
|||||||
segment.block = node;
|
segment.block = node;
|
||||||
walk_body(node, tw);
|
walk_body(node, tw);
|
||||||
if (node.bcatch) {
|
if (node.bcatch) {
|
||||||
references[node.bcatch.argname.definition().id] = false;
|
var def = node.bcatch.argname.definition();
|
||||||
|
references[def.id] = false;
|
||||||
|
if (def = def.redefined()) references[def.id] = false;
|
||||||
pop();
|
pop();
|
||||||
push();
|
push();
|
||||||
walk_body(node.bcatch, tw);
|
walk_body(node.bcatch, tw);
|
||||||
@@ -4843,8 +4845,10 @@ merge(Compressor.prototype, {
|
|||||||
&& !compressor.option("ie8")
|
&& !compressor.option("ie8")
|
||||||
&& var_defs.length == 1
|
&& var_defs.length == 1
|
||||||
&& sym.assignments == 0
|
&& sym.assignments == 0
|
||||||
&& def.value === def.name.fixed_value()
|
|
||||||
&& def.value instanceof AST_Function
|
&& def.value instanceof AST_Function
|
||||||
|
&& (sym.references.length ? all(sym.references, function(ref) {
|
||||||
|
return def.value === ref.fixed_value();
|
||||||
|
}) : def.value === def.name.fixed_value())
|
||||||
&& (!def.value.name || (old_def = def.value.name.definition()).assignments == 0
|
&& (!def.value.name || (old_def = def.value.name.definition()).assignments == 0
|
||||||
&& (old_def.name == def.name.name || all(old_def.references, function(ref) {
|
&& (old_def.name == def.name.name || all(old_def.references, function(ref) {
|
||||||
return ref.scope.find_variable(def.name) === def.name.definition();
|
return ref.scope.find_variable(def.name) === def.name.definition();
|
||||||
|
|||||||
@@ -4777,3 +4777,34 @@ issue_4006: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "-1"
|
expect_stdout: "-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4155: {
|
||||||
|
options = {
|
||||||
|
functions: true,
|
||||||
|
inline: true,
|
||||||
|
merge_vars: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function() {
|
||||||
|
var a;
|
||||||
|
(function() {
|
||||||
|
console.log(a);
|
||||||
|
})(a);
|
||||||
|
var b = function() {};
|
||||||
|
b && console.log(typeof b);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function() {
|
||||||
|
void console.log(b);
|
||||||
|
var b = function() {};
|
||||||
|
b && console.log(typeof b);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"undefined",
|
||||||
|
"function",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
@@ -2822,3 +2822,41 @@ conditional_write: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS,42"
|
expect_stdout: "PASS,42"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4155: {
|
||||||
|
options = {
|
||||||
|
inline: true,
|
||||||
|
merge_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function() {
|
||||||
|
try {
|
||||||
|
throw "PASS";
|
||||||
|
} catch (e) {
|
||||||
|
var a;
|
||||||
|
(function() {
|
||||||
|
console.log(e, a);
|
||||||
|
})(a = NaN);
|
||||||
|
}
|
||||||
|
var e = function() {};
|
||||||
|
e && console.log(typeof e);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function() {
|
||||||
|
try {
|
||||||
|
throw "PASS";
|
||||||
|
} catch (e) {
|
||||||
|
var a;
|
||||||
|
a = NaN,
|
||||||
|
void console.log(e, a);
|
||||||
|
}
|
||||||
|
var e = function() {};
|
||||||
|
e && console.log(typeof e);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"PASS NaN",
|
||||||
|
"function",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user