Contextually type parenthesized expressions.

This commit is contained in:
Daniel Rosenwasser
2015-01-09 15:10:32 -08:00
parent cd246992ed
commit 22174a17c6
10 changed files with 550 additions and 272 deletions

View File

@@ -3337,6 +3337,8 @@ module ts {
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
return isContextSensitiveFunctionLikeDeclaration(<MethodDeclaration>node);
case SyntaxKind.ParenthesizedExpression:
return isContextSensitive((<ParenthesizedExpression>node).expression);
}
return false;
@@ -5226,6 +5228,8 @@ module ts {
case SyntaxKind.TemplateSpan:
Debug.assert(parent.parent.kind === SyntaxKind.TemplateExpression);
return getContextualTypeForSubstitutionExpression(<TemplateExpression>parent.parent, node);
case SyntaxKind.ParenthesizedExpression:
return getContextualType(<ParenthesizedExpression>parent);
}
return undefined;
}