// https://github.com/mishoo/UglifyJS2/issues/203
// if the code argument is a constant, then we can minify it.
try {
- var code = "NaN(function(" + self.args.slice(0, -1).map(function(arg) {
+ var code = "n(function(" + self.args.slice(0, -1).map(function(arg) {
return arg.value;
}).join(",") + "){" + self.args[self.args.length - 1].value + "})";
var ast = parse(code);
return true;
}
}));
- var args = fun.argnames.map(function(arg, i) {
- return make_node(AST_String, self.args[i], {
- value: arg.print_to_string()
- });
- });
var code = OutputStream();
AST_BlockStatement.prototype._codegen.call(fun, fun, code);
- code = code.toString().replace(/^\{|\}$/g, "");
- args.push(make_node(AST_String, self.args[self.args.length - 1], {
- value: code
- }));
- self.args = args;
+ self.args = [
+ make_node(AST_String, self, {
+ value: fun.argnames.map(function(arg) {
+ return arg.print_to_string();
+ }).join(",")
+ }),
+ make_node(AST_String, self.args[self.args.length - 1], {
+ value: code.get().replace(/^\{|\}$/g, "")
+ })
+ ];
return self;
} catch (ex) {
if (ex instanceof JS_Parse_Error) {