Skip to content

Commit

Permalink
Merge pull request #1548 from rollup/gh-1547
Browse files Browse the repository at this point in the history
ignore external namespace imports when deshadowing
  • Loading branch information
Rich-Harris committed Aug 12, 2017
2 parents 3c1b2ff + f85ffe8 commit 1ccf54d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ast/scopes/ModuleScope.js
Expand Up @@ -21,7 +21,7 @@ export default class ModuleScope extends Scope {
if ( specifier.module.isExternal ) return;

const addDeclaration = declaration => {
if ( declaration.isNamespace ) {
if ( declaration.isNamespace && !declaration.isExternal ) {
declaration.module.getExports().forEach( name => {
addDeclaration( declaration.module.traceExport(name) );
});
Expand Down
@@ -0,0 +1,12 @@
module.exports = {
description: '#1547',
options: {
external: ['external']
},
context: {
require: id => {
if (id === 'external') return { foo: () => 42 };
throw new Error('huh?');
}
}
};
@@ -0,0 +1,2 @@
import * as ns from 'external';
export { ns };
@@ -0,0 +1,10 @@
import { ns } from './foo.js';

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

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

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

0 comments on commit 1ccf54d

Please sign in to comment.