Browse Source

dont treat this.foo as possible namespace - fixes #1258

master
Rich-Harris 8 years ago
parent
commit
3a8b1c1460
  1. 2
      src/ast/nodes/MemberExpression.js
  2. 8
      test/function/this-not-namespace/_config.js
  3. 5
      test/function/this-not-namespace/main.js

2
src/ast/nodes/MemberExpression.js

@ -33,7 +33,7 @@ export default class MemberExpression extends Node {
// TODO this code is a bit inefficient
const keypath = new Keypath( this );
if ( !keypath.computed ) {
if ( !keypath.computed && keypath.root.type === 'Identifier' ) {
let declaration = scope.findDeclaration( keypath.root.name );
while ( declaration.isNamespace && keypath.parts.length ) {

8
test/function/this-not-namespace/_config.js

@ -0,0 +1,8 @@
const assert = require( 'assert' );
module.exports = {
description: 'does not treat this.foo as a possible namespace (#1258)',
exports: exports => {
assert.equal( typeof exports.Foo, 'function' );
}
};

5
test/function/this-not-namespace/main.js

@ -0,0 +1,5 @@
export class Foo {
constructor ( name ) {
this.name = undefined;
}
}
Loading…
Cancel
Save