diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-01 02:36:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 10:36:45 +0800 |
commit | d4685640a00a0c998041c96ec197e613bd67b7b3 (patch) | |
tree | 53ed8185a109028e4270993fc1d6962fcc22495b /lib/compress.js | |
parent | ac7b5c07d778d3b70bf39c4c0014e9411d780268 (diff) | |
download | tracifyjs-d4685640a00a0c998041c96ec197e613bd67b7b3.tar.gz tracifyjs-d4685640a00a0c998041c96ec197e613bd67b7b3.zip |
support template literals (#4601)
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index d65861a6..700f3748 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -4663,6 +4663,9 @@ merge(Compressor.prototype, { def(AST_SymbolRef, function(compressor) { return !this.is_declared(compressor) || !can_drop_symbol(this); }); + def(AST_Template, function(compressor) { + return any(this.expressions, compressor); + }); def(AST_This, return_false); def(AST_Try, function(compressor) { return any(this.body, compressor) @@ -4673,7 +4676,7 @@ merge(Compressor.prototype, { return unary_side_effects[this.operator] || this.expression.has_side_effects(compressor); }); - def(AST_VarDef, function(compressor) { + def(AST_VarDef, function() { return this.value; }); })(function(node, func) { @@ -7015,6 +7018,11 @@ merge(Compressor.prototype, { def(AST_SymbolRef, function(compressor) { return this.is_declared(compressor) && can_drop_symbol(this) ? null : this; }); + def(AST_Template, function(compressor, first_in_statement) { + var expressions = this.expressions; + if (expressions.length == 0) return null; + return make_sequence(this, expressions).drop_side_effect_free(compressor, first_in_statement); + }); def(AST_This, return_null); def(AST_Unary, function(compressor, first_in_statement) { var exp = this.expression; |