diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-03-02 07:27:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 15:27:55 +0800 |
commit | 74dee5c445b1424866ef78ac9b06c507ef92959c (patch) | |
tree | 3c0384836b7113620b937925472f48faccaea7da /lib | |
parent | ee27d87a08480f1fb8c08fef5224bc88b3586c53 (diff) | |
download | tracifyjs-74dee5c445b1424866ef78ac9b06c507ef92959c.tar.gz tracifyjs-74dee5c445b1424866ef78ac9b06c507ef92959c.zip |
enhance `reduce_vars` & `varify` (#4714)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/compress.js b/lib/compress.js index 2d826697..393e3197 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1259,10 +1259,13 @@ merge(Compressor.prototype, { }); def(AST_VarDef, function(tw, descend, compressor) { var node = this; - if (!node.value) return; - node.value.walk(tw); + if (node.value) { + node.value.walk(tw); + } else if (!(tw.parent() instanceof AST_Let)) { + return; + } scan_declaration(tw, compressor, node.name, function() { - return node.value; + return node.value || make_node(AST_Undefined, node); }, function(name, fixed) { var d = name.definition(); if (fixed && safe_to_assign(tw, d, true)) { |