Browse Source

implement gatherPossibleValues on ExternalDeclaration - fixes #957

gh-1132
Rich Harris 8 years ago
parent
commit
2d32cddabf
  1. 4
      src/Declaration.js
  2. 11
      test/function/call-external-function/_config.js
  3. 2
      test/function/call-external-function/foo.js
  4. 4
      test/function/call-external-function/main.js

4
src/Declaration.js

@ -116,6 +116,10 @@ export class ExternalDeclaration {
}
}
gatherPossibleValues ( values ) {
values.add( UNKNOWN );
}
getName ( es ) {
if ( this.name === '*' ) {
return this.module.name;

11
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
test/function/call-external-function/foo.js

@ -0,0 +1,2 @@
import foo from 'foo';
export default foo;

4
test/function/call-external-function/main.js

@ -0,0 +1,4 @@
import foo_ from './foo.js';
var foo = foo_;
assert.equal( foo(), 42 );
Loading…
Cancel
Save