diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-02-06 18:46:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-06 18:46:25 +0000 |
commit | 551420132c357467a747cae12be39c2662ce56f1 (patch) | |
tree | c3eac8ac64078004a2d2cbfba29fc33c648339ba /lib/compress.js | |
parent | b0040ba6540232687204d125eff021adf11c4efa (diff) | |
download | tracifyjs-551420132c357467a747cae12be39c2662ce56f1.tar.gz tracifyjs-551420132c357467a747cae12be39c2662ce56f1.zip |
export missing API for AST manipulation (#3707)
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/compress.js b/lib/compress.js index b190ef9c..0fcd199e 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1230,7 +1230,7 @@ merge(Compressor.prototype, { var parent = multi_replacer.parent(); if (parent instanceof AST_Sequence && parent.tail_node() !== node) { value_def.replaced++; - return MAP.skip; + return List.skip; } return get_rvalue(candidate); case 1: @@ -1863,7 +1863,7 @@ merge(Compressor.prototype, { node.value = null; return node; } - return in_list ? MAP.skip : null; + return in_list ? List.skip : null; }, patch_sequence)); } @@ -4017,7 +4017,7 @@ merge(Compressor.prototype, { if (value) props.push(value); switch (props.length) { case 0: - return MAP.skip; + return List.skip; case 1: return maintain_this_binding(compressor, parent, node, props[0].transform(tt)); default: @@ -4159,11 +4159,11 @@ merge(Compressor.prototype, { } switch (body.length) { case 0: - return in_list ? MAP.skip : make_node(AST_EmptyStatement, node); + return in_list ? List.skip : make_node(AST_EmptyStatement, node); case 1: return body[0]; default: - return in_list ? MAP.splice(body) : make_node(AST_BlockStatement, node, { + return in_list ? List.splice(body) : make_node(AST_BlockStatement, node, { body: body }); } @@ -4177,7 +4177,7 @@ merge(Compressor.prototype, { var block = node.body; node.body = block.body.pop(); block.body.push(node); - return in_list ? MAP.splice(block.body) : block; + return in_list ? List.splice(block.body) : block; } return node; } @@ -4214,7 +4214,7 @@ merge(Compressor.prototype, { } else if (is_empty(node.init)) { node.init = null; } - return !block ? node : in_list ? MAP.splice(block.body) : block; + return !block ? node : in_list ? List.splice(block.body) : block; } else if (node instanceof AST_ForIn) { if (!drop_vars || !compressor.option("loops")) return; if (!(node.init instanceof AST_Definitions)) return; @@ -4229,7 +4229,7 @@ merge(Compressor.prototype, { body: value }); } - return in_list ? MAP.skip : make_node(AST_EmptyStatement, node); + return in_list ? List.skip : make_node(AST_EmptyStatement, node); } else if (node instanceof AST_Sequence) { if (node.expressions.length == 1) return node.expressions[0]; } @@ -4610,7 +4610,7 @@ merge(Compressor.prototype, { })); }); defs_by_id[node.name.definition().id] = defs; - return MAP.splice(var_defs); + return List.splice(var_defs); } function make_sym(sym, key) { |