From fb7dd52bdc57fcaea357ceabfc557715bc709329 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 17 Mar 2015 10:57:06 -0700 Subject: [PATCH] Utilities for decorators --- src/compiler/utilities.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 4fce9c928f7..959476df2a6 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,4 +1,4 @@ -/// +/// module ts { export interface ReferencePathMatchResult { @@ -575,6 +575,17 @@ module ts { return (node).expression; } + function getConstructorWithBody(member: ClassElement): ConstructorDeclaration { + if (member.kind === SyntaxKind.Constructor && nodeIsPresent((member).body)) { + return member; + } + return undefined; + } + + export function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration { + return forEach(node.members, getConstructorWithBody); + } + export function isExpression(node: Node): boolean { switch (node.kind) { case SyntaxKind.ThisKeyword: