Browse Source

Merge pull request #1260 from rollup/gh-1258

don't treat this.foo as possible namespace
master
Rich Harris 8 years ago
committed by GitHub
parent
commit
603d2e7b74
  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