diff options
author | Richard van Velzen <rvanvelzen1@gmail.com> | 2014-10-23 15:57:12 +0200 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2015-01-04 13:37:59 +0100 |
commit | f4d36a58c28cd6dd598a5e92c6ab56605b8c17e4 (patch) | |
tree | cb07a8fb8ea13fdcda3b0252e3deaaf5c91f91af /lib/compress.js | |
parent | 73cc0505f5d41fe4b24d5693e547de9478737187 (diff) | |
download | tracifyjs-f4d36a58c28cd6dd598a5e92c6ab56605b8c17e4.tar.gz tracifyjs-f4d36a58c28cd6dd598a5e92c6ab56605b8c17e4.zip |
Fix #569
When no arguments are given to `new Function()`, it should be treated as
a regular anonymous function (http://es5.github.io/#x15.3.2.1)
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index f8030722..2c950992 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1722,6 +1722,11 @@ merge(Compressor.prototype, { }).transform(compressor); break; case "Function": + // new Function() => function(){} + if (self.args.length == 0) return make_node(AST_Function, self, { + argnames: [], + body: [] + }); if (all(self.args, function(x){ return x instanceof AST_String })) { // quite a corner-case, but we can handle it: // https://github.com/mishoo/UglifyJS2/issues/203 |