Mangling externally imported names by using aliasing
This commit is contained in:
committed by
Richard van Velzen
parent
59e1601fb8
commit
86b5248837
@@ -171,6 +171,9 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
|
||||
else if (node instanceof AST_SymbolClass) {
|
||||
defun.def_variable(node);
|
||||
}
|
||||
else if (node instanceof AST_SymbolImport) {
|
||||
scope.def_variable(node);
|
||||
}
|
||||
else if (node instanceof AST_SymbolDefClass) {
|
||||
// This deals with the name of the class being available
|
||||
// inside the class.
|
||||
@@ -302,6 +305,12 @@ AST_Scope.DEFMETHOD("def_variable", function(symbol){
|
||||
this.variables.set(symbol.name, def);
|
||||
def.object_destructuring_arg = symbol.object_destructuring_arg;
|
||||
def.global = !this.parent_scope;
|
||||
if (symbol instanceof AST_SymbolImport) {
|
||||
// Imports are not global
|
||||
def.global = false;
|
||||
// TODO The real fix comes with block scoping being first class in uglifyJS,
|
||||
// enabling import definitions to behave like module-level let declarations
|
||||
}
|
||||
} else {
|
||||
def = this.variables.get(symbol.name);
|
||||
def.orig.push(symbol);
|
||||
|
||||
Reference in New Issue
Block a user