UNPKG

2.87 kBJavaScriptView Raw
1var __extends = (this && this.__extends) || (function () {
2 var extendStatics = Object.setPrototypeOf ||
3 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5 return function (d, b) {
6 extendStatics(d, b);
7 function __() { this.constructor = d; }
8 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9 };
10})();
11import { resolveForwardRef } from '@angular/core';
12import { ProviderMeta } from '@angular/compiler';
13import { Symbol } from './symbol';
14import { ProviderSymbol } from './provider-symbol';
15/**
16 * A wrapper around the pipe symbol.
17 *
18 * @export
19 * @class PipeSymbol
20 * @extends {Symbol}
21 */
22var PipeSymbol = /** @class */ (function (_super) {
23 __extends(PipeSymbol, _super);
24 /**
25 * Creates an instance of PipeSymbol.
26 *
27 * @param {Program} program
28 * @param {StaticSymbol} symbol
29 * @param {PipeResolver} resolver
30 * @param {ContextSymbols} projectSymbols
31 *
32 * @memberOf PipeSymbol
33 */
34 function PipeSymbol(program, symbol, resolver, metadataResolver, projectSymbols) {
35 var _this = _super.call(this, program, symbol) || this;
36 _this.resolver = resolver;
37 _this.metadataResolver = metadataResolver;
38 _this.projectSymbols = projectSymbols;
39 return _this;
40 }
41 /**
42 * Returns the module where the wrapped pipe was defined.
43 *
44 * @returns {(CompileNgModuleMetadata | undefined)}
45 *
46 * @memberOf PipeSymbol
47 */
48 PipeSymbol.prototype.getModule = function () {
49 return this.projectSymbols.getAnalyzedModules().ngModuleByPipeOrDirective.get(this.symbol);
50 };
51 /**
52 * Returns the pipe metadata.
53 *
54 * @returns {Pipe}
55 *
56 * @memberOf PipeSymbol
57 */
58 PipeSymbol.prototype.getMetadata = function () {
59 return this.resolver.resolve(resolveForwardRef(this.symbol));
60 };
61 PipeSymbol.prototype.getDependencies = function () {
62 var _this = this;
63 var summary = this.metadataResolver.getInjectableSummary(this.symbol);
64 if (!summary) {
65 return [];
66 }
67 else {
68 return (summary.type.diDeps || []).map(function (d) {
69 var token = d.token;
70 if (d.token) {
71 if (d.token.identifier) {
72 token = d.token.identifier.reference;
73 }
74 }
75 var meta = new ProviderMeta(token, { useClass: d.value });
76 return new ProviderSymbol(_this._program, _this.metadataResolver.getProviderMetadata(meta), _this.metadataResolver);
77 });
78 }
79 };
80 return PipeSymbol;
81}(Symbol));
82export { PipeSymbol };
83//# sourceMappingURL=pipe-symbol.js.map
\No newline at end of file