@@ -5022,6 +5022,7 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
if (single_use && fixed) {
|
if (single_use && fixed) {
|
||||||
if (fixed instanceof AST_Defun) {
|
if (fixed instanceof AST_Defun) {
|
||||||
|
fixed._squeezed = true;
|
||||||
fixed = make_node(AST_Function, fixed, fixed);
|
fixed = make_node(AST_Function, fixed, fixed);
|
||||||
}
|
}
|
||||||
var value;
|
var value;
|
||||||
|
|||||||
@@ -1951,3 +1951,41 @@ issue_2737_2: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_2783: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
conditionals: true,
|
||||||
|
if_return: true,
|
||||||
|
inline: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function() {
|
||||||
|
return g;
|
||||||
|
function f(a) {
|
||||||
|
var b = a.b;
|
||||||
|
if (b) return b;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
function g(o, i) {
|
||||||
|
while (i--) {
|
||||||
|
console.log(f(o));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})()({ b: "PASS" }, 1);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function() {
|
||||||
|
return function(o,i) {
|
||||||
|
while (i--) console.log(f(o));
|
||||||
|
};
|
||||||
|
function f(a) {
|
||||||
|
var b = a.b;
|
||||||
|
return b || a;
|
||||||
|
}
|
||||||
|
})()({ b: "PASS" },1);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user