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 | import * as o from './output_ast';
|
---|
9 | import { SourceMapGenerator } from './source_map';
|
---|
10 | const _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
|
---|
11 | const _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
|
---|
12 | const _INDENT_WITH = ' ';
|
---|
13 | export const CATCH_ERROR_VAR = o.variable('error', null, null);
|
---|
14 | export const CATCH_STACK_VAR = o.variable('stack', null, null);
|
---|
15 | class _EmittedLine {
|
---|
16 | constructor(indent) {
|
---|
17 | this.indent = indent;
|
---|
18 | this.partsLength = 0;
|
---|
19 | this.parts = [];
|
---|
20 | this.srcSpans = [];
|
---|
21 | }
|
---|
22 | }
|
---|
23 | export class EmitterVisitorContext {
|
---|
24 | constructor(_indent) {
|
---|
25 | this._indent = _indent;
|
---|
26 | this._classes = [];
|
---|
27 | this._preambleLineCount = 0;
|
---|
28 | this._lines = [new _EmittedLine(_indent)];
|
---|
29 | }
|
---|
30 | static createRoot() {
|
---|
31 | return new EmitterVisitorContext(0);
|
---|
32 | }
|
---|
33 | /**
|
---|
34 | * @internal strip this from published d.ts files due to
|
---|
35 | * https://github.com/microsoft/TypeScript/issues/36216
|
---|
36 | */
|
---|
37 | get _currentLine() {
|
---|
38 | return this._lines[this._lines.length - 1];
|
---|
39 | }
|
---|
40 | println(from, lastPart = '') {
|
---|
41 | this.print(from || null, lastPart, true);
|
---|
42 | }
|
---|
43 | lineIsEmpty() {
|
---|
44 | return this._currentLine.parts.length === 0;
|
---|
45 | }
|
---|
46 | lineLength() {
|
---|
47 | return this._currentLine.indent * _INDENT_WITH.length + this._currentLine.partsLength;
|
---|
48 | }
|
---|
49 | print(from, part, newLine = false) {
|
---|
50 | if (part.length > 0) {
|
---|
51 | this._currentLine.parts.push(part);
|
---|
52 | this._currentLine.partsLength += part.length;
|
---|
53 | this._currentLine.srcSpans.push(from && from.sourceSpan || null);
|
---|
54 | }
|
---|
55 | if (newLine) {
|
---|
56 | this._lines.push(new _EmittedLine(this._indent));
|
---|
57 | }
|
---|
58 | }
|
---|
59 | removeEmptyLastLine() {
|
---|
60 | if (this.lineIsEmpty()) {
|
---|
61 | this._lines.pop();
|
---|
62 | }
|
---|
63 | }
|
---|
64 | incIndent() {
|
---|
65 | this._indent++;
|
---|
66 | if (this.lineIsEmpty()) {
|
---|
67 | this._currentLine.indent = this._indent;
|
---|
68 | }
|
---|
69 | }
|
---|
70 | decIndent() {
|
---|
71 | this._indent--;
|
---|
72 | if (this.lineIsEmpty()) {
|
---|
73 | this._currentLine.indent = this._indent;
|
---|
74 | }
|
---|
75 | }
|
---|
76 | pushClass(clazz) {
|
---|
77 | this._classes.push(clazz);
|
---|
78 | }
|
---|
79 | popClass() {
|
---|
80 | return this._classes.pop();
|
---|
81 | }
|
---|
82 | get currentClass() {
|
---|
83 | return this._classes.length > 0 ? this._classes[this._classes.length - 1] : null;
|
---|
84 | }
|
---|
85 | toSource() {
|
---|
86 | return this.sourceLines
|
---|
87 | .map(l => l.parts.length > 0 ? _createIndent(l.indent) + l.parts.join('') : '')
|
---|
88 | .join('\n');
|
---|
89 | }
|
---|
90 | toSourceMapGenerator(genFilePath, startsAtLine = 0) {
|
---|
91 | const map = new SourceMapGenerator(genFilePath);
|
---|
92 | let firstOffsetMapped = false;
|
---|
93 | const mapFirstOffsetIfNeeded = () => {
|
---|
94 | if (!firstOffsetMapped) {
|
---|
95 | // Add a single space so that tools won't try to load the file from disk.
|
---|
96 | // Note: We are using virtual urls like `ng:///`, so we have to
|
---|
97 | // provide a content here.
|
---|
98 | map.addSource(genFilePath, ' ').addMapping(0, genFilePath, 0, 0);
|
---|
99 | firstOffsetMapped = true;
|
---|
100 | }
|
---|
101 | };
|
---|
102 | for (let i = 0; i < startsAtLine; i++) {
|
---|
103 | map.addLine();
|
---|
104 | mapFirstOffsetIfNeeded();
|
---|
105 | }
|
---|
106 | this.sourceLines.forEach((line, lineIdx) => {
|
---|
107 | map.addLine();
|
---|
108 | const spans = line.srcSpans;
|
---|
109 | const parts = line.parts;
|
---|
110 | let col0 = line.indent * _INDENT_WITH.length;
|
---|
111 | let spanIdx = 0;
|
---|
112 | // skip leading parts without source spans
|
---|
113 | while (spanIdx < spans.length && !spans[spanIdx]) {
|
---|
114 | col0 += parts[spanIdx].length;
|
---|
115 | spanIdx++;
|
---|
116 | }
|
---|
117 | if (spanIdx < spans.length && lineIdx === 0 && col0 === 0) {
|
---|
118 | firstOffsetMapped = true;
|
---|
119 | }
|
---|
120 | else {
|
---|
121 | mapFirstOffsetIfNeeded();
|
---|
122 | }
|
---|
123 | while (spanIdx < spans.length) {
|
---|
124 | const span = spans[spanIdx];
|
---|
125 | const source = span.start.file;
|
---|
126 | const sourceLine = span.start.line;
|
---|
127 | const sourceCol = span.start.col;
|
---|
128 | map.addSource(source.url, source.content)
|
---|
129 | .addMapping(col0, source.url, sourceLine, sourceCol);
|
---|
130 | col0 += parts[spanIdx].length;
|
---|
131 | spanIdx++;
|
---|
132 | // assign parts without span or the same span to the previous segment
|
---|
133 | while (spanIdx < spans.length && (span === spans[spanIdx] || !spans[spanIdx])) {
|
---|
134 | col0 += parts[spanIdx].length;
|
---|
135 | spanIdx++;
|
---|
136 | }
|
---|
137 | }
|
---|
138 | });
|
---|
139 | return map;
|
---|
140 | }
|
---|
141 | setPreambleLineCount(count) {
|
---|
142 | return this._preambleLineCount = count;
|
---|
143 | }
|
---|
144 | spanOf(line, column) {
|
---|
145 | const emittedLine = this._lines[line - this._preambleLineCount];
|
---|
146 | if (emittedLine) {
|
---|
147 | let columnsLeft = column - _createIndent(emittedLine.indent).length;
|
---|
148 | for (let partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) {
|
---|
149 | const part = emittedLine.parts[partIndex];
|
---|
150 | if (part.length > columnsLeft) {
|
---|
151 | return emittedLine.srcSpans[partIndex];
|
---|
152 | }
|
---|
153 | columnsLeft -= part.length;
|
---|
154 | }
|
---|
155 | }
|
---|
156 | return null;
|
---|
157 | }
|
---|
158 | /**
|
---|
159 | * @internal strip this from published d.ts files due to
|
---|
160 | * https://github.com/microsoft/TypeScript/issues/36216
|
---|
161 | */
|
---|
162 | get sourceLines() {
|
---|
163 | if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) {
|
---|
164 | return this._lines.slice(0, -1);
|
---|
165 | }
|
---|
166 | return this._lines;
|
---|
167 | }
|
---|
168 | }
|
---|
169 | export class AbstractEmitterVisitor {
|
---|
170 | constructor(_escapeDollarInStrings) {
|
---|
171 | this._escapeDollarInStrings = _escapeDollarInStrings;
|
---|
172 | }
|
---|
173 | printLeadingComments(stmt, ctx) {
|
---|
174 | if (stmt.leadingComments === undefined) {
|
---|
175 | return;
|
---|
176 | }
|
---|
177 | for (const comment of stmt.leadingComments) {
|
---|
178 | if (comment instanceof o.JSDocComment) {
|
---|
179 | ctx.print(stmt, `/*${comment.toString()}*/`, comment.trailingNewline);
|
---|
180 | }
|
---|
181 | else {
|
---|
182 | if (comment.multiline) {
|
---|
183 | ctx.print(stmt, `/* ${comment.text} */`, comment.trailingNewline);
|
---|
184 | }
|
---|
185 | else {
|
---|
186 | comment.text.split('\n').forEach((line) => {
|
---|
187 | ctx.println(stmt, `// ${line}`);
|
---|
188 | });
|
---|
189 | }
|
---|
190 | }
|
---|
191 | }
|
---|
192 | }
|
---|
193 | visitExpressionStmt(stmt, ctx) {
|
---|
194 | this.printLeadingComments(stmt, ctx);
|
---|
195 | stmt.expr.visitExpression(this, ctx);
|
---|
196 | ctx.println(stmt, ';');
|
---|
197 | return null;
|
---|
198 | }
|
---|
199 | visitReturnStmt(stmt, ctx) {
|
---|
200 | this.printLeadingComments(stmt, ctx);
|
---|
201 | ctx.print(stmt, `return `);
|
---|
202 | stmt.value.visitExpression(this, ctx);
|
---|
203 | ctx.println(stmt, ';');
|
---|
204 | return null;
|
---|
205 | }
|
---|
206 | visitIfStmt(stmt, ctx) {
|
---|
207 | this.printLeadingComments(stmt, ctx);
|
---|
208 | ctx.print(stmt, `if (`);
|
---|
209 | stmt.condition.visitExpression(this, ctx);
|
---|
210 | ctx.print(stmt, `) {`);
|
---|
211 | const hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
|
---|
212 | if (stmt.trueCase.length <= 1 && !hasElseCase) {
|
---|
213 | ctx.print(stmt, ` `);
|
---|
214 | this.visitAllStatements(stmt.trueCase, ctx);
|
---|
215 | ctx.removeEmptyLastLine();
|
---|
216 | ctx.print(stmt, ` `);
|
---|
217 | }
|
---|
218 | else {
|
---|
219 | ctx.println();
|
---|
220 | ctx.incIndent();
|
---|
221 | this.visitAllStatements(stmt.trueCase, ctx);
|
---|
222 | ctx.decIndent();
|
---|
223 | if (hasElseCase) {
|
---|
224 | ctx.println(stmt, `} else {`);
|
---|
225 | ctx.incIndent();
|
---|
226 | this.visitAllStatements(stmt.falseCase, ctx);
|
---|
227 | ctx.decIndent();
|
---|
228 | }
|
---|
229 | }
|
---|
230 | ctx.println(stmt, `}`);
|
---|
231 | return null;
|
---|
232 | }
|
---|
233 | visitThrowStmt(stmt, ctx) {
|
---|
234 | this.printLeadingComments(stmt, ctx);
|
---|
235 | ctx.print(stmt, `throw `);
|
---|
236 | stmt.error.visitExpression(this, ctx);
|
---|
237 | ctx.println(stmt, `;`);
|
---|
238 | return null;
|
---|
239 | }
|
---|
240 | visitWriteVarExpr(expr, ctx) {
|
---|
241 | const lineWasEmpty = ctx.lineIsEmpty();
|
---|
242 | if (!lineWasEmpty) {
|
---|
243 | ctx.print(expr, '(');
|
---|
244 | }
|
---|
245 | ctx.print(expr, `${expr.name} = `);
|
---|
246 | expr.value.visitExpression(this, ctx);
|
---|
247 | if (!lineWasEmpty) {
|
---|
248 | ctx.print(expr, ')');
|
---|
249 | }
|
---|
250 | return null;
|
---|
251 | }
|
---|
252 | visitWriteKeyExpr(expr, ctx) {
|
---|
253 | const lineWasEmpty = ctx.lineIsEmpty();
|
---|
254 | if (!lineWasEmpty) {
|
---|
255 | ctx.print(expr, '(');
|
---|
256 | }
|
---|
257 | expr.receiver.visitExpression(this, ctx);
|
---|
258 | ctx.print(expr, `[`);
|
---|
259 | expr.index.visitExpression(this, ctx);
|
---|
260 | ctx.print(expr, `] = `);
|
---|
261 | expr.value.visitExpression(this, ctx);
|
---|
262 | if (!lineWasEmpty) {
|
---|
263 | ctx.print(expr, ')');
|
---|
264 | }
|
---|
265 | return null;
|
---|
266 | }
|
---|
267 | visitWritePropExpr(expr, ctx) {
|
---|
268 | const lineWasEmpty = ctx.lineIsEmpty();
|
---|
269 | if (!lineWasEmpty) {
|
---|
270 | ctx.print(expr, '(');
|
---|
271 | }
|
---|
272 | expr.receiver.visitExpression(this, ctx);
|
---|
273 | ctx.print(expr, `.${expr.name} = `);
|
---|
274 | expr.value.visitExpression(this, ctx);
|
---|
275 | if (!lineWasEmpty) {
|
---|
276 | ctx.print(expr, ')');
|
---|
277 | }
|
---|
278 | return null;
|
---|
279 | }
|
---|
280 | visitInvokeMethodExpr(expr, ctx) {
|
---|
281 | expr.receiver.visitExpression(this, ctx);
|
---|
282 | let name = expr.name;
|
---|
283 | if (expr.builtin != null) {
|
---|
284 | name = this.getBuiltinMethodName(expr.builtin);
|
---|
285 | if (name == null) {
|
---|
286 | // some builtins just mean to skip the call.
|
---|
287 | return null;
|
---|
288 | }
|
---|
289 | }
|
---|
290 | ctx.print(expr, `.${name}(`);
|
---|
291 | this.visitAllExpressions(expr.args, ctx, `,`);
|
---|
292 | ctx.print(expr, `)`);
|
---|
293 | return null;
|
---|
294 | }
|
---|
295 | visitInvokeFunctionExpr(expr, ctx) {
|
---|
296 | expr.fn.visitExpression(this, ctx);
|
---|
297 | ctx.print(expr, `(`);
|
---|
298 | this.visitAllExpressions(expr.args, ctx, ',');
|
---|
299 | ctx.print(expr, `)`);
|
---|
300 | return null;
|
---|
301 | }
|
---|
302 | visitTaggedTemplateExpr(expr, ctx) {
|
---|
303 | expr.tag.visitExpression(this, ctx);
|
---|
304 | ctx.print(expr, '`' + expr.template.elements[0].rawText);
|
---|
305 | for (let i = 1; i < expr.template.elements.length; i++) {
|
---|
306 | ctx.print(expr, '${');
|
---|
307 | expr.template.expressions[i - 1].visitExpression(this, ctx);
|
---|
308 | ctx.print(expr, `}${expr.template.elements[i].rawText}`);
|
---|
309 | }
|
---|
310 | ctx.print(expr, '`');
|
---|
311 | return null;
|
---|
312 | }
|
---|
313 | visitWrappedNodeExpr(ast, ctx) {
|
---|
314 | throw new Error('Abstract emitter cannot visit WrappedNodeExpr.');
|
---|
315 | }
|
---|
316 | visitTypeofExpr(expr, ctx) {
|
---|
317 | ctx.print(expr, 'typeof ');
|
---|
318 | expr.expr.visitExpression(this, ctx);
|
---|
319 | }
|
---|
320 | visitReadVarExpr(ast, ctx) {
|
---|
321 | let varName = ast.name;
|
---|
322 | if (ast.builtin != null) {
|
---|
323 | switch (ast.builtin) {
|
---|
324 | case o.BuiltinVar.Super:
|
---|
325 | varName = 'super';
|
---|
326 | break;
|
---|
327 | case o.BuiltinVar.This:
|
---|
328 | varName = 'this';
|
---|
329 | break;
|
---|
330 | case o.BuiltinVar.CatchError:
|
---|
331 | varName = CATCH_ERROR_VAR.name;
|
---|
332 | break;
|
---|
333 | case o.BuiltinVar.CatchStack:
|
---|
334 | varName = CATCH_STACK_VAR.name;
|
---|
335 | break;
|
---|
336 | default:
|
---|
337 | throw new Error(`Unknown builtin variable ${ast.builtin}`);
|
---|
338 | }
|
---|
339 | }
|
---|
340 | ctx.print(ast, varName);
|
---|
341 | return null;
|
---|
342 | }
|
---|
343 | visitInstantiateExpr(ast, ctx) {
|
---|
344 | ctx.print(ast, `new `);
|
---|
345 | ast.classExpr.visitExpression(this, ctx);
|
---|
346 | ctx.print(ast, `(`);
|
---|
347 | this.visitAllExpressions(ast.args, ctx, ',');
|
---|
348 | ctx.print(ast, `)`);
|
---|
349 | return null;
|
---|
350 | }
|
---|
351 | visitLiteralExpr(ast, ctx) {
|
---|
352 | const value = ast.value;
|
---|
353 | if (typeof value === 'string') {
|
---|
354 | ctx.print(ast, escapeIdentifier(value, this._escapeDollarInStrings));
|
---|
355 | }
|
---|
356 | else {
|
---|
357 | ctx.print(ast, `${value}`);
|
---|
358 | }
|
---|
359 | return null;
|
---|
360 | }
|
---|
361 | visitLocalizedString(ast, ctx) {
|
---|
362 | const head = ast.serializeI18nHead();
|
---|
363 | ctx.print(ast, '$localize `' + head.raw);
|
---|
364 | for (let i = 1; i < ast.messageParts.length; i++) {
|
---|
365 | ctx.print(ast, '${');
|
---|
366 | ast.expressions[i - 1].visitExpression(this, ctx);
|
---|
367 | ctx.print(ast, `}${ast.serializeI18nTemplatePart(i).raw}`);
|
---|
368 | }
|
---|
369 | ctx.print(ast, '`');
|
---|
370 | return null;
|
---|
371 | }
|
---|
372 | visitConditionalExpr(ast, ctx) {
|
---|
373 | ctx.print(ast, `(`);
|
---|
374 | ast.condition.visitExpression(this, ctx);
|
---|
375 | ctx.print(ast, '? ');
|
---|
376 | ast.trueCase.visitExpression(this, ctx);
|
---|
377 | ctx.print(ast, ': ');
|
---|
378 | ast.falseCase.visitExpression(this, ctx);
|
---|
379 | ctx.print(ast, `)`);
|
---|
380 | return null;
|
---|
381 | }
|
---|
382 | visitNotExpr(ast, ctx) {
|
---|
383 | ctx.print(ast, '!');
|
---|
384 | ast.condition.visitExpression(this, ctx);
|
---|
385 | return null;
|
---|
386 | }
|
---|
387 | visitAssertNotNullExpr(ast, ctx) {
|
---|
388 | ast.condition.visitExpression(this, ctx);
|
---|
389 | return null;
|
---|
390 | }
|
---|
391 | visitUnaryOperatorExpr(ast, ctx) {
|
---|
392 | let opStr;
|
---|
393 | switch (ast.operator) {
|
---|
394 | case o.UnaryOperator.Plus:
|
---|
395 | opStr = '+';
|
---|
396 | break;
|
---|
397 | case o.UnaryOperator.Minus:
|
---|
398 | opStr = '-';
|
---|
399 | break;
|
---|
400 | default:
|
---|
401 | throw new Error(`Unknown operator ${ast.operator}`);
|
---|
402 | }
|
---|
403 | if (ast.parens)
|
---|
404 | ctx.print(ast, `(`);
|
---|
405 | ctx.print(ast, opStr);
|
---|
406 | ast.expr.visitExpression(this, ctx);
|
---|
407 | if (ast.parens)
|
---|
408 | ctx.print(ast, `)`);
|
---|
409 | return null;
|
---|
410 | }
|
---|
411 | visitBinaryOperatorExpr(ast, ctx) {
|
---|
412 | let opStr;
|
---|
413 | switch (ast.operator) {
|
---|
414 | case o.BinaryOperator.Equals:
|
---|
415 | opStr = '==';
|
---|
416 | break;
|
---|
417 | case o.BinaryOperator.Identical:
|
---|
418 | opStr = '===';
|
---|
419 | break;
|
---|
420 | case o.BinaryOperator.NotEquals:
|
---|
421 | opStr = '!=';
|
---|
422 | break;
|
---|
423 | case o.BinaryOperator.NotIdentical:
|
---|
424 | opStr = '!==';
|
---|
425 | break;
|
---|
426 | case o.BinaryOperator.And:
|
---|
427 | opStr = '&&';
|
---|
428 | break;
|
---|
429 | case o.BinaryOperator.BitwiseAnd:
|
---|
430 | opStr = '&';
|
---|
431 | break;
|
---|
432 | case o.BinaryOperator.Or:
|
---|
433 | opStr = '||';
|
---|
434 | break;
|
---|
435 | case o.BinaryOperator.Plus:
|
---|
436 | opStr = '+';
|
---|
437 | break;
|
---|
438 | case o.BinaryOperator.Minus:
|
---|
439 | opStr = '-';
|
---|
440 | break;
|
---|
441 | case o.BinaryOperator.Divide:
|
---|
442 | opStr = '/';
|
---|
443 | break;
|
---|
444 | case o.BinaryOperator.Multiply:
|
---|
445 | opStr = '*';
|
---|
446 | break;
|
---|
447 | case o.BinaryOperator.Modulo:
|
---|
448 | opStr = '%';
|
---|
449 | break;
|
---|
450 | case o.BinaryOperator.Lower:
|
---|
451 | opStr = '<';
|
---|
452 | break;
|
---|
453 | case o.BinaryOperator.LowerEquals:
|
---|
454 | opStr = '<=';
|
---|
455 | break;
|
---|
456 | case o.BinaryOperator.Bigger:
|
---|
457 | opStr = '>';
|
---|
458 | break;
|
---|
459 | case o.BinaryOperator.BiggerEquals:
|
---|
460 | opStr = '>=';
|
---|
461 | break;
|
---|
462 | case o.BinaryOperator.NullishCoalesce:
|
---|
463 | opStr = '??';
|
---|
464 | break;
|
---|
465 | default:
|
---|
466 | throw new Error(`Unknown operator ${ast.operator}`);
|
---|
467 | }
|
---|
468 | if (ast.parens)
|
---|
469 | ctx.print(ast, `(`);
|
---|
470 | ast.lhs.visitExpression(this, ctx);
|
---|
471 | ctx.print(ast, ` ${opStr} `);
|
---|
472 | ast.rhs.visitExpression(this, ctx);
|
---|
473 | if (ast.parens)
|
---|
474 | ctx.print(ast, `)`);
|
---|
475 | return null;
|
---|
476 | }
|
---|
477 | visitReadPropExpr(ast, ctx) {
|
---|
478 | ast.receiver.visitExpression(this, ctx);
|
---|
479 | ctx.print(ast, `.`);
|
---|
480 | ctx.print(ast, ast.name);
|
---|
481 | return null;
|
---|
482 | }
|
---|
483 | visitReadKeyExpr(ast, ctx) {
|
---|
484 | ast.receiver.visitExpression(this, ctx);
|
---|
485 | ctx.print(ast, `[`);
|
---|
486 | ast.index.visitExpression(this, ctx);
|
---|
487 | ctx.print(ast, `]`);
|
---|
488 | return null;
|
---|
489 | }
|
---|
490 | visitLiteralArrayExpr(ast, ctx) {
|
---|
491 | ctx.print(ast, `[`);
|
---|
492 | this.visitAllExpressions(ast.entries, ctx, ',');
|
---|
493 | ctx.print(ast, `]`);
|
---|
494 | return null;
|
---|
495 | }
|
---|
496 | visitLiteralMapExpr(ast, ctx) {
|
---|
497 | ctx.print(ast, `{`);
|
---|
498 | this.visitAllObjects(entry => {
|
---|
499 | ctx.print(ast, `${escapeIdentifier(entry.key, this._escapeDollarInStrings, entry.quoted)}:`);
|
---|
500 | entry.value.visitExpression(this, ctx);
|
---|
501 | }, ast.entries, ctx, ',');
|
---|
502 | ctx.print(ast, `}`);
|
---|
503 | return null;
|
---|
504 | }
|
---|
505 | visitCommaExpr(ast, ctx) {
|
---|
506 | ctx.print(ast, '(');
|
---|
507 | this.visitAllExpressions(ast.parts, ctx, ',');
|
---|
508 | ctx.print(ast, ')');
|
---|
509 | return null;
|
---|
510 | }
|
---|
511 | visitAllExpressions(expressions, ctx, separator) {
|
---|
512 | this.visitAllObjects(expr => expr.visitExpression(this, ctx), expressions, ctx, separator);
|
---|
513 | }
|
---|
514 | visitAllObjects(handler, expressions, ctx, separator) {
|
---|
515 | let incrementedIndent = false;
|
---|
516 | for (let i = 0; i < expressions.length; i++) {
|
---|
517 | if (i > 0) {
|
---|
518 | if (ctx.lineLength() > 80) {
|
---|
519 | ctx.print(null, separator, true);
|
---|
520 | if (!incrementedIndent) {
|
---|
521 | // continuation are marked with double indent.
|
---|
522 | ctx.incIndent();
|
---|
523 | ctx.incIndent();
|
---|
524 | incrementedIndent = true;
|
---|
525 | }
|
---|
526 | }
|
---|
527 | else {
|
---|
528 | ctx.print(null, separator, false);
|
---|
529 | }
|
---|
530 | }
|
---|
531 | handler(expressions[i]);
|
---|
532 | }
|
---|
533 | if (incrementedIndent) {
|
---|
534 | // continuation are marked with double indent.
|
---|
535 | ctx.decIndent();
|
---|
536 | ctx.decIndent();
|
---|
537 | }
|
---|
538 | }
|
---|
539 | visitAllStatements(statements, ctx) {
|
---|
540 | statements.forEach((stmt) => stmt.visitStatement(this, ctx));
|
---|
541 | }
|
---|
542 | }
|
---|
543 | export function escapeIdentifier(input, escapeDollar, alwaysQuote = true) {
|
---|
544 | if (input == null) {
|
---|
545 | return null;
|
---|
546 | }
|
---|
547 | const body = input.replace(_SINGLE_QUOTE_ESCAPE_STRING_RE, (...match) => {
|
---|
548 | if (match[0] == '$') {
|
---|
549 | return escapeDollar ? '\\$' : '$';
|
---|
550 | }
|
---|
551 | else if (match[0] == '\n') {
|
---|
552 | return '\\n';
|
---|
553 | }
|
---|
554 | else if (match[0] == '\r') {
|
---|
555 | return '\\r';
|
---|
556 | }
|
---|
557 | else {
|
---|
558 | return `\\${match[0]}`;
|
---|
559 | }
|
---|
560 | });
|
---|
561 | const requiresQuotes = alwaysQuote || !_LEGAL_IDENTIFIER_RE.test(body);
|
---|
562 | return requiresQuotes ? `'${body}'` : body;
|
---|
563 | }
|
---|
564 | function _createIndent(count) {
|
---|
565 | let res = '';
|
---|
566 | for (let i = 0; i < count; i++) {
|
---|
567 | res += _INDENT_WITH;
|
---|
568 | }
|
---|
569 | return res;
|
---|
570 | }
|
---|
571 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWJzdHJhY3RfZW1pdHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9vdXRwdXQvYWJzdHJhY3RfZW1pdHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFHSCxPQUFPLEtBQUssQ0FBQyxNQUFNLGNBQWMsQ0FBQztBQUNsQyxPQUFPLEVBQUMsa0JBQWtCLEVBQUMsTUFBTSxjQUFjLENBQUM7QUFFaEQsTUFBTSw4QkFBOEIsR0FBRyxnQkFBZ0IsQ0FBQztBQUN4RCxNQUFNLG9CQUFvQixHQUFHLHVCQUF1QixDQUFDO0FBQ3JELE1BQU0sWUFBWSxHQUFHLElBQUksQ0FBQztBQUMxQixNQUFNLENBQUMsTUFBTSxlQUFlLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxPQUFPLEVBQUUsSUFBSSxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQy9ELE1BQU0sQ0FBQyxNQUFNLGVBQWUsR0FBRyxDQUFDLENBQUMsUUFBUSxDQUFDLE9BQU8sRUFBRSxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUM7QUFNL0QsTUFBTSxZQUFZO0lBSWhCLFlBQW1CLE1BQWM7UUFBZCxXQ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