1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | "use strict";
|
9 | var private_import_core_1 = require('./private_import_core');
|
10 | var StaticAndDynamicReflectionCapabilities = (function () {
|
11 | function StaticAndDynamicReflectionCapabilities(staticDelegate) {
|
12 | this.staticDelegate = staticDelegate;
|
13 | this.dynamicDelegate = new private_import_core_1.ReflectionCapabilities();
|
14 | }
|
15 | StaticAndDynamicReflectionCapabilities.install = function (staticDelegate) {
|
16 | private_import_core_1.reflector.updateCapabilities(new StaticAndDynamicReflectionCapabilities(staticDelegate));
|
17 | };
|
18 | StaticAndDynamicReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
|
19 | StaticAndDynamicReflectionCapabilities.prototype.factory = function (type) { return this.dynamicDelegate.factory(type); };
|
20 | StaticAndDynamicReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) {
|
21 | return isStaticType(type) ? this.staticDelegate.hasLifecycleHook(type, lcProperty) :
|
22 | this.dynamicDelegate.hasLifecycleHook(type, lcProperty);
|
23 | };
|
24 | StaticAndDynamicReflectionCapabilities.prototype.parameters = function (type) {
|
25 | return isStaticType(type) ? this.staticDelegate.parameters(type) :
|
26 | this.dynamicDelegate.parameters(type);
|
27 | };
|
28 | StaticAndDynamicReflectionCapabilities.prototype.annotations = function (type) {
|
29 | return isStaticType(type) ? this.staticDelegate.annotations(type) :
|
30 | this.dynamicDelegate.annotations(type);
|
31 | };
|
32 | StaticAndDynamicReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
|
33 | return isStaticType(typeOrFunc) ? this.staticDelegate.propMetadata(typeOrFunc) :
|
34 | this.dynamicDelegate.propMetadata(typeOrFunc);
|
35 | };
|
36 | StaticAndDynamicReflectionCapabilities.prototype.getter = function (name) { return this.dynamicDelegate.getter(name); };
|
37 | StaticAndDynamicReflectionCapabilities.prototype.setter = function (name) { return this.dynamicDelegate.setter(name); };
|
38 | StaticAndDynamicReflectionCapabilities.prototype.method = function (name) { return this.dynamicDelegate.method(name); };
|
39 | StaticAndDynamicReflectionCapabilities.prototype.importUri = function (type) { return this.staticDelegate.importUri(type); };
|
40 | StaticAndDynamicReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, runtime) {
|
41 | return this.staticDelegate.resolveIdentifier(name, moduleUrl, runtime);
|
42 | };
|
43 | StaticAndDynamicReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) {
|
44 | if (isStaticType(enumIdentifier)) {
|
45 | return this.staticDelegate.resolveEnum(enumIdentifier, name);
|
46 | }
|
47 | else {
|
48 | return null;
|
49 | }
|
50 | };
|
51 | return StaticAndDynamicReflectionCapabilities;
|
52 | }());
|
53 | exports.StaticAndDynamicReflectionCapabilities = StaticAndDynamicReflectionCapabilities;
|
54 | function isStaticType(type) {
|
55 | return typeof type === 'object' && type.name && type.filePath;
|
56 | }
|
57 |
|
\ | No newline at end of file |