From bc70e4a29d23d7fca2abc27deba473d33b022e49 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 5 Nov 2014 18:04:19 -0800 Subject: [PATCH] Make certain types of FunctionLike require block bodies --- src/compiler/parser.ts | 2 +- src/compiler/types.ts | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 41076bc941d..1e3ed77be3a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3572,7 +3572,7 @@ module ts { // A common error is to try to declare an accessor in an ambient class. if (inAmbientContext && canParseSemicolon()) { parseSemicolon(); - node.body = createMissingNode(); + node.body = createMissingNode(); } else { node.body = parseBody(/* ignoreMissingOpenBrace */ false); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 066d2f2d428..78f07970f11 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -336,13 +336,20 @@ module ts { export interface FunctionDeclaration extends FunctionLike { name: Identifier; + body?: Block; } - export interface MethodDeclaration extends FunctionLike { } + export interface MethodDeclaration extends FunctionLike { + body?: Block; + } - export interface ConstructorDeclaration extends FunctionLike { } + export interface ConstructorDeclaration extends FunctionLike { + body?: Block; + } - export interface AccessorDeclaration extends FunctionLike { } + export interface AccessorDeclaration extends FunctionLike { + body?: Block; + } export interface TypeNode extends Node { }