Browse Source

Move declaration assignment before the if statement

gh-335
Oskar Segersvärd 9 years ago
parent
commit
e8da5e40de
  1. 4
      src/Declaration.js
  2. 9
      test/function/resolves-namespace-default/_config.js
  3. 3
      test/function/resolves-namespace-default/main.js
  4. 1
      test/function/resolves-namespace-default/mod.js

4
src/Declaration.js

@ -76,10 +76,12 @@ export class SyntheticDefaultDeclaration {
}
addReference ( reference ) {
// Bind the reference to `this` declaration.
reference.declaration = this;
// Don't change the name to `default`; it's not a valid identifier name.
if ( reference.name === 'default' ) return;
reference.declaration = this;
this.name = reference.name;
}

9
test/function/resolves-namespace-default/_config.js

@ -0,0 +1,9 @@
var assert = require('assert');
module.exports = {
description: "namespace's 'default' properties should be available",
exports: function ( exports ) {
assert.equal( exports, 42 );
}
};

3
test/function/resolves-namespace-default/main.js

@ -0,0 +1,3 @@
import * as mod from './mod.js';
export default mod.default();

1
test/function/resolves-namespace-default/mod.js

@ -0,0 +1 @@
export default () => 42;
Loading…
Cancel
Save