diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-05 12:12:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-05 12:12:59 +0800 |
commit | 78d1bb92d4560b73099afddd3bd2a85641bf3002 (patch) | |
tree | a867b25913d92beb9d2eb4597dbd78d137c780ce /lib/compress.js | |
parent | ea9ab9fb0e48b4bf011da67f86652f148ae6ed1a (diff) | |
download | tracifyjs-78d1bb92d4560b73099afddd3bd2a85641bf3002.tar.gz tracifyjs-78d1bb92d4560b73099afddd3bd2a85641bf3002.zip |
fix a corner case in #1530 (#1552)
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js index 35459006..7eead2c1 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -2760,10 +2760,12 @@ merge(Compressor.prototype, { } } if (exp instanceof AST_Function) { - if (exp.body[0] instanceof AST_Return - && exp.body[0].value.is_constant()) { - var args = self.args.concat(exp.body[0].value); - return AST_Seq.from_array(args).transform(compressor); + if (exp.body[0] instanceof AST_Return) { + var value = exp.body[0].value; + if (!value || value.is_constant()) { + var args = self.args.concat(value || make_node(AST_Undefined, self)); + return AST_Seq.from_array(args).transform(compressor); + } } if (compressor.option("side_effects")) { if (!AST_Block.prototype.has_side_effects.call(exp, compressor)) { |