source: imaps-frontend/node_modules/@babel/generator/lib/generators/base.js

main
Last change on this file was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 2.7 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.BlockStatement = BlockStatement;
7exports.Directive = Directive;
8exports.DirectiveLiteral = DirectiveLiteral;
9exports.File = File;
10exports.InterpreterDirective = InterpreterDirective;
11exports.Placeholder = Placeholder;
12exports.Program = Program;
13function File(node) {
14 if (node.program) {
15 this.print(node.program.interpreter);
16 }
17 this.print(node.program);
18}
19function Program(node) {
20 var _node$directives;
21 this.noIndentInnerCommentsHere();
22 this.printInnerComments();
23 const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length;
24 if (directivesLen) {
25 var _node$directives$trai;
26 const newline = node.body.length ? 2 : 1;
27 this.printSequence(node.directives, {
28 trailingCommentsLineOffset: newline
29 });
30 if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) {
31 this.newline(newline);
32 }
33 }
34 this.printSequence(node.body);
35}
36function BlockStatement(node) {
37 var _node$directives2;
38 this.tokenChar(123);
39 const exit = this.enterDelimited();
40 const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length;
41 if (directivesLen) {
42 var _node$directives$trai2;
43 const newline = node.body.length ? 2 : 1;
44 this.printSequence(node.directives, {
45 indent: true,
46 trailingCommentsLineOffset: newline
47 });
48 if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) {
49 this.newline(newline);
50 }
51 }
52 this.printSequence(node.body, {
53 indent: true
54 });
55 exit();
56 this.rightBrace(node);
57}
58function Directive(node) {
59 this.print(node.value);
60 this.semicolon();
61}
62const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/;
63const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
64function DirectiveLiteral(node) {
65 const raw = this.getPossibleRaw(node);
66 if (!this.format.minified && raw !== undefined) {
67 this.token(raw);
68 return;
69 }
70 const {
71 value
72 } = node;
73 if (!unescapedDoubleQuoteRE.test(value)) {
74 this.token(`"${value}"`);
75 } else if (!unescapedSingleQuoteRE.test(value)) {
76 this.token(`'${value}'`);
77 } else {
78 throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes.");
79 }
80}
81function InterpreterDirective(node) {
82 this.token(`#!${node.value}`);
83 this.newline(1, true);
84}
85function Placeholder(node) {
86 this.token("%%");
87 this.print(node.name);
88 this.token("%%");
89 if (node.expectedNode === "Statement") {
90 this.semicolon();
91 }
92}
93
94//# sourceMappingURL=base.js.map
Note: See TracBrowser for help on using the repository browser.