Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't treat this.foo as possible namespace #1260

Merged
merged 1 commit into from Jan 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ast/nodes/MemberExpression.js
Expand Up @@ -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 ) {
Expand Down
8 changes: 8 additions & 0 deletions 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 changes: 5 additions & 0 deletions test/function/this-not-namespace/main.js
@@ -0,0 +1,5 @@
export class Foo {
constructor ( name ) {
this.name = undefined;
}
}