source: trip-planner-front/node_modules/@angular/compiler/src/injectable_compiler_2.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 23.2 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/injectable_compiler_2", ["require", "exports", "tslib", "@angular/compiler/src/output/output_ast", "@angular/compiler/src/render3/partial/util", "@angular/compiler/src/render3/r3_factory", "@angular/compiler/src/render3/r3_identifiers", "@angular/compiler/src/render3/util", "@angular/compiler/src/render3/view/util"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.createInjectableType = exports.compileInjectable = exports.createR3ProviderExpression = void 0;
20 var tslib_1 = require("tslib");
21 var o = require("@angular/compiler/src/output/output_ast");
22 var util_1 = require("@angular/compiler/src/render3/partial/util");
23 var r3_factory_1 = require("@angular/compiler/src/render3/r3_factory");
24 var r3_identifiers_1 = require("@angular/compiler/src/render3/r3_identifiers");
25 var util_2 = require("@angular/compiler/src/render3/util");
26 var util_3 = require("@angular/compiler/src/render3/view/util");
27 function createR3ProviderExpression(expression, isForwardRef) {
28 return { expression: expression, isForwardRef: isForwardRef };
29 }
30 exports.createR3ProviderExpression = createR3ProviderExpression;
31 function compileInjectable(meta, resolveForwardRefs) {
32 var result = null;
33 var factoryMeta = {
34 name: meta.name,
35 type: meta.type,
36 internalType: meta.internalType,
37 typeArgumentCount: meta.typeArgumentCount,
38 deps: [],
39 target: r3_factory_1.FactoryTarget.Injectable,
40 };
41 if (meta.useClass !== undefined) {
42 // meta.useClass has two modes of operation. Either deps are specified, in which case `new` is
43 // used to instantiate the class with dependencies injected, or deps are not specified and
44 // the factory of the class is used to instantiate it.
45 //
46 // A special case exists for useClass: Type where Type is the injectable type itself and no
47 // deps are specified, in which case 'useClass' is effectively ignored.
48 var useClassOnSelf = meta.useClass.expression.isEquivalent(meta.internalType);
49 var deps = undefined;
50 if (meta.deps !== undefined) {
51 deps = meta.deps;
52 }
53 if (deps !== undefined) {
54 // factory: () => new meta.useClass(...deps)
55 result = r3_factory_1.compileFactoryFunction(tslib_1.__assign(tslib_1.__assign({}, factoryMeta), { delegate: meta.useClass.expression, delegateDeps: deps, delegateType: r3_factory_1.R3FactoryDelegateType.Class }));
56 }
57 else if (useClassOnSelf) {
58 result = r3_factory_1.compileFactoryFunction(factoryMeta);
59 }
60 else {
61 result = {
62 statements: [],
63 expression: delegateToFactory(meta.type.value, meta.useClass.expression, resolveForwardRefs)
64 };
65 }
66 }
67 else if (meta.useFactory !== undefined) {
68 if (meta.deps !== undefined) {
69 result = r3_factory_1.compileFactoryFunction(tslib_1.__assign(tslib_1.__assign({}, factoryMeta), { delegate: meta.useFactory, delegateDeps: meta.deps || [], delegateType: r3_factory_1.R3FactoryDelegateType.Function }));
70 }
71 else {
72 result = {
73 statements: [],
74 expression: o.fn([], [new o.ReturnStatement(meta.useFactory.callFn([]))])
75 };
76 }
77 }
78 else if (meta.useValue !== undefined) {
79 // Note: it's safe to use `meta.useValue` instead of the `USE_VALUE in meta` check used for
80 // client code because meta.useValue is an Expression which will be defined even if the actual
81 // value is undefined.
82 result = r3_factory_1.compileFactoryFunction(tslib_1.__assign(tslib_1.__assign({}, factoryMeta), { expression: meta.useValue.expression }));
83 }
84 else if (meta.useExisting !== undefined) {
85 // useExisting is an `inject` call on the existing token.
86 result = r3_factory_1.compileFactoryFunction(tslib_1.__assign(tslib_1.__assign({}, factoryMeta), { expression: o.importExpr(r3_identifiers_1.Identifiers.inject).callFn([meta.useExisting.expression]) }));
87 }
88 else {
89 result = {
90 statements: [],
91 expression: delegateToFactory(meta.type.value, meta.internalType, resolveForwardRefs)
92 };
93 }
94 var token = meta.internalType;
95 var injectableProps = new util_3.DefinitionMap();
96 injectableProps.set('token', token);
97 injectableProps.set('factory', result.expression);
98 // Only generate providedIn property if it has a non-null value
99 if (meta.providedIn.expression.value !== null) {
100 injectableProps.set('providedIn', meta.providedIn.isForwardRef ? util_1.generateForwardRef(meta.providedIn.expression) :
101 meta.providedIn.expression);
102 }
103 var expression = o.importExpr(r3_identifiers_1.Identifiers.ɵɵdefineInjectable)
104 .callFn([injectableProps.toLiteralMap()], undefined, true);
105 return {
106 expression: expression,
107 type: createInjectableType(meta),
108 statements: result.statements,
109 };
110 }
111 exports.compileInjectable = compileInjectable;
112 function createInjectableType(meta) {
113 return new o.ExpressionType(o.importExpr(r3_identifiers_1.Identifiers.InjectableDeclaration, [util_2.typeWithParameters(meta.type.type, meta.typeArgumentCount)]));
114 }
115 exports.createInjectableType = createInjectableType;
116 function delegateToFactory(type, internalType, unwrapForwardRefs) {
117 if (type.node === internalType.node) {
118 // The types are the same, so we can simply delegate directly to the type's factory.
119 // ```
120 // factory: type.ɵfac
121 // ```
122 return internalType.prop('ɵfac');
123 }
124 if (!unwrapForwardRefs) {
125 // The type is not wrapped in a `forwardRef()`, so we create a simple factory function that
126 // accepts a sub-type as an argument.
127 // ```
128 // factory: function(t) { return internalType.ɵfac(t); }
129 // ```
130 return createFactoryFunction(internalType);
131 }
132 // The internalType is actually wrapped in a `forwardRef()` so we need to resolve that before
133 // calling its factory.
134 // ```
135 // factory: function(t) { return core.resolveForwardRef(type).ɵfac(t); }
136 // ```
137 var unwrappedType = o.importExpr(r3_identifiers_1.Identifiers.resolveForwardRef).callFn([internalType]);
138 return createFactoryFunction(unwrappedType);
139 }
140 function createFactoryFunction(type) {
141 return o.fn([new o.FnParam('t', o.DYNAMIC_TYPE)], [new o.ReturnStatement(type.callMethod('ɵfac', [o.variable('t')]))]);
142 }
143});
144//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5qZWN0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