diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-04-21 22:47:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 05:47:21 +0800 |
commit | 3c161a666259389f96f9aa88a5b6d4e7579d50a4 (patch) | |
tree | a985a50ef5a5a09c996eac7d7e5c90ebce76f8c9 /lib | |
parent | c58e174647671ebd504e2255e853e1e1dfeb21ea (diff) | |
download | tracifyjs-3c161a666259389f96f9aa88a5b6d4e7579d50a4.tar.gz tracifyjs-3c161a666259389f96f9aa88a5b6d4e7579d50a4.zip |
fix corner case in `hoist_vars` (#4860)
fixes #4859
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/compress.js b/lib/compress.js index 010dcf46..846c391b 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -6942,9 +6942,7 @@ merge(Compressor.prototype, { if (defs.length > 0) { // try to merge in assignments insert_vars(self.body); - defs = make_node(AST_Var, self, { - definitions: defs - }); + defs = make_node(AST_Var, self, { definitions: defs }); hoisted.push(defs); } } @@ -8367,12 +8365,14 @@ merge(Compressor.prototype, { AST_Definitions.DEFMETHOD("to_assignments", function() { var assignments = this.definitions.reduce(function(a, defn) { var def = defn.name.definition(); - if (defn.value) { + var value = defn.value; + if (value) { + if (value instanceof AST_Sequence) value = value.clone(); var name = make_node(AST_SymbolRef, defn.name, defn.name); a.push(make_node(AST_Assign, defn, { - operator : "=", - left : name, - right : defn.value + operator: "=", + left: name, + right: value, })); def.references.push(name); } |