feat(metadata): emit all methods
This is needed to detect lifecycle hooks.
This commit is contained in:
parent
3229bf1665
commit
29700aa188
|
@ -131,20 +131,18 @@ export class MetadataCollector {
|
||||||
hasParameterData = true;
|
hasParameterData = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (methodDecorators || hasDecoratorData || hasParameterData) {
|
const data: MethodMetadata = {__symbolic: isConstructor ? "constructor" : "method"};
|
||||||
const data: MethodMetadata = {__symbolic: isConstructor ? "constructor" : "method"};
|
const name = isConstructor ? "__ctor__" : evaluator.nameOf(member.name);
|
||||||
const name = isConstructor ? "__ctor__" : evaluator.nameOf(member.name);
|
if (methodDecorators) {
|
||||||
if (methodDecorators) {
|
data.decorators = methodDecorators;
|
||||||
data.decorators = methodDecorators;
|
|
||||||
}
|
|
||||||
if (hasDecoratorData) {
|
|
||||||
data.parameterDecorators = parameterDecoratorData;
|
|
||||||
}
|
|
||||||
if (hasParameterData) {
|
|
||||||
(<ConstructorMetadata>data).parameters = parametersData;
|
|
||||||
}
|
|
||||||
recordMember(name, data);
|
|
||||||
}
|
}
|
||||||
|
if (hasDecoratorData) {
|
||||||
|
data.parameterDecorators = parameterDecoratorData;
|
||||||
|
}
|
||||||
|
if (hasParameterData) {
|
||||||
|
(<ConstructorMetadata>data).parameters = parametersData;
|
||||||
|
}
|
||||||
|
recordMember(name, data);
|
||||||
break;
|
break;
|
||||||
case ts.SyntaxKind.PropertyDeclaration:
|
case ts.SyntaxKind.PropertyDeclaration:
|
||||||
case ts.SyntaxKind.GetAccessor:
|
case ts.SyntaxKind.GetAccessor:
|
||||||
|
|
|
@ -146,7 +146,10 @@ describe('Collector', () => {
|
||||||
parameters:
|
parameters:
|
||||||
[{__symbolic: 'reference', name: undefined, module: './hero.service'}]
|
[{__symbolic: 'reference', name: undefined, module: './hero.service'}]
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
onSelect: [{__symbolic: 'method'}],
|
||||||
|
ngOnInit: [{__symbolic: 'method'}],
|
||||||
|
getHeroes: [{__symbolic: 'method'}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +235,7 @@ const FILES: Directory = {
|
||||||
import HeroService from './hero.service';
|
import HeroService from './hero.service';
|
||||||
// thrown away
|
// thrown away
|
||||||
import 'angular2/core';
|
import 'angular2/core';
|
||||||
|
|
||||||
@MyComponent({
|
@MyComponent({
|
||||||
selector: 'my-app',
|
selector: 'my-app',
|
||||||
template:` + "`" + `
|
template:` + "`" + `
|
||||||
|
@ -336,7 +339,7 @@ const FILES: Directory = {
|
||||||
export class CaseAny {
|
export class CaseAny {
|
||||||
constructor(param: any) {}
|
constructor(param: any) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GetProp {
|
export class GetProp {
|
||||||
private _name: string;
|
private _name: string;
|
||||||
|
@ -344,7 +347,7 @@ const FILES: Directory = {
|
||||||
return this._name;
|
return this._name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SetProp {
|
export class SetProp {
|
||||||
private _name: string;
|
private _name: string;
|
||||||
|
@ -352,7 +355,7 @@ const FILES: Directory = {
|
||||||
this._name = value;
|
this._name = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FullProp {
|
export class FullProp {
|
||||||
private _name: string;
|
private _name: string;
|
||||||
|
|
Loading…
Reference in New Issue