@@ -13,22 +13,26 @@ export {SetterFn, GetterFn, MethodFn} from './types';
1313export { PlatformReflectionCapabilities } from './platform_reflection_capabilities' ;
1414
1515export class Reflector {
16- _typeInfo : Map < Type , any > ;
16+ _injectableInfo : Map < any , StringMap < string , any > > ;
1717 _getters : Map < string , GetterFn > ;
1818 _setters : Map < string , SetterFn > ;
1919 _methods : Map < string , MethodFn > ;
2020 reflectionCapabilities : PlatformReflectionCapabilities ;
2121
2222 constructor ( reflectionCapabilities : PlatformReflectionCapabilities ) {
23- this . _typeInfo = new Map ( ) ;
23+ this . _injectableInfo = new Map ( ) ;
2424 this . _getters = new Map ( ) ;
2525 this . _setters = new Map ( ) ;
2626 this . _methods = new Map ( ) ;
2727 this . reflectionCapabilities = reflectionCapabilities ;
2828 }
2929
30+ registerFunction ( func : Function , funcInfo : StringMap < string , any > ) : void {
31+ this . _injectableInfo . set ( func , funcInfo ) ;
32+ }
33+
3034 registerType ( type : Type , typeInfo : StringMap < string , any > ) : void {
31- this . _typeInfo . set ( type , typeInfo ) ;
35+ this . _injectableInfo . set ( type , typeInfo ) ;
3236 }
3337
3438 registerGetters ( getters : StringMap < string , GetterFn > ) : void {
@@ -52,23 +56,23 @@ export class Reflector {
5256 }
5357
5458 parameters ( typeOrFunc ) : List < any > {
55- if ( this . _typeInfo . has ( typeOrFunc ) ) {
59+ if ( this . _injectableInfo . has ( typeOrFunc ) ) {
5660 return this . _getTypeInfoField ( typeOrFunc , "parameters" , [ ] ) ;
5761 } else {
5862 return this . reflectionCapabilities . parameters ( typeOrFunc ) ;
5963 }
6064 }
6165
6266 annotations ( typeOrFunc ) : List < any > {
63- if ( this . _typeInfo . has ( typeOrFunc ) ) {
67+ if ( this . _injectableInfo . has ( typeOrFunc ) ) {
6468 return this . _getTypeInfoField ( typeOrFunc , "annotations" , [ ] ) ;
6569 } else {
6670 return this . reflectionCapabilities . annotations ( typeOrFunc ) ;
6771 }
6872 }
6973
7074 interfaces ( type ) : List < any > {
71- if ( this . _typeInfo . has ( type ) ) {
75+ if ( this . _injectableInfo . has ( type ) ) {
7276 return this . _getTypeInfoField ( type , "interfaces" , [ ] ) ;
7377 } else {
7478 return this . reflectionCapabilities . interfaces ( type ) ;
@@ -100,11 +104,11 @@ export class Reflector {
100104 }
101105
102106 _getTypeInfoField ( typeOrFunc , key , defaultValue ) {
103- var res = this . _typeInfo . get ( typeOrFunc ) [ key ] ;
107+ var res = this . _injectableInfo . get ( typeOrFunc ) [ key ] ;
104108 return isPresent ( res ) ? res : defaultValue ;
105109 }
106110
107- _containsTypeInfo ( typeOrFunc ) { return this . _typeInfo . has ( typeOrFunc ) ; }
111+ _containsTypeInfo ( typeOrFunc ) { return this . _injectableInfo . has ( typeOrFunc ) ; }
108112}
109113
110114function _mergeMaps ( target : Map < any , any > , config : StringMap < string , Function > ) : void {
0 commit comments