minor clean-ups (#5282)

This commit is contained in:
Alex Lam S.L
2022-01-10 05:02:26 +00:00
committed by GitHub
parent 4b949f6686
commit caaa753861
7 changed files with 30 additions and 17 deletions

View File

@@ -116,9 +116,7 @@ function Compressor(options, false_by_default) {
var global_defs = this.options["global_defs"];
if (typeof global_defs == "object") for (var key in global_defs) {
if (/^@/.test(key) && HOP(global_defs, key)) {
global_defs[key.slice(1)] = parse(global_defs[key], {
expression: true
});
global_defs[key.slice(1)] = parse(global_defs[key], { expression: true });
}
}
if (this.options["inline"] === true) this.options["inline"] = 4;
@@ -4917,7 +4915,7 @@ Compressor.prototype.compress = function(node) {
return result;
function decimals(operand) {
var match = /(\.[0-9]*)?(e.+)?$/.exec(+operand);
var match = /(\.[0-9]*)?(e[^e]+)?$/.exec(+operand);
return (match[1] || ".").length - 1 - (match[2] || "").slice(1);
}
});
@@ -7862,7 +7860,7 @@ Compressor.prototype.compress = function(node) {
s = s.parent_scope;
} while (s && s !== this);
});
prefix = prefix.replace(/(?:^[^a-z_$]|[^a-z0-9_$])/ig, "_");
prefix = prefix.replace(/^[^a-z_$]|[^a-z0-9_$]/gi, "_");
var name = prefix;
for (var i = 0; !all(scopes, function(scope) {
return !scope.var_names().has(name);