source: trip-planner-front/node_modules/@angular/compiler/src/output/abstract_js_emitter.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: 33.9 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/output/abstract_js_emitter", ["require", "exports", "tslib", "@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.AbstractJsEmitterVisitor = void 0;
20 var tslib_1 = require("tslib");
21 var abstract_emitter_1 = require("@angular/compiler/src/output/abstract_emitter");
22 var o = require("@angular/compiler/src/output/output_ast");
23 /**
24 * In TypeScript, tagged template functions expect a "template object", which is an array of
25 * "cooked" strings plus a `raw` property that contains an array of "raw" strings. This is
26 * typically constructed with a function called `__makeTemplateObject(cooked, raw)`, but it may not
27 * be available in all environments.
28 *
29 * This is a JavaScript polyfill that uses __makeTemplateObject when it's available, but otherwise
30 * creates an inline helper with the same functionality.
31 *
32 * In the inline function, if `Object.defineProperty` is available we use that to attach the `raw`
33 * array.
34 */
35 var makeTemplateObjectPolyfill = '(this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e})';
36 var AbstractJsEmitterVisitor = /** @class */ (function (_super) {
37 tslib_1.__extends(AbstractJsEmitterVisitor, _super);
38 function AbstractJsEmitterVisitor() {
39 return _super.call(this, false) || this;
40 }
41 AbstractJsEmitterVisitor.prototype.visitDeclareClassStmt = function (stmt, ctx) {
42 var _this = this;
43 ctx.pushClass(stmt);
44 this._visitClassConstructor(stmt, ctx);
45 if (stmt.parent != null) {
46 ctx.print(stmt, stmt.name + ".prototype = Object.create(");
47 stmt.parent.visitExpression(this, ctx);
48 ctx.println(stmt, ".prototype);");
49 }
50 stmt.getters.forEach(function (getter) { return _this._visitClassGetter(stmt, getter, ctx); });
51 stmt.methods.forEach(function (method) { return _this._visitClassMethod(stmt, method, ctx); });
52 ctx.popClass();
53 return null;
54 };
55 AbstractJsEmitterVisitor.prototype._visitClassConstructor = function (stmt, ctx) {
56 ctx.print(stmt, "function " + stmt.name + "(");
57 if (stmt.constructorMethod != null) {
58 this._visitParams(stmt.constructorMethod.params, ctx);
59 }
60 ctx.println(stmt, ") {");
61 ctx.incIndent();
62 if (stmt.constructorMethod != null) {
63 if (stmt.constructorMethod.body.length > 0) {
64 ctx.println(stmt, "var self = this;");
65 this.visitAllStatements(stmt.constructorMethod.body, ctx);
66 }
67 }
68 ctx.decIndent();
69 ctx.println(stmt, "}");
70 };
71 AbstractJsEmitterVisitor.prototype._visitClassGetter = function (stmt, getter, ctx) {
72 ctx.println(stmt, "Object.defineProperty(" + stmt.name + ".prototype, '" + getter.name + "', { get: function() {");
73 ctx.incIndent();
74 if (getter.body.length > 0) {
75 ctx.println(stmt, "var self = this;");
76 this.visitAllStatements(getter.body, ctx);
77 }
78 ctx.decIndent();
79 ctx.println(stmt, "}});");
80 };
81 AbstractJsEmitterVisitor.prototype._visitClassMethod = function (stmt, method, ctx) {
82 ctx.print(stmt, stmt.name + ".prototype." + method.name + " = function(");
83 this._visitParams(method.params, ctx);
84 ctx.println(stmt, ") {");
85 ctx.incIndent();
86 if (method.body.length > 0) {
87 ctx.println(stmt, "var self = this;");
88 this.visitAllStatements(method.body, ctx);
89 }
90 ctx.decIndent();
91 ctx.println(stmt, "};");
92 };
93 AbstractJsEmitterVisitor.prototype.visitWrappedNodeExpr = function (ast, ctx) {
94 throw new Error('Cannot emit a WrappedNodeExpr in Javascript.');
95 };
96 AbstractJsEmitterVisitor.prototype.visitReadVarExpr = function (ast, ctx) {
97 if (ast.builtin === o.BuiltinVar.This) {
98 ctx.print(ast, 'self');
99 }
100 else if (ast.builtin === o.BuiltinVar.Super) {
101 throw new Error("'super' needs to be handled at a parent ast node, not at the variable level!");
102 }
103 else {
104 _super.prototype.visitReadVarExpr.call(this, ast, ctx);
105 }
106 return null;
107 };
108 AbstractJsEmitterVisitor.prototype.visitDeclareVarStmt = function (stmt, ctx) {
109 ctx.print(stmt, "var " + stmt.name);
110 if (stmt.value) {
111 ctx.print(stmt, ' = ');
112 stmt.value.visitExpression(this, ctx);
113 }
114 ctx.println(stmt, ";");
115 return null;
116 };
117 AbstractJsEmitterVisitor.prototype.visitCastExpr = function (ast, ctx) {
118 ast.value.visitExpression(this, ctx);
119 return null;
120 };
121 AbstractJsEmitterVisitor.prototype.visitInvokeFunctionExpr = function (expr, ctx) {
122 var fnExpr = expr.fn;
123 if (fnExpr instanceof o.ReadVarExpr && fnExpr.builtin === o.BuiltinVar.Super) {
124 ctx.currentClass.parent.visitExpression(this, ctx);
125 ctx.print(expr, ".call(this");
126 if (expr.args.length > 0) {
127 ctx.print(expr, ", ");
128 this.visitAllExpressions(expr.args, ctx, ',');
129 }
130 ctx.print(expr, ")");
131 }
132 else {
133 _super.prototype.visitInvokeFunctionExpr.call(this, expr, ctx);
134 }
135 return null;
136 };
137 AbstractJsEmitterVisitor.prototype.visitTaggedTemplateExpr = function (ast, ctx) {
138 var _this = this;
139 // The following convoluted piece of code is effectively the downlevelled equivalent of
140 // ```
141 // tag`...`
142 // ```
143 // which is effectively like:
144 // ```
145 // tag(__makeTemplateObject(cooked, raw), expression1, expression2, ...);
146 // ```
147 var elements = ast.template.elements;
148 ast.tag.visitExpression(this, ctx);
149 ctx.print(ast, "(" + makeTemplateObjectPolyfill + "(");
150 ctx.print(ast, "[" + elements.map(function (part) { return abstract_emitter_1.escapeIdentifier(part.text, false); }).join(', ') + "], ");
151 ctx.print(ast, "[" + elements.map(function (part) { return abstract_emitter_1.escapeIdentifier(part.rawText, false); }).join(', ') + "])");
152 ast.template.expressions.forEach(function (expression) {
153 ctx.print(ast, ', ');
154 expression.visitExpression(_this, ctx);
155 });
156 ctx.print(ast, ')');
157 return null;
158 };
159 AbstractJsEmitterVisitor.prototype.visitFunctionExpr = function (ast, ctx) {
160 ctx.print(ast, "function" + (ast.name ? ' ' + ast.name : '') + "(");
161 this._visitParams(ast.params, ctx);
162 ctx.println(ast, ") {");
163 ctx.incIndent();
164 this.visitAllStatements(ast.statements, ctx);
165 ctx.decIndent();
166 ctx.print(ast, "}");
167 return null;
168 };
169 AbstractJsEmitterVisitor.prototype.visitDeclareFunctionStmt = function (stmt, ctx) {
170 ctx.print(stmt, "function " + stmt.name + "(");
171 this._visitParams(stmt.params, ctx);
172 ctx.println(stmt, ") {");
173 ctx.incIndent();
174 this.visitAllStatements(stmt.statements, ctx);
175 ctx.decIndent();
176 ctx.println(stmt, "}");
177 return null;
178 };
179 AbstractJsEmitterVisitor.prototype.visitTryCatchStmt = function (stmt, ctx) {
180 ctx.println(stmt, "try {");
181 ctx.incIndent();
182 this.visitAllStatements(stmt.bodyStmts, ctx);
183 ctx.decIndent();
184 ctx.println(stmt, "} catch (" + abstract_emitter_1.CATCH_ERROR_VAR.name + ") {");
185 ctx.incIndent();
186 var catchStmts = [abstract_emitter_1.CATCH_STACK_VAR.set(abstract_emitter_1.CATCH_ERROR_VAR.prop('stack')).toDeclStmt(null, [
187 o.StmtModifier.Final
188 ])].concat(stmt.catchStmts);
189 this.visitAllStatements(catchStmts, ctx);
190 ctx.decIndent();
191 ctx.println(stmt, "}");
192 return null;
193 };
194 AbstractJsEmitterVisitor.prototype.visitLocalizedString = function (ast, ctx) {
195 var _this = this;
196 // The following convoluted piece of code is effectively the downlevelled equivalent of
197 // ```
198 // $localize `...`
199 // ```
200 // which is effectively like:
201 // ```
202 // $localize(__makeTemplateObject(cooked, raw), expression1, expression2, ...);
203 // ```
204 ctx.print(ast, "$localize(" + makeTemplateObjectPolyfill + "(");
205 var parts = [ast.serializeI18nHead()];
206 for (var i = 1; i < ast.messageParts.length; i++) {
207 parts.push(ast.serializeI18nTemplatePart(i));
208 }
209 ctx.print(ast, "[" + parts.map(function (part) { return abstract_emitter_1.escapeIdentifier(part.cooked, false); }).join(', ') + "], ");
210 ctx.print(ast, "[" + parts.map(function (part) { return abstract_emitter_1.escapeIdentifier(part.raw, false); }).join(', ') + "])");
211 ast.expressions.forEach(function (expression) {
212 ctx.print(ast, ', ');
213 expression.visitExpression(_this, ctx);
214 });
215 ctx.print(ast, ')');
216 return null;
217 };
218 AbstractJsEmitterVisitor.prototype._visitParams = function (params, ctx) {
219 this.visitAllObjects(function (param) { return ctx.print(null, param.name); }, params, ctx, ',');
220 };
221 AbstractJsEmitterVisitor.prototype.getBuiltinMethodName = function (method) {
222 var name;
223 switch (method) {
224 case o.BuiltinMethod.ConcatArray:
225 name = 'concat';
226 break;
227 case o.BuiltinMethod.SubscribeObservable:
228 name = 'subscribe';
229 break;
230 case o.BuiltinMethod.Bind:
231 name = 'bind';
232 break;
233 default:
234 throw new Error("Unknown builtin method: " + method);
235 }
236 return name;
237 };
238 return AbstractJsEmitterVisitor;
239 }(abstract_emitter_1.AbstractEmitterVisitor));
240 exports.AbstractJsEmitterVisitor = AbstractJsEmitterVisitor;
241});
242//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWJzdHJhY3RfanNfZW1pdHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9vdXRwdXQvYWJzdHJhY3RfanNfZW1pdHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7Ozs7Ozs7O0lBR0gsa0ZBQXFJO0lBQ3JJLDJEQUFrQztJQUVsQzs7Ozs7Ozs7Ozs7T0FXRztJQUNILElBQU0sMEJBQT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gICAgICAgIG5hbWUgPSAnY29uY2F0JztcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlIG8uQnVpbHRpbk1ldGhvZC5TdWJzY3JpYmVPYnNlcnZhYmxlOlxuICAgICAgICBuYW1lID0gJ3N1YnNjcmliZSc7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSBvLkJ1aWx0aW5NZXRob2QuQmluZDpcbiAgICAgICAgbmFtZSA9ICdiaW5kJztcbiAgICAgICAgYnJlYWs7XG4gICAgICBkZWZhdWx0OlxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFVua25vd24gYnVpbHRpbiBtZXRob2Q6ICR7bWV0aG9kfWApO1xuICAgIH1cbiAgICByZXR1cm4gbmFtZTtcbiAgfVxufVxuIl19
Note: See TracBrowser for help on using the repository browser.