Merge pull request #1876 from Microsoft/crashInIncompleteFunction

fix crash in getReturnTypeFromFunctionBody if function declaration is in...
This commit is contained in:
Vladimir Matveev
2015-02-02 15:49:20 -08:00
2 changed files with 8 additions and 0 deletions

View File

@@ -6553,6 +6553,9 @@ module ts {
function getReturnTypeFromBody(func: FunctionLikeDeclaration, contextualMapper?: TypeMapper): Type {
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
if (!func.body) {
return unknownType;
}
if (func.body.kind !== SyntaxKind.Block) {
var type = checkExpressionCached(<Expression>func.body, contextualMapper);
}

View File

@@ -0,0 +1,5 @@
/// <reference path='fourslash.ts'/>
//// var x: { f(): string } = { f( }
verify.numberOfErrorsInCurrentFile(1);