diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-06-23 04:44:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-23 04:44:57 +0800 |
commit | 3d5bc081851897648ccc71009a2138240fe41fa0 (patch) | |
tree | d8d3a51a3adf82d58d25e45ac49afe02ae1548b1 /lib/compress.js | |
parent | 0692435f01aad54fb586d24ad0c118d70b5c26ee (diff) | |
download | tracifyjs-3d5bc081851897648ccc71009a2138240fe41fa0.tar.gz tracifyjs-3d5bc081851897648ccc71009a2138240fe41fa0.zip |
fix `reduce_vars` on `this` (#2145)
fixes #2140
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/compress.js b/lib/compress.js index aa7affc4..c332282f 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -279,11 +279,11 @@ merge(Compressor.prototype, { var reduce_vars = rescan && compressor.option("reduce_vars"); var safe_ids = Object.create(null); var suppressor = new TreeWalker(function(node) { - if (node instanceof AST_Symbol) { - var d = node.definition(); - if (node instanceof AST_SymbolRef) d.references.push(node); - d.fixed = false; - } + if (!(node instanceof AST_Symbol)) return; + var d = node.definition(); + if (!d) return; + if (node instanceof AST_SymbolRef) d.references.push(node); + d.fixed = false; }); var tw = new TreeWalker(function(node, descend) { node._squeezed = false; |