diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-10 01:13:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 09:13:38 +0800 |
commit | c76481341ca62e6c651f4bc8db7ed3508423b421 (patch) | |
tree | e61786c06e30ce6b49a2bf28efa7abba80aef5b6 /lib/compress.js | |
parent | 5e6307974fa2b1e7972ab8c58b636eaed47a54fb (diff) | |
download | tracifyjs-c76481341ca62e6c651f4bc8db7ed3508423b421.tar.gz tracifyjs-c76481341ca62e6c651f4bc8db7ed3508423b421.zip |
fix corner case in `merge_vars` (#4635)
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index 3fcfe2d2..b35fc6a5 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -5045,6 +5045,7 @@ merge(Compressor.prototype, { return self; }); + var NO_MERGE = makePredicate("arguments await yield"); AST_Scope.DEFMETHOD("merge_variables", function(compressor) { if (!compressor.option("merge_vars")) return; var self = this, segment = {}, root; @@ -5386,7 +5387,7 @@ merge(Compressor.prototype, { } else if ((ldef = self.variables.get(def.name)) !== def) { if (ldef && root === segment) references[ldef.id] = false; return references[def.id] = false; - } else if (compressor.exposed(def) || sym.name == "arguments" || sym.name == "await") { + } else if (compressor.exposed(def) || NO_MERGE[sym.name]) { return references[def.id] = false; } else { var refs = declarations.get(def.id) || []; |