support template literals (#4601)

This commit is contained in:
Alex Lam S.L
2021-02-01 02:36:45 +00:00
committed by GitHub
parent ac7b5c07d7
commit d4685640a0
9 changed files with 278 additions and 3 deletions

View File

@@ -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;