source: trip-planner-front/node_modules/@angular/compiler/src/render3/util.js@ ceaed42

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

initial commit

  • Property mode set to 100644
File size: 10.7 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/render3/util", ["require", "exports", "@angular/compiler/src/output/abstract_emitter", "@angular/compiler/src/output/output_ast"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.refsToArray = exports.wrapReference = exports.guardedExpression = exports.devOnlyGuardedExpression = exports.jitOnlyGuardedExpression = exports.prepareSyntheticListenerFunctionName = exports.getSafePropertyAccessString = exports.prepareSyntheticListenerName = exports.prepareSyntheticPropertyName = exports.typeWithParameters = void 0;
20 var abstract_emitter_1 = require("@angular/compiler/src/output/abstract_emitter");
21 var o = require("@angular/compiler/src/output/output_ast");
22 function typeWithParameters(type, numParams) {
23 if (numParams === 0) {
24 return o.expressionType(type);
25 }
26 var params = [];
27 for (var i = 0; i < numParams; i++) {
28 params.push(o.DYNAMIC_TYPE);
29 }
30 return o.expressionType(type, undefined, params);
31 }
32 exports.typeWithParameters = typeWithParameters;
33 var ANIMATE_SYMBOL_PREFIX = '@';
34 function prepareSyntheticPropertyName(name) {
35 return "" + ANIMATE_SYMBOL_PREFIX + name;
36 }
37 exports.prepareSyntheticPropertyName = prepareSyntheticPropertyName;
38 function prepareSyntheticListenerName(name, phase) {
39 return "" + ANIMATE_SYMBOL_PREFIX + name + "." + phase;
40 }
41 exports.prepareSyntheticListenerName = prepareSyntheticListenerName;
42 function getSafePropertyAccessString(accessor, name) {
43 var escapedName = abstract_emitter_1.escapeIdentifier(name, false, false);
44 return escapedName !== name ? accessor + "[" + escapedName + "]" : accessor + "." + name;
45 }
46 exports.getSafePropertyAccessString = getSafePropertyAccessString;
47 function prepareSyntheticListenerFunctionName(name, phase) {
48 return "animation_" + name + "_" + phase;
49 }
50 exports.prepareSyntheticListenerFunctionName = prepareSyntheticListenerFunctionName;
51 function jitOnlyGuardedExpression(expr) {
52 return guardedExpression('ngJitMode', expr);
53 }
54 exports.jitOnlyGuardedExpression = jitOnlyGuardedExpression;
55 function devOnlyGuardedExpression(expr) {
56 return guardedExpression('ngDevMode', expr);
57 }
58 exports.devOnlyGuardedExpression = devOnlyGuardedExpression;
59 function guardedExpression(guard, expr) {
60 var guardExpr = new o.ExternalExpr({ name: guard, moduleName: null });
61 var guardNotDefined = new o.BinaryOperatorExpr(o.BinaryOperator.Identical, new o.TypeofExpr(guardExpr), o.literal('undefined'));
62 var guardUndefinedOrTrue = new o.BinaryOperatorExpr(o.BinaryOperator.Or, guardNotDefined, guardExpr, /* type */ undefined,
63 /* sourceSpan */ undefined, true);
64 return new o.BinaryOperatorExpr(o.BinaryOperator.And, guardUndefinedOrTrue, expr);
65 }
66 exports.guardedExpression = guardedExpression;
67 function wrapReference(value) {
68 var wrapped = new o.WrappedNodeExpr(value);
69 return { value: wrapped, type: wrapped };
70 }
71 exports.wrapReference = wrapReference;
72 function refsToArray(refs, shouldForwardDeclare) {
73 var values = o.literalArr(refs.map(function (ref) { return ref.value; }));
74 return shouldForwardDeclare ? o.fn([], [new o.ReturnStatement(values)]) : values;
75 }
76 exports.refsToArray = refsToArray;
77});
78//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9yZW5kZXIzL3V0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6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by5XcmFwcGVkTm9kZUV4cHIodmFsdWUpO1xuICByZXR1cm4ge3ZhbHVlOiB3cmFwcGVkLCB0eXBlOiB3cmFwcGVkfTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHJlZnNUb0FycmF5KHJlZnM6IFIzUmVmZXJlbmNlW10sIHNob3VsZEZvcndhcmREZWNsYXJlOiBib29sZWFuKTogby5FeHByZXNzaW9uIHtcbiAgY29uc3QgdmFsdWVzID0gby5saXRlcmFsQXJyKHJlZnMubWFwKHJlZiA9PiByZWYudmFsdWUpKTtcbiAgcmV0dXJuIHNob3VsZEZvcndhcmREZWNsYXJlID8gby5mbihbXSwgW25ldyBvLlJldHVyblN0YXRlbWVudCh2YWx1ZXMpXSkgOiB2YWx1ZXM7XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.