diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-03-03 01:18:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 09:18:02 +0800 |
commit | 10ca578ee57a0630c2b59d3da9b2c6e5ec6d476a (patch) | |
tree | df7f6344cc225abdf186cece9ce0fda9b75c2efc /lib/compress.js | |
parent | 955411e0657cbaea3226537b2738307d10754b02 (diff) | |
download | tracifyjs-10ca578ee57a0630c2b59d3da9b2c6e5ec6d476a.tar.gz tracifyjs-10ca578ee57a0630c2b59d3da9b2c6e5ec6d476a.zip |
fix corner case in `inline` (#4726)
fixes #4725
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index 55ff50be..1b22d861 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -5210,6 +5210,7 @@ merge(Compressor.prototype, { OPT(AST_Function, function(self, compressor) { drop_rest_farg(self, compressor); self.body = tighten_body(self.body, compressor); + var parent = compressor.parent(); if (compressor.option("inline")) for (var i = 0; i < self.body.length; i++) { var stat = self.body[i]; if (stat instanceof AST_Directive) continue; @@ -5231,6 +5232,9 @@ merge(Compressor.prototype, { return def.scope !== self; })) break; } + if (fn.name + && (parent instanceof AST_ClassMethod || parent instanceof AST_ObjectMethod) + && parent.value === compressor.self()) break; if (fn.contains_this()) break; var len = fn.argnames.length; if (len > 0 && compressor.option("inline") < 2) break; @@ -5251,7 +5255,7 @@ merge(Compressor.prototype, { if (call.args[j].has_side_effects(compressor)) break; } if (j < call.args.length) break; - if (len < self.argnames.length && !compressor.drop_fargs(self, compressor.parent())) { + if (len < self.argnames.length && !compressor.drop_fargs(self, parent)) { if (!compressor.drop_fargs(fn, call)) break; do { fn.argnames.push(fn.make_var(AST_SymbolFunarg, fn, "argument_" + len)); |