Skip to content

Commit

Permalink
Merge pull request #1551 from rollup/gh-1550
Browse files Browse the repository at this point in the history
deshadow aliased imports
  • Loading branch information
Rich-Harris committed Aug 13, 2017
2 parents 1b48335 + c364ec4 commit 586e255
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ast/scopes/ModuleScope.js
Expand Up @@ -50,6 +50,10 @@ export default class ModuleScope extends Scope {
if ( name !== specifier.name ) {
names.add( declaration.getName( true ) );
}

if ( specifier.name !== 'default' && specifier.specifier.imported.name !== specifier.specifier.local.name ) {
names.add( specifier.specifier.imported.name );
}
}
});

Expand Down
@@ -0,0 +1,3 @@
module.exports = {
description: '#1550'
};
@@ -0,0 +1 @@
export * from './ns.js';
10 changes: 10 additions & 0 deletions test/function/samples/deshadowed-namespaced-import-renamed/main.js
@@ -0,0 +1,10 @@
import { foo as doFoo } from './foo.js';

assert.equal((() => {
function foo() {
return doFoo();
}

return foo();
})(), 42);

@@ -0,0 +1,3 @@
export function foo() {
return 42;
}

0 comments on commit 586e255

Please sign in to comment.