Skip to content

Commit 5574b58

Browse files
committed
Adjust TypeChecker to have separate method for getApparentType
1 parent f4c0045 commit 5574b58

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ module ts {
9191
getSymbolsInScope: getSymbolsInScope,
9292
getSymbolInfo: getSymbolInfo,
9393
getTypeOfNode: getTypeOfNode,
94+
getApparentType: getApparentType,
9495
typeToString: typeToString,
9596
symbolToString: symbolToString,
9697
getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType
@@ -6820,9 +6821,9 @@ module ts {
68206821
return undefined;
68216822
}
68226823

6823-
function getTypeOfNode(node: Node, apparentType: boolean): Type {
6824+
function getTypeOfNode(node: Node): Type {
68246825
if (isExpression(node)) {
6825-
return getTypeOfExpression(<Expression>node, apparentType);
6826+
return getTypeOfExpression(<Expression>node);
68266827
}
68276828
if (isTypeNode(node)) {
68286829
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName) {
@@ -6863,12 +6864,11 @@ module ts {
68636864
Debug.fail("Unhandled case in getTypeOfNode");
68646865
}
68656866

6866-
function getTypeOfExpression(expr: Expression, apparentType: boolean): Type {
6867+
function getTypeOfExpression(expr: Expression): Type {
68676868
if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
68686869
expr = expr.parent;
68696870
}
6870-
var type = checkExpression(expr);
6871-
return apparentType ? getApparentType(type) : type;
6871+
return checkExpression(expr);
68726872
}
68736873

68746874
function getAugmentedPropertiesOfApparentType(type: Type): Symbol[]{

src/compiler/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,8 @@ module ts {
604604
getReturnTypeOfSignature(signature: Signature): Type;
605605
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
606606
getSymbolInfo(node: Node): Symbol;
607-
getTypeOfNode(node: Node, apparentType: boolean): Type;
607+
getTypeOfNode(node: Node): Type;
608+
getApparentType(type: Type): ApparentType;
608609
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
609610
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
610611
getAugmentedPropertiesOfApparentType(type: Type): Symbol[];

src/harness/typeWriter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class TypeWriterWalker {
8888
}
8989

9090
private getTypeOfNode(node: ts.Node): ts.Type {
91-
var type = this.checker.getTypeOfNode(node, /*apparentType*/ false);
91+
var type = this.checker.getTypeOfNode(node);
9292
ts.Debug.assert(type, "type doesn't exist");
9393
return type;
9494
}

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ module ts {
16931693

16941694
// Right of dot member completion list
16951695
if (isRightOfDot) {
1696-
var type: Type = typeInfoResolver.getTypeOfNode(mappedNode, /*apparentType*/ true);
1696+
var type: Type = typeInfoResolver.getApparentType(typeInfoResolver.getTypeOfNode(mappedNode));
16971697
if (!type) {
16981698
return undefined;
16991699
}

0 commit comments

Comments
 (0)