@@ -3399,16 +3399,22 @@ merge(Compressor.prototype, {
|
|||||||
def(AST_Lambda, function(scope) {
|
def(AST_Lambda, function(scope) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var result = true;
|
var result = true;
|
||||||
self.walk(new TreeWalker(function(node) {
|
var inner_scopes = [];
|
||||||
|
self.walk(new TreeWalker(function(node, descend) {
|
||||||
if (!result) return true;
|
if (!result) return true;
|
||||||
|
if (node instanceof AST_Scope && node !== self) {
|
||||||
|
inner_scopes.push(node);
|
||||||
|
descend();
|
||||||
|
inner_scopes.pop();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (node instanceof AST_SymbolRef) {
|
if (node instanceof AST_SymbolRef) {
|
||||||
if (self.inlined) {
|
if (self.inlined) {
|
||||||
result = false;
|
result = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var def = node.definition();
|
var def = node.definition();
|
||||||
if (member(def, self.enclosed)
|
if (!self.variables.has(def.name) && !member(def.scope, inner_scopes)) {
|
||||||
&& !self.variables.has(def.name)) {
|
|
||||||
if (scope) {
|
if (scope) {
|
||||||
var scope_def = scope.find_variable(node);
|
var scope_def = scope.find_variable(node);
|
||||||
if (def.undeclared ? !scope_def : scope_def === def) {
|
if (def.undeclared ? !scope_def : scope_def === def) {
|
||||||
|
|||||||
@@ -3148,3 +3148,30 @@ issue_3402: {
|
|||||||
"function",
|
"function",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3444: {
|
||||||
|
options = {
|
||||||
|
inline: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function(h) {
|
||||||
|
return f;
|
||||||
|
function f() {
|
||||||
|
g();
|
||||||
|
}
|
||||||
|
function g() {
|
||||||
|
h("PASS");
|
||||||
|
}
|
||||||
|
})(console.log)();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function(h) {
|
||||||
|
return function() {
|
||||||
|
void h("PASS");
|
||||||
|
};
|
||||||
|
})(console.log)();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user