Fix function declaration without body to be checked as context sensitive

Fixes #29032
This commit is contained in:
Sheetal Nandi 2019-01-03 12:46:39 -08:00
parent d35ea02cc6
commit d8ee4116ef
2 changed files with 17 additions and 2 deletions

View file

@ -11040,8 +11040,7 @@ namespace ts {
function hasContextSensitiveReturnExpression(node: FunctionLikeDeclaration) {
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
const body = node.body!;
return body.kind === SyntaxKind.Block ? false : isContextSensitive(body);
return !node.body || node.body.kind === SyntaxKind.Block ? false : isContextSensitive(node.body);
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func: Node): func is FunctionExpression | ArrowFunction | MethodDeclaration {

View file

@ -0,0 +1,16 @@
/// <reference path='fourslash.ts' />
////interface ProxyHandler<T extends object> {
//// getPrototypeOf?(target: T): object | null;
////}
////interface ProxyConstructor {
//// new <T extends object>(target: T, handler: ProxyHandler<T>): T;
////}
////declare var Proxy: ProxyConstructor;
////let target = {}
////let proxy = new /**/Proxy(target, {
//// getPrototypeOf()
////})
goTo.marker("");
verify.quickInfoExists();