tidy up various interfaces (#4066)

This commit is contained in:
Alex Lam S.L
2020-08-23 21:39:38 +01:00
committed by GitHub
parent af1b2f30c9
commit 7dc61cdc89
5 changed files with 168 additions and 167 deletions

View File

@@ -3152,11 +3152,11 @@ merge(Compressor.prototype, {
return this.expression._find_defs(compressor, "." + this.property + suffix);
});
def(AST_SymbolDeclaration, function(compressor) {
if (!this.global()) return;
if (!this.definition().global) return;
if (HOP(compressor.option("global_defs"), this.name)) warn(this);
});
def(AST_SymbolRef, function(compressor, suffix) {
if (!this.global()) return;
if (!this.definition().global) return;
var defines = compressor.option("global_defs");
var name = this.name + suffix;
if (HOP(defines, name)) return to_node(defines[name], this);
@@ -4700,7 +4700,7 @@ merge(Compressor.prototype, {
});
function log(sym, text, props) {
AST_Node[sym.unreferenced() ? "warn" : "info"](text, props);
AST_Node[sym.definition().references.length > 0 ? "info" : "warn"](text, props);
}
function template(sym) {
@@ -6395,7 +6395,7 @@ merge(Compressor.prototype, {
}
}));
var code = OutputStream();
AST_BlockStatement.prototype._codegen.call(fun, fun, code);
AST_BlockStatement.prototype._codegen.call(fun, code);
self.args = [
make_node(AST_String, self, {
value: fun.argnames.map(function(arg) {