feat(metadata): emit all methods

This is needed to detect lifecycle hooks.
This commit is contained in:
Tobias Bosch 2016-05-04 09:11:04 -07:00
parent 3229bf1665
commit 29700aa188
2 changed files with 19 additions and 18 deletions

View File

@ -131,20 +131,18 @@ export class MetadataCollector {
hasParameterData = true;
}
}
if (methodDecorators || hasDecoratorData || hasParameterData) {
const data: MethodMetadata = {__symbolic: isConstructor ? "constructor" : "method"};
const name = isConstructor ? "__ctor__" : evaluator.nameOf(member.name);
if (methodDecorators) {
data.decorators = methodDecorators;
}
if (hasDecoratorData) {
data.parameterDecorators = parameterDecoratorData;
}
if (hasParameterData) {
(<ConstructorMetadata>data).parameters = parametersData;
}
recordMember(name, data);
const data: MethodMetadata = {__symbolic: isConstructor ? "constructor" : "method"};
const name = isConstructor ? "__ctor__" : evaluator.nameOf(member.name);
if (methodDecorators) {
data.decorators = methodDecorators;
}
if (hasDecoratorData) {
data.parameterDecorators = parameterDecoratorData;
}
if (hasParameterData) {
(<ConstructorMetadata>data).parameters = parametersData;
}
recordMember(name, data);
break;
case ts.SyntaxKind.PropertyDeclaration:
case ts.SyntaxKind.GetAccessor:

View File

@ -146,7 +146,10 @@ describe('Collector', () => {
parameters:
[{__symbolic: 'reference', name: undefined, module: './hero.service'}]
}
]
],
onSelect: [{__symbolic: 'method'}],
ngOnInit: [{__symbolic: 'method'}],
getHeroes: [{__symbolic: 'method'}]
}
}
}