From 9a1ec50456996c06af0cbb7cd72d0ca180f27417 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 3 Dec 2014 17:38:55 -0800 Subject: [PATCH] Improve naming of checker methods. --- src/compiler/checker.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6473818379e..fc67faa8f88 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6586,12 +6586,12 @@ module ts { } function checkObjectLiteralMethod(node: MethodDeclaration, contextualMapper?: TypeMapper): Type { - var type = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - return mapSingleCallSignatureToType(node, type, contextualMapper); + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } - function mapSingleCallSignatureToType(node: Expression | QualifiedName | MethodDeclaration, type: Type, contextualMapper?: TypeMapper) { - if (contextualMapper && contextualMapper !== identityMapper && node.kind !== SyntaxKind.QualifiedName) { + function instantiateTypeWithSingleGenericCallSignature(node: Expression | MethodDeclaration, type: Type, contextualMapper?: TypeMapper) { + if (contextualMapper && contextualMapper !== identityMapper) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getContextualType(node); @@ -6619,10 +6619,14 @@ module ts { // have the wildcard function type; this form of type check is used during overload resolution to exclude // contextually typed function and arrow expressions in the initial phase. function checkExpressionOrQualifiedName(node: Expression | QualifiedName, contextualMapper?: TypeMapper): Type { - var type = node.kind == SyntaxKind.QualifiedName - ? checkQualifiedName(node) - : checkExpressionWorker(node, contextualMapper); - type = mapSingleCallSignatureToType(node, type, contextualMapper); + var type: Type; + if (node.kind == SyntaxKind.QualifiedName) { + type = checkQualifiedName(node); + } + else { + var uninstantiatedType = checkExpressionWorker(node, contextualMapper); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } if (isConstEnumObjectType(type)) { // enum object type for const enums are only permitted in: