diff --git a/src/Bundle.js b/src/Bundle.js index ba2b4a5..3a1774b 100644 --- a/src/Bundle.js +++ b/src/Bundle.js @@ -212,18 +212,18 @@ export default class Bundle { return name; } - const toDeshadow = new Map(); + const toDeshadow = new Set(); this.externalModules.forEach( module => { const safeName = getSafeName( module.name ); - toDeshadow.set( safeName, true ); + toDeshadow.add( safeName ); module.name = safeName; // ensure we don't shadow named external imports, if // we're creating an ES6 bundle forOwn( module.declarations, ( declaration, name ) => { const safeName = getSafeName( name ); - toDeshadow.set( safeName, true ); + toDeshadow.add( safeName ); declaration.setSafeName( safeName ); }); }); diff --git a/src/ast/scopes/ModuleScope.js b/src/ast/scopes/ModuleScope.js index 5a18d6f..4c8804c 100644 --- a/src/ast/scopes/ModuleScope.js +++ b/src/ast/scopes/ModuleScope.js @@ -14,13 +14,13 @@ export default class ModuleScope extends Scope { } deshadow ( names ) { - names = new Map( names ); + names = new Set( names ); forOwn( this.module.imports, specifier => { if ( specifier.module.isExternal ) return; specifier.module.getExports().forEach( name => { - names.set(name); + names.add( name ); }); if ( specifier.name !== '*' ) { @@ -29,9 +29,10 @@ export default class ModuleScope extends Scope { this.module.bundle.onwarn( `Non-existent export '${specifier.name}' is imported from ${specifier.module.id} by ${this.module.id}` ); return; } + const name = declaration.getName( true ); if ( name !== specifier.name ) { - names.set( declaration.getName( true ) ); + names.add( declaration.getName( true ) ); } } });