@@ -3602,7 +3602,7 @@ merge(Compressor.prototype, {
|
|||||||
compressor.warn("Declaring {name} as function [{file}:{line},{col}]", template(def.name));
|
compressor.warn("Declaring {name} as function [{file}:{line},{col}]", template(def.name));
|
||||||
var defun = make_node(AST_Defun, def, def.value);
|
var defun = make_node(AST_Defun, def, def.value);
|
||||||
defun.name = make_node(AST_SymbolDefun, def.name, def.name);
|
defun.name = make_node(AST_SymbolDefun, def.name, def.name);
|
||||||
defun.parent_scope.resolve().def_function(defun.name);
|
def.name.scope.resolve().def_function(defun.name);
|
||||||
body.push(defun);
|
body.push(defun);
|
||||||
} else {
|
} else {
|
||||||
if (side_effects.length > 0) {
|
if (side_effects.length > 0) {
|
||||||
|
|||||||
@@ -2981,3 +2981,34 @@ issue_3364: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "2"
|
expect_stdout: "2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3366: {
|
||||||
|
options = {
|
||||||
|
functions: true,
|
||||||
|
inline: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function f() {
|
||||||
|
function g() {
|
||||||
|
return function() {};
|
||||||
|
}
|
||||||
|
var a = g();
|
||||||
|
(function() {
|
||||||
|
this && a && console.log("PASS");
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function() {
|
||||||
|
function a() {}
|
||||||
|
(function() {
|
||||||
|
this && a && console.log("PASS");
|
||||||
|
})();
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
@@ -73,8 +73,10 @@ exports.run_code = function(code, reuse) {
|
|||||||
process.stdout.write = original_write;
|
process.stdout.write = original_write;
|
||||||
if (!reuse || code.indexOf(".prototype") >= 0) {
|
if (!reuse || code.indexOf(".prototype") >= 0) {
|
||||||
context = null;
|
context = null;
|
||||||
} else for (var key in context) {
|
} else {
|
||||||
delete context[key];
|
vm.runInContext(Object.keys(context).map(function(name) {
|
||||||
|
return "delete " + name;
|
||||||
|
}).join("\n"), context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user