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

[Master] Address code review of PR 14692 #14916

Merged
merged 1 commit into from
Apr 4, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1540,9 +1540,9 @@ namespace ts {
}
}
else if (name.kind === SyntaxKind.ParenthesizedExpression) {
// If the expression in parenthsizedExpression is not an entity-name (e.g. it is a call expression), it won't be able to successfully resolve the name.
// This is the case when we are trying to do any language service operation in heritage clauses. By return undefined, the getSymbolOfEntityNameOrPropertyAccessExpression
// will attempt to checkPropertyAccessExpression to resolve symbol.
// If the expression in parenthesizedExpression is not an entity-name (e.g. it is a call expression), it won't be able to successfully resolve the name.
// This is the case when we are trying to do any language service operation in heritage clauses.
// By return undefined, the getSymbolOfEntityNameOrPropertyAccessExpression will attempt to checkPropertyAccessExpression to resolve symbol.
// i.e class C extends foo()./*do language service operation here*/B {}
return isEntityNameExpression(name.expression) ?
resolveEntityName(name.expression as EntityNameOrEntityNameExpression, meaning, ignoreErrors, dontResolveAlias, location) :
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
//// [emitClassDeclarationWithPropertyAccessInHeritageClause1.ts]
interface I {}
interface CTor {
new (hour: number, minute: number): I
}
var x: {
B : CTor
};
class B {}
function foo() {
return {B: B};
Expand All @@ -23,7 +16,6 @@ var __extends = (this && this.__extends) || (function () {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var x;
var B = (function () {
function B() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
=== tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts ===
interface I {}
>I : Symbol(I, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 0, 0))

interface CTor {
>CTor : Symbol(CTor, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 0, 14))

new (hour: number, minute: number): I
>hour : Symbol(hour, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 2, 9))
>minute : Symbol(minute, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 2, 22))
>I : Symbol(I, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 0, 0))
}
var x: {
>x : Symbol(x, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 4, 3))

B : CTor
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 4, 8))
>CTor : Symbol(CTor, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 0, 14))

};
class B {}
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 6, 2))
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 0, 0))

function foo() {
>foo : Symbol(foo, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 7, 10))
>foo : Symbol(foo, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 0, 10))

return {B: B};
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 9, 12))
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 6, 2))
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 2, 12))
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 0, 0))
}
class C extends (foo()).B {}
>C : Symbol(C, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 10, 1))
>(foo()).B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 9, 12))
>foo : Symbol(foo, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 7, 10))
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 9, 12))
>C : Symbol(C, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 3, 1))
>(foo()).B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 2, 12))
>foo : Symbol(foo, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 0, 10))
>B : Symbol(B, Decl(emitClassDeclarationWithPropertyAccessInHeritageClause1.ts, 2, 12))

Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
=== tests/cases/conformance/es6/classDeclaration/emitClassDeclarationWithPropertyAccessInHeritageClause1.ts ===
interface I {}
>I : I

interface CTor {
>CTor : CTor

new (hour: number, minute: number): I
>hour : number
>minute : number
>I : I
}
var x: {
>x : { B: CTor; }

B : CTor
>B : CTor
>CTor : CTor

};
class B {}
>B : B

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
interface I {}
interface CTor {
new (hour: number, minute: number): I
}
var x: {
B : CTor
};
class B {}
function foo() {
return {B: B};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
/// <reference path="fourslash.ts" />

//// interface I {}
//// interface CTor {
//// new (hour: number, minute: number): I
//// }
//// var x: {
//// B : CTor
//// };
//// class B {}
//// function foo() {
//// return {[|B|]: B};
//// }
//// class C extends (foo()).[|B|] {}
//// class C1 extends foo().[|B|] {}

const [def, ref1, ref2] = test.ranges();
verify.referencesOf(ref1, [def, ref1, ref2]);
verify.referencesOf(ref2, [def, ref1, ref2]);
verify.referencesOf(def, [def, ref1, ref2]);
const ranges = test.ranges();
for (const range of ranges) {
verify.referencesOf(range, ranges);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/// <reference path='fourslash.ts' />

//// interface I {}
//// interface CTor {
//// new (hour: number, minute: number): I
//// }
//// var x: {
//// B : CTor
//// };
//// class B {}
//// function foo() {
//// return {/*refB*/B: B};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/// <reference path="fourslash.ts" />

//// interface I {}
//// interface CTor {
//// new (hour: number, minute: number): I
//// }
//// var x: {
//// B : CTor
//// };
//// class B {}
//// function foo() {
//// return {[|B|]: B};
Expand Down