source: trip-planner-front/node_modules/@angular/compiler/esm2015/src/output/ts_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: 53.4 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 */
8import { AbstractEmitterVisitor, CATCH_ERROR_VAR, CATCH_STACK_VAR, EmitterVisitorContext } from './abstract_emitter';
9import * as o from './output_ast';
10export function debugOutputAstAsTypeScript(ast) {
11 const converter = new _TsEmitterVisitor();
12 const ctx = EmitterVisitorContext.createRoot();
13 const asts = Array.isArray(ast) ? ast : [ast];
14 asts.forEach((ast) => {
15 if (ast instanceof o.Statement) {
16 ast.visitStatement(converter, ctx);
17 }
18 else if (ast instanceof o.Expression) {
19 ast.visitExpression(converter, ctx);
20 }
21 else if (ast instanceof o.Type) {
22 ast.visitType(converter, ctx);
23 }
24 else {
25 throw new Error(`Don't know how to print debug info for ${ast}`);
26 }
27 });
28 return ctx.toSource();
29}
30export class TypeScriptEmitter {
31 emitStatementsAndContext(genFilePath, stmts, preamble = '', emitSourceMaps = true, referenceFilter, importFilter) {
32 const converter = new _TsEmitterVisitor(referenceFilter, importFilter);
33 const ctx = EmitterVisitorContext.createRoot();
34 converter.visitAllStatements(stmts, ctx);
35 const preambleLines = preamble ? preamble.split('\n') : [];
36 converter.reexports.forEach((reexports, exportedModuleName) => {
37 const reexportsCode = reexports.map(reexport => `${reexport.name} as ${reexport.as}`).join(',');
38 preambleLines.push(`export {${reexportsCode}} from '${exportedModuleName}';`);
39 });
40 converter.importsWithPrefixes.forEach((prefix, importedModuleName) => {
41 // Note: can't write the real word for import as it screws up system.js auto detection...
42 preambleLines.push(`imp` +
43 `ort * as ${prefix} from '${importedModuleName}';`);
44 });
45 const sm = emitSourceMaps ?
46 ctx.toSourceMapGenerator(genFilePath, preambleLines.length).toJsComment() :
47 '';
48 const lines = [...preambleLines, ctx.toSource(), sm];
49 if (sm) {
50 // always add a newline at the end, as some tools have bugs without it.
51 lines.push('');
52 }
53 ctx.setPreambleLineCount(preambleLines.length);
54 return { sourceText: lines.join('\n'), context: ctx };
55 }
56 emitStatements(genFilePath, stmts, preamble = '') {
57 return this.emitStatementsAndContext(genFilePath, stmts, preamble).sourceText;
58 }
59}
60class _TsEmitterVisitor extends AbstractEmitterVisitor {
61 constructor(referenceFilter, importFilter) {
62 super(false);
63 this.referenceFilter = referenceFilter;
64 this.importFilter = importFilter;
65 this.typeExpression = 0;
66 this.importsWithPrefixes = new Map();
67 this.reexports = new Map();
68 }
69 visitType(t, ctx, defaultType = 'any') {
70 if (t) {
71 this.typeExpression++;
72 t.visitType(this, ctx);
73 this.typeExpression--;
74 }
75 else {
76 ctx.print(null, defaultType);
77 }
78 }
79 visitLiteralExpr(ast, ctx) {
80 const value = ast.value;
81 if (value == null && ast.type != o.INFERRED_TYPE) {
82 ctx.print(ast, `(${value} as any)`);
83 return null;
84 }
85 return super.visitLiteralExpr(ast, ctx);
86 }
87 // Temporary workaround to support strictNullCheck enabled consumers of ngc emit.
88 // In SNC mode, [] have the type never[], so we cast here to any[].
89 // TODO: narrow the cast to a more explicit type, or use a pattern that does not
90 // start with [].concat. see https://github.com/angular/angular/pull/11846
91 visitLiteralArrayExpr(ast, ctx) {
92 if (ast.entries.length === 0) {
93 ctx.print(ast, '(');
94 }
95 const result = super.visitLiteralArrayExpr(ast, ctx);
96 if (ast.entries.length === 0) {
97 ctx.print(ast, ' as any[])');
98 }
99 return result;
100 }
101 visitExternalExpr(ast, ctx) {
102 this._visitIdentifier(ast.value, ast.typeParams, ctx);
103 return null;
104 }
105 visitAssertNotNullExpr(ast, ctx) {
106 const result = super.visitAssertNotNullExpr(ast, ctx);
107 ctx.print(ast, '!');
108 return result;
109 }
110 visitDeclareVarStmt(stmt, ctx) {
111 if (stmt.hasModifier(o.StmtModifier.Exported) && stmt.value instanceof o.ExternalExpr &&
112 !stmt.type) {
113 // check for a reexport
114 const { name, moduleName } = stmt.value.value;
115 if (moduleName) {
116 let reexports = this.reexports.get(moduleName);
117 if (!reexports) {
118 reexports = [];
119 this.reexports.set(moduleName, reexports);
120 }
121 reexports.push({ name: name, as: stmt.name });
122 return null;
123 }
124 }
125 if (stmt.hasModifier(o.StmtModifier.Exported)) {
126 ctx.print(stmt, `export `);
127 }
128 if (stmt.hasModifier(o.StmtModifier.Final)) {
129 ctx.print(stmt, `const`);
130 }
131 else {
132 ctx.print(stmt, `var`);
133 }
134 ctx.print(stmt, ` ${stmt.name}`);
135 this._printColonType(stmt.type, ctx);
136 if (stmt.value) {
137 ctx.print(stmt, ` = `);
138 stmt.value.visitExpression(this, ctx);
139 }
140 ctx.println(stmt, `;`);
141 return null;
142 }
143 visitWrappedNodeExpr(ast, ctx) {
144 throw new Error('Cannot visit a WrappedNodeExpr when outputting Typescript.');
145 }
146 visitCastExpr(ast, ctx) {
147 ctx.print(ast, `(<`);
148 ast.type.visitType(this, ctx);
149 ctx.print(ast, `>`);
150 ast.value.visitExpression(this, ctx);
151 ctx.print(ast, `)`);
152 return null;
153 }
154 visitInstantiateExpr(ast, ctx) {
155 ctx.print(ast, `new `);
156 this.typeExpression++;
157 ast.classExpr.visitExpression(this, ctx);
158 this.typeExpression--;
159 ctx.print(ast, `(`);
160 this.visitAllExpressions(ast.args, ctx, ',');
161 ctx.print(ast, `)`);
162 return null;
163 }
164 visitDeclareClassStmt(stmt, ctx) {
165 ctx.pushClass(stmt);
166 if (stmt.hasModifier(o.StmtModifier.Exported)) {
167 ctx.print(stmt, `export `);
168 }
169 ctx.print(stmt, `class ${stmt.name}`);
170 if (stmt.parent != null) {
171 ctx.print(stmt, ` extends `);
172 this.typeExpression++;
173 stmt.parent.visitExpression(this, ctx);
174 this.typeExpression--;
175 }
176 ctx.println(stmt, ` {`);
177 ctx.incIndent();
178 stmt.fields.forEach((field) => this._visitClassField(field, ctx));
179 if (stmt.constructorMethod != null) {
180 this._visitClassConstructor(stmt, ctx);
181 }
182 stmt.getters.forEach((getter) => this._visitClassGetter(getter, ctx));
183 stmt.methods.forEach((method) => this._visitClassMethod(method, ctx));
184 ctx.decIndent();
185 ctx.println(stmt, `}`);
186 ctx.popClass();
187 return null;
188 }
189 _visitClassField(field, ctx) {
190 if (field.hasModifier(o.StmtModifier.Private)) {
191 // comment out as a workaround for #10967
192 ctx.print(null, `/*private*/ `);
193 }
194 if (field.hasModifier(o.StmtModifier.Static)) {
195 ctx.print(null, 'static ');
196 }
197 ctx.print(null, field.name);
198 this._printColonType(field.type, ctx);
199 if (field.initializer) {
200 ctx.print(null, ' = ');
201 field.initializer.visitExpression(this, ctx);
202 }
203 ctx.println(null, `;`);
204 }
205 _visitClassGetter(getter, ctx) {
206 if (getter.hasModifier(o.StmtModifier.Private)) {
207 ctx.print(null, `private `);
208 }
209 ctx.print(null, `get ${getter.name}()`);
210 this._printColonType(getter.type, ctx);
211 ctx.println(null, ` {`);
212 ctx.incIndent();
213 this.visitAllStatements(getter.body, ctx);
214 ctx.decIndent();
215 ctx.println(null, `}`);
216 }
217 _visitClassConstructor(stmt, ctx) {
218 ctx.print(stmt, `constructor(`);
219 this._visitParams(stmt.constructorMethod.params, ctx);
220 ctx.println(stmt, `) {`);
221 ctx.incIndent();
222 this.visitAllStatements(stmt.constructorMethod.body, ctx);
223 ctx.decIndent();
224 ctx.println(stmt, `}`);
225 }
226 _visitClassMethod(method, ctx) {
227 if (method.hasModifier(o.StmtModifier.Private)) {
228 ctx.print(null, `private `);
229 }
230 ctx.print(null, `${method.name}(`);
231 this._visitParams(method.params, ctx);
232 ctx.print(null, `)`);
233 this._printColonType(method.type, ctx, 'void');
234 ctx.println(null, ` {`);
235 ctx.incIndent();
236 this.visitAllStatements(method.body, ctx);
237 ctx.decIndent();
238 ctx.println(null, `}`);
239 }
240 visitFunctionExpr(ast, ctx) {
241 if (ast.name) {
242 ctx.print(ast, 'function ');
243 ctx.print(ast, ast.name);
244 }
245 ctx.print(ast, `(`);
246 this._visitParams(ast.params, ctx);
247 ctx.print(ast, `)`);
248 this._printColonType(ast.type, ctx, 'void');
249 if (!ast.name) {
250 ctx.print(ast, ` => `);
251 }
252 ctx.println(ast, '{');
253 ctx.incIndent();
254 this.visitAllStatements(ast.statements, ctx);
255 ctx.decIndent();
256 ctx.print(ast, `}`);
257 return null;
258 }
259 visitDeclareFunctionStmt(stmt, ctx) {
260 if (stmt.hasModifier(o.StmtModifier.Exported)) {
261 ctx.print(stmt, `export `);
262 }
263 ctx.print(stmt, `function ${stmt.name}(`);
264 this._visitParams(stmt.params, ctx);
265 ctx.print(stmt, `)`);
266 this._printColonType(stmt.type, ctx, 'void');
267 ctx.println(stmt, ` {`);
268 ctx.incIndent();
269 this.visitAllStatements(stmt.statements, ctx);
270 ctx.decIndent();
271 ctx.println(stmt, `}`);
272 return null;
273 }
274 visitTryCatchStmt(stmt, ctx) {
275 ctx.println(stmt, `try {`);
276 ctx.incIndent();
277 this.visitAllStatements(stmt.bodyStmts, ctx);
278 ctx.decIndent();
279 ctx.println(stmt, `} catch (${CATCH_ERROR_VAR.name}) {`);
280 ctx.incIndent();
281 const catchStmts = [CATCH_STACK_VAR.set(CATCH_ERROR_VAR.prop('stack', null)).toDeclStmt(null, [
282 o.StmtModifier.Final
283 ])].concat(stmt.catchStmts);
284 this.visitAllStatements(catchStmts, ctx);
285 ctx.decIndent();
286 ctx.println(stmt, `}`);
287 return null;
288 }
289 visitBuiltinType(type, ctx) {
290 let typeStr;
291 switch (type.name) {
292 case o.BuiltinTypeName.Bool:
293 typeStr = 'boolean';
294 break;
295 case o.BuiltinTypeName.Dynamic:
296 typeStr = 'any';
297 break;
298 case o.BuiltinTypeName.Function:
299 typeStr = 'Function';
300 break;
301 case o.BuiltinTypeName.Number:
302 typeStr = 'number';
303 break;
304 case o.BuiltinTypeName.Int:
305 typeStr = 'number';
306 break;
307 case o.BuiltinTypeName.String:
308 typeStr = 'string';
309 break;
310 case o.BuiltinTypeName.None:
311 typeStr = 'never';
312 break;
313 default:
314 throw new Error(`Unsupported builtin type ${type.name}`);
315 }
316 ctx.print(null, typeStr);
317 return null;
318 }
319 visitExpressionType(ast, ctx) {
320 ast.value.visitExpression(this, ctx);
321 if (ast.typeParams !== null) {
322 ctx.print(null, '<');
323 this.visitAllObjects(type => this.visitType(type, ctx), ast.typeParams, ctx, ',');
324 ctx.print(null, '>');
325 }
326 return null;
327 }
328 visitArrayType(type, ctx) {
329 this.visitType(type.of, ctx);
330 ctx.print(null, `[]`);
331 return null;
332 }
333 visitMapType(type, ctx) {
334 ctx.print(null, `{[key: string]:`);
335 this.visitType(type.valueType, ctx);
336 ctx.print(null, `}`);
337 return null;
338 }
339 getBuiltinMethodName(method) {
340 let name;
341 switch (method) {
342 case o.BuiltinMethod.ConcatArray:
343 name = 'concat';
344 break;
345 case o.BuiltinMethod.SubscribeObservable:
346 name = 'subscribe';
347 break;
348 case o.BuiltinMethod.Bind:
349 name = 'bind';
350 break;
351 default:
352 throw new Error(`Unknown builtin method: ${method}`);
353 }
354 return name;
355 }
356 _visitParams(params, ctx) {
357 this.visitAllObjects(param => {
358 ctx.print(null, param.name);
359 this._printColonType(param.type, ctx);
360 }, params, ctx, ',');
361 }
362 _visitIdentifier(value, typeParams, ctx) {
363 const { name, moduleName } = value;
364 if (this.referenceFilter && this.referenceFilter(value)) {
365 ctx.print(null, '(null as any)');
366 return;
367 }
368 if (moduleName && (!this.importFilter || !this.importFilter(value))) {
369 let prefix = this.importsWithPrefixes.get(moduleName);
370 if (prefix == null) {
371 prefix = `i${this.importsWithPrefixes.size}`;
372 this.importsWithPrefixes.set(moduleName, prefix);
373 }
374 ctx.print(null, `${prefix}.`);
375 }
376 ctx.print(null, name);
377 if (this.typeExpression > 0) {
378 // If we are in a type expression that refers to a generic type then supply
379 // the required type parameters. If there were not enough type parameters
380 // supplied, supply any as the type. Outside a type expression the reference
381 // should not supply type parameters and be treated as a simple value reference
382 // to the constructor function itself.
383 const suppliedParameters = typeParams || [];
384 if (suppliedParameters.length > 0) {
385 ctx.print(null, `<`);
386 this.visitAllObjects(type => type.visitType(this, ctx), typeParams, ctx, ',');
387 ctx.print(null, `>`);
388 }
389 }
390 }
391 _printColonType(type, ctx, defaultType) {
392 if (type !== o.INFERRED_TYPE) {
393 ctx.print(null, ':');
394 this.visitType(type, ctx, defaultType);
395 }
396 }
397}
398//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHNfZW1pdHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9vdXRwdXQvdHNfZW1pdHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsc0JBQXNCLEVBQUUsZUFBZSxFQUFFLGVBQWUsRUFBRSxxQkFBcUIsRUFBZ0IsTUFBTSxvQkFBb0IsQ0FBQztBQUNsSSxPQUFPLEtBQUssQ0FBQyxNQUFNLGNBQWMsQ0FBQztBQUVsQyxNQUFNLFVBQVUsMEJBQTBCLENBQUMsR0FBMEM7SUFDbkYsTUFBTSxTQUFTLEdBQUcsSUFBSSxpQkFBaUIsRUFBRSxDQUFDO0lBQzFDLE1BQU0sR0FBRyxHQUFHLHFCQUFxQixDQUFDLFVBQVUsRUFBRSxDQUFDO0lBQy9DLE1BQU0sSUFBSSxHQUFVLEtBQUssQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUVyRCxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUMsR0FBRyxFQUFFLEVBQUU7UUFDbkIsSUFBSSxHQUFHLFlBQVksQ0FBQyxDQUFDLFNBQVMsRUFBRTtZQUM5QixHQUFHLENBQUMsY0F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iAgICAgIC8vIHNob3VsZCBub3Qgc3VwcGx5IHR5cGUgcGFyYW1ldGVycyBhbmQgYmUgdHJlYXRlZCBhcyBhIHNpbXBsZSB2YWx1ZSByZWZlcmVuY2VcbiAgICAgIC8vIHRvIHRoZSBjb25zdHJ1Y3RvciBmdW5jdGlvbiBpdHNlbGYuXG4gICAgICBjb25zdCBzdXBwbGllZFBhcmFtZXRlcnMgPSB0eXBlUGFyYW1zIHx8IFtdO1xuICAgICAgaWYgKHN1cHBsaWVkUGFyYW1ldGVycy5sZW5ndGggPiAwKSB7XG4gICAgICAgIGN0eC5wcmludChudWxsLCBgPGApO1xuICAgICAgICB0aGlzLnZpc2l0QWxsT2JqZWN0cyh0eXBlID0+IHR5cGUudmlzaXRUeXBlKHRoaXMsIGN0eCksIHR5cGVQYXJhbXMhLCBjdHgsICcsJyk7XG4gICAgICAgIGN0eC5wcmludChudWxsLCBgPmApO1xuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIHByaXZhdGUgX3ByaW50Q29sb25UeXBlKHR5cGU6IG8uVHlwZXxudWxsLCBjdHg6IEVtaXR0ZXJWaXNpdG9yQ29udGV4dCwgZGVmYXVsdFR5cGU/OiBzdHJpbmcpIHtcbiAgICBpZiAodHlwZSAhPT0gby5JTkZFUlJFRF9UWVBFKSB7XG4gICAgICBjdHgucHJpbnQobnVsbCwgJzonKTtcbiAgICAgIHRoaXMudmlzaXRUeXBlKHR5cGUsIGN0eCwgZGVmYXVsdFR5cGUpO1xuICAgIH1cbiAgfVxufVxuIl19
Note: See TracBrowser for help on using the repository browser.