Skip to content

Commit

Permalink
Merge pull request #1151 from rollup/gh-957
Browse files Browse the repository at this point in the history
implement gatherPossibleValues on ExternalDeclaration
  • Loading branch information
Rich-Harris committed Dec 14, 2016
2 parents fcf3928 + 2d32cdd commit 98abe24
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Declaration.js
Expand Up @@ -116,6 +116,10 @@ export class ExternalDeclaration {
}
}

gatherPossibleValues ( values ) {
values.add( UNKNOWN );
}

getName ( es ) {
if ( this.name === '*' ) {
return this.module.name;
Expand Down
11 changes: 11 additions & 0 deletions test/function/call-external-function/_config.js
@@ -0,0 +1,11 @@
module.exports = {
description: 'handles call of aliased external function (#957)',
warnings () {},
context: {
require ( id ) {
if ( id === 'foo' ) {
return () => 42;
}
}
}
};
2 changes: 2 additions & 0 deletions test/function/call-external-function/foo.js
@@ -0,0 +1,2 @@
import foo from 'foo';
export default foo;
4 changes: 4 additions & 0 deletions test/function/call-external-function/main.js
@@ -0,0 +1,4 @@
import foo_ from './foo.js';

var foo = foo_;
assert.equal( foo(), 42 );

0 comments on commit 98abe24

Please sign in to comment.