Skip to content

Commit fb7dd52

Browse files
committed
Utilities for decorators
1 parent 5db3b0d commit fb7dd52

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/compiler/utilities.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference path="types.ts" />
1+
/// <reference path="core.ts" />
22

33
module ts {
44
export interface ReferencePathMatchResult {
@@ -575,6 +575,17 @@ module ts {
575575
return (<CallExpression>node).expression;
576576
}
577577

578+
function getConstructorWithBody(member: ClassElement): ConstructorDeclaration {
579+
if (member.kind === SyntaxKind.Constructor && nodeIsPresent((<ConstructorDeclaration>member).body)) {
580+
return <ConstructorDeclaration>member;
581+
}
582+
return undefined;
583+
}
584+
585+
export function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration {
586+
return forEach(node.members, getConstructorWithBody);
587+
}
588+
578589
export function isExpression(node: Node): boolean {
579590
switch (node.kind) {
580591
case SyntaxKind.ThisKeyword:

0 commit comments

Comments
 (0)