@@ -1441,11 +1441,13 @@ Compressor.prototype.compress = function(node) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ref.fixed) ref.fixed = d.fixed === 0 ? fixed : d.fixed;
|
if (!ref.fixed) ref.fixed = d.fixed === 0 ? fixed : d.fixed;
|
||||||
var parent;
|
if (!value && fixed) value = fixed instanceof AST_Node ? fixed : fixed();
|
||||||
if (value instanceof AST_Lambda
|
if (!(value instanceof AST_Lambda)) return;
|
||||||
&& !((parent = tw.parent()) instanceof AST_Call && parent.expression === ref)) {
|
if (d.fixed) {
|
||||||
mark_fn_def(tw, d, value);
|
var parent = tw.parent();
|
||||||
|
if (parent instanceof AST_Call && parent.expression === ref) return;
|
||||||
}
|
}
|
||||||
|
mark_fn_def(tw, d, value);
|
||||||
});
|
});
|
||||||
def(AST_Template, function(tw, descend) {
|
def(AST_Template, function(tw, descend) {
|
||||||
var node = this;
|
var node = this;
|
||||||
|
|||||||
@@ -8062,3 +8062,89 @@ issue_5716_5: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "42"
|
expect_stdout: "42"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5730_1: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = "PASS";
|
||||||
|
L: {
|
||||||
|
var f = function() {
|
||||||
|
console.log(a);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
a++;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = "PASS";
|
||||||
|
var f = function() {
|
||||||
|
console.log(a);
|
||||||
|
};
|
||||||
|
f();
|
||||||
|
a++;
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5730_2: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = "PASS";
|
||||||
|
try {
|
||||||
|
var f = function() {
|
||||||
|
console.log(a);
|
||||||
|
};
|
||||||
|
} finally {}
|
||||||
|
f();
|
||||||
|
a++;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = "PASS";
|
||||||
|
try {
|
||||||
|
var f = function() {
|
||||||
|
console.log(a);
|
||||||
|
};
|
||||||
|
} finally {}
|
||||||
|
f();
|
||||||
|
a++;
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5730_3: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var f, a = "PASS";
|
||||||
|
L: {
|
||||||
|
f = function() {
|
||||||
|
console.log(a);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
a++;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var f, a = "PASS";
|
||||||
|
f = function() {
|
||||||
|
console.log(a);
|
||||||
|
};
|
||||||
|
f();
|
||||||
|
a++;
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user