Utilities for decorators

This commit is contained in:
Ron Buckton
2015-03-17 10:57:06 -07:00
parent 5db3b0d904
commit fb7dd52bdc

View File

@@ -1,4 +1,4 @@
/// <reference path="types.ts" />
/// <reference path="core.ts" />
module ts {
export interface ReferencePathMatchResult {
@@ -575,6 +575,17 @@ module ts {
return (<CallExpression>node).expression;
}
function getConstructorWithBody(member: ClassElement): ConstructorDeclaration {
if (member.kind === SyntaxKind.Constructor && nodeIsPresent((<ConstructorDeclaration>member).body)) {
return <ConstructorDeclaration>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: