fix crash in getReturnTypeFromFunctionBody if function declaration is incomplete and does not have body

This commit is contained in:
Vladimir Matveev 2015-01-30 18:20:26 -08:00
parent 9f49a1637a
commit 732ebf2aeb
2 changed files with 8 additions and 0 deletions

View File

@ -6525,6 +6525,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);