Fix error in the output minifying Function("return this")()

This commit is contained in:
Mihai Bazon
2013-09-30 11:49:29 +03:00
parent afdaeba37d
commit 95b4507c02

View File

@@ -1646,7 +1646,17 @@ merge(Compressor.prototype, {
ast = ast.transform(comp); ast = ast.transform(comp);
ast.figure_out_scope(); ast.figure_out_scope();
ast.mangle_names(); ast.mangle_names();
var fun = ast.body[0].body.expression; var fun;
try {
ast.walk(new TreeWalker(function(node){
if (node instanceof AST_Lambda) {
fun = node;
throw ast;
}
}));
} catch(ex) {
if (ex !== ast) throw ex;
};
var args = fun.argnames.map(function(arg, i){ var args = fun.argnames.map(function(arg, i){
return make_node(AST_String, self.args[i], { return make_node(AST_String, self.args[i], {
value: arg.print_to_string() value: arg.print_to_string()
@@ -1666,6 +1676,7 @@ merge(Compressor.prototype, {
compressor.warn(ex.toString()); compressor.warn(ex.toString());
} else { } else {
console.log(ex); console.log(ex);
throw ex;
} }
} }
} }