diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-05-01 02:06:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 09:06:40 +0800 |
commit | 74801de315df085b0657660dcb9615cca67743e1 (patch) | |
tree | 9e45d47a8f12d69e09e3c07758eacdd3d197a519 /lib/compress.js | |
parent | f80d5b8c9ec0de7b3e7f99981da9f2d39ece66c4 (diff) | |
download | tracifyjs-74801de315df085b0657660dcb9615cca67743e1.tar.gz tracifyjs-74801de315df085b0657660dcb9615cca67743e1.zip |
fix corner cases in `inline` (#3834)
fixes #3833
fixes #3835
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index 15db2332..79f52783 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -3991,10 +3991,17 @@ merge(Compressor.prototype, { if (!call || call.TYPE != "Call") break; var fn = call.expression; if (fn instanceof AST_SymbolRef) { + if (self.name && self.name.definition() === fn.definition()) break; fn = fn.fixed_value(); } if (!(fn instanceof AST_Lambda)) break; if (fn.uses_arguments) break; + if (fn === call.expression) { + if (fn.parent_scope !== self) break; + if (!all(fn.enclosed, function(def) { + return def.scope !== self; + })) break; + } if (fn.contains_this()) break; var j = fn.argnames.length; if (j > 0 && compressor.option("inline") < 2) break; |