prettier-plugin-java 2.5.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,480 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
- if (ar || !(i in from)) {
31
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
- ar[i] = from[i];
33
- }
34
- }
35
- return to.concat(ar || Array.prototype.slice.call(from));
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.BlocksAndStatementPrettierVisitor = void 0;
39
- var doc_1 = require("prettier/doc");
40
- var prettier_builder_1 = require("./prettier-builder");
41
- var format_comments_1 = require("./comments/format-comments");
42
- var comments_utils_1 = require("./comments/comments-utils");
43
- var printer_utils_1 = require("./printer-utils");
44
- var base_cst_printer_1 = require("../base-cst-printer");
45
- var line = doc_1.builders.line, softline = doc_1.builders.softline, hardline = doc_1.builders.hardline;
46
- var BlocksAndStatementPrettierVisitor = /** @class */ (function (_super) {
47
- __extends(BlocksAndStatementPrettierVisitor, _super);
48
- function BlocksAndStatementPrettierVisitor() {
49
- return _super !== null && _super.apply(this, arguments) || this;
50
- }
51
- BlocksAndStatementPrettierVisitor.prototype.block = function (ctx) {
52
- var blockStatements = this.visit(ctx.blockStatements);
53
- return (0, printer_utils_1.putIntoBraces)(blockStatements, hardline, ctx.LCurly[0], ctx.RCurly[0]);
54
- };
55
- BlocksAndStatementPrettierVisitor.prototype.blockStatements = function (ctx) {
56
- var blockStatement = this.mapVisit(ctx.blockStatement);
57
- var separators = (0, printer_utils_1.rejectSeparators)((0, printer_utils_1.getBlankLinesSeparator)(ctx.blockStatement), blockStatement);
58
- return (0, printer_utils_1.rejectAndJoinSeps)(separators, blockStatement);
59
- };
60
- BlocksAndStatementPrettierVisitor.prototype.blockStatement = function (ctx) {
61
- return this.visitSingle(ctx);
62
- };
63
- BlocksAndStatementPrettierVisitor.prototype.localVariableDeclarationStatement = function (ctx) {
64
- var localVariableDeclaration = this.visit(ctx.localVariableDeclaration);
65
- return (0, printer_utils_1.rejectAndConcat)([localVariableDeclaration, ctx.Semicolon[0]]);
66
- };
67
- BlocksAndStatementPrettierVisitor.prototype.localVariableDeclaration = function (ctx) {
68
- var modifiers = (0, printer_utils_1.sortModifiers)(ctx.variableModifier);
69
- var firstAnnotations = this.mapVisit(modifiers[0]);
70
- var finalModifiers = this.mapVisit(modifiers[1]);
71
- var localVariableType = this.visit(ctx.localVariableType);
72
- var variableDeclaratorList = this.visit(ctx.variableDeclaratorList);
73
- return (0, printer_utils_1.rejectAndJoin)(hardline, [
74
- (0, printer_utils_1.rejectAndJoin)(hardline, firstAnnotations),
75
- (0, printer_utils_1.rejectAndJoin)(" ", [
76
- (0, printer_utils_1.rejectAndJoin)(" ", finalModifiers),
77
- localVariableType,
78
- variableDeclaratorList
79
- ])
80
- ]);
81
- };
82
- BlocksAndStatementPrettierVisitor.prototype.localVariableType = function (ctx) {
83
- if (ctx.unannType) {
84
- return this.visitSingle(ctx);
85
- }
86
- return (0, format_comments_1.printTokenWithComments)(this.getSingle(ctx));
87
- };
88
- BlocksAndStatementPrettierVisitor.prototype.statement = function (ctx, params) {
89
- // handling Labeled statements comments
90
- if (ctx.labeledStatement !== undefined) {
91
- var newLabelStatement = __assign({}, ctx.labeledStatement[0]);
92
- var newColon = __assign({}, ctx.labeledStatement[0].children.Colon[0]);
93
- var newStatement = __assign({}, ctx.labeledStatement[0].children.statement[0]);
94
- var labeledStatementLeadingComments = [];
95
- if (newColon.trailingComments !== undefined) {
96
- labeledStatementLeadingComments.push.apply(labeledStatementLeadingComments, newColon.trailingComments);
97
- delete newColon.trailingComments;
98
- }
99
- if (newStatement.leadingComments !== undefined) {
100
- labeledStatementLeadingComments.push.apply(labeledStatementLeadingComments, newStatement.leadingComments);
101
- delete newStatement.leadingComments;
102
- }
103
- if (labeledStatementLeadingComments.length !== 0) {
104
- newLabelStatement.leadingComments = labeledStatementLeadingComments;
105
- }
106
- newLabelStatement.children.Colon[0] = newColon;
107
- newLabelStatement.children.statement[0] = newStatement;
108
- return this.visit([newLabelStatement]);
109
- }
110
- return this.visitSingle(ctx, params);
111
- };
112
- BlocksAndStatementPrettierVisitor.prototype.statementWithoutTrailingSubstatement = function (ctx, params) {
113
- return this.visitSingle(ctx, params);
114
- };
115
- BlocksAndStatementPrettierVisitor.prototype.emptyStatement = function (ctx, params) {
116
- return (0, printer_utils_1.displaySemicolon)(ctx.Semicolon[0], params);
117
- };
118
- BlocksAndStatementPrettierVisitor.prototype.labeledStatement = function (ctx) {
119
- var identifier = ctx.Identifier[0];
120
- var statement = this.visit(ctx.statement);
121
- return (0, printer_utils_1.rejectAndJoin)(ctx.Colon[0], [identifier, statement]);
122
- };
123
- BlocksAndStatementPrettierVisitor.prototype.expressionStatement = function (ctx) {
124
- var statementExpression = this.visit(ctx.statementExpression);
125
- return (0, printer_utils_1.rejectAndConcat)([statementExpression, ctx.Semicolon[0]]);
126
- };
127
- BlocksAndStatementPrettierVisitor.prototype.statementExpression = function (ctx) {
128
- return this.visitSingle(ctx);
129
- };
130
- BlocksAndStatementPrettierVisitor.prototype.ifStatement = function (ctx) {
131
- var expression = this.visit(ctx.expression);
132
- var ifStatement = this.visit(ctx.statement[0], {
133
- allowEmptyStatement: true
134
- });
135
- var ifSeparator = (0, printer_utils_1.isStatementEmptyStatement)(ifStatement) ? "" : " ";
136
- var elsePart = "";
137
- if (ctx.Else !== undefined) {
138
- var elseStatement = this.visit(ctx.statement[1], {
139
- allowEmptyStatement: true
140
- });
141
- var elseSeparator = (0, printer_utils_1.isStatementEmptyStatement)(elseStatement) ? "" : " ";
142
- var elseOnSameLine = (0, comments_utils_1.hasTrailingLineComments)(ctx.statement[0]) ||
143
- (0, comments_utils_1.hasLeadingLineComments)(ctx.Else[0])
144
- ? hardline
145
- : " ";
146
- elsePart = (0, printer_utils_1.rejectAndJoin)(elseSeparator, [
147
- (0, prettier_builder_1.concat)([elseOnSameLine, ctx.Else[0]]),
148
- elseStatement
149
- ]);
150
- }
151
- return (0, printer_utils_1.rejectAndConcat)([
152
- (0, printer_utils_1.rejectAndJoin)(" ", [
153
- ctx.If[0],
154
- (0, prettier_builder_1.concat)([
155
- (0, printer_utils_1.putIntoBraces)(expression, softline, ctx.LBrace[0], ctx.RBrace[0]),
156
- ifSeparator
157
- ])
158
- ]),
159
- ifStatement,
160
- elsePart
161
- ]);
162
- };
163
- BlocksAndStatementPrettierVisitor.prototype.assertStatement = function (ctx) {
164
- var expressions = this.mapVisit(ctx.expression);
165
- var colon = ctx.Colon ? ctx.Colon[0] : ":";
166
- return (0, printer_utils_1.rejectAndConcat)([
167
- (0, prettier_builder_1.concat)([ctx.Assert[0], " "]),
168
- (0, printer_utils_1.rejectAndJoin)((0, prettier_builder_1.concat)([" ", colon, " "]), expressions),
169
- ctx.Semicolon[0]
170
- ]);
171
- };
172
- BlocksAndStatementPrettierVisitor.prototype.switchStatement = function (ctx) {
173
- var expression = this.visit(ctx.expression);
174
- var switchBlock = this.visit(ctx.switchBlock);
175
- return (0, printer_utils_1.rejectAndJoin)(" ", [
176
- ctx.Switch[0],
177
- (0, printer_utils_1.putIntoBraces)(expression, softline, ctx.LBrace[0], ctx.RBrace[0]),
178
- switchBlock
179
- ]);
180
- };
181
- BlocksAndStatementPrettierVisitor.prototype.switchBlock = function (ctx) {
182
- var switchCases = ctx.switchBlockStatementGroup !== undefined
183
- ? this.mapVisit(ctx.switchBlockStatementGroup)
184
- : this.mapVisit(ctx.switchRule);
185
- return (0, printer_utils_1.putIntoBraces)((0, printer_utils_1.rejectAndJoin)(hardline, switchCases), hardline, ctx.LCurly[0], ctx.RCurly[0]);
186
- };
187
- BlocksAndStatementPrettierVisitor.prototype.switchBlockStatementGroup = function (ctx) {
188
- var switchLabel = this.visit(ctx.switchLabel);
189
- var blockStatements = this.visit(ctx.blockStatements);
190
- return (0, prettier_builder_1.concat)([
191
- switchLabel,
192
- ctx.Colon[0],
193
- blockStatements && (0, prettier_builder_1.indent)([hardline, blockStatements])
194
- ]);
195
- };
196
- BlocksAndStatementPrettierVisitor.prototype.switchLabel = function (ctx) {
197
- var _a, _b, _c;
198
- var Case = (_a = ctx.Case) === null || _a === void 0 ? void 0 : _a[0];
199
- var commas = (_b = ctx.Comma) === null || _b === void 0 ? void 0 : _b.map(function (elt) { return (0, prettier_builder_1.concat)([elt, line]); });
200
- if (ctx.caseConstant || ctx.Null) {
201
- var caseConstants = ctx.Null
202
- ? [ctx.Null[0], (_c = ctx.Default) === null || _c === void 0 ? void 0 : _c[0]]
203
- : this.mapVisit(ctx.caseConstant);
204
- return (0, prettier_builder_1.group)((0, prettier_builder_1.indent)((0, prettier_builder_1.join)(" ", [Case, (0, printer_utils_1.rejectAndJoinSeps)(commas, caseConstants)])));
205
- }
206
- else if (ctx.pattern) {
207
- var patterns = this.mapVisit(ctx.pattern);
208
- var guard = this.visit(ctx.guard);
209
- var multiplePatterns = ctx.pattern.length > 1;
210
- var separator = multiplePatterns ? line : " ";
211
- var contents = (0, prettier_builder_1.join)(separator, [
212
- Case,
213
- (0, printer_utils_1.rejectAndJoinSeps)(commas, patterns)
214
- ]);
215
- return (0, prettier_builder_1.group)((0, printer_utils_1.rejectAndJoin)(separator, [
216
- multiplePatterns ? (0, prettier_builder_1.indent)(contents) : contents,
217
- guard
218
- ]));
219
- }
220
- return (0, format_comments_1.printTokenWithComments)(ctx.Default[0]);
221
- };
222
- BlocksAndStatementPrettierVisitor.prototype.switchRule = function (ctx) {
223
- var switchLabel = this.visit(ctx.switchLabel);
224
- var caseInstruction;
225
- if (ctx.throwStatement !== undefined) {
226
- caseInstruction = this.visit(ctx.throwStatement);
227
- }
228
- else if (ctx.block !== undefined) {
229
- caseInstruction = this.visit(ctx.block);
230
- }
231
- else {
232
- caseInstruction = (0, prettier_builder_1.concat)([this.visit(ctx.expression), ctx.Semicolon[0]]);
233
- }
234
- return (0, prettier_builder_1.concat)([switchLabel, " ", ctx.Arrow[0], " ", caseInstruction]);
235
- };
236
- BlocksAndStatementPrettierVisitor.prototype.caseConstant = function (ctx) {
237
- return this.visitSingle(ctx);
238
- };
239
- BlocksAndStatementPrettierVisitor.prototype.whileStatement = function (ctx) {
240
- var expression = this.visit(ctx.expression);
241
- var statement = this.visit(ctx.statement[0], {
242
- allowEmptyStatement: true
243
- });
244
- var statementSeparator = (0, printer_utils_1.isStatementEmptyStatement)(statement) ? "" : " ";
245
- return (0, printer_utils_1.rejectAndJoin)(" ", [
246
- ctx.While[0],
247
- (0, printer_utils_1.rejectAndJoin)(statementSeparator, [
248
- (0, printer_utils_1.putIntoBraces)(expression, softline, ctx.LBrace[0], ctx.RBrace[0]),
249
- statement
250
- ])
251
- ]);
252
- };
253
- BlocksAndStatementPrettierVisitor.prototype.doStatement = function (ctx) {
254
- var statement = this.visit(ctx.statement[0], {
255
- allowEmptyStatement: true
256
- });
257
- var statementSeparator = (0, printer_utils_1.isStatementEmptyStatement)(statement) ? "" : " ";
258
- var expression = this.visit(ctx.expression);
259
- return (0, printer_utils_1.rejectAndJoin)(" ", [
260
- (0, printer_utils_1.rejectAndJoin)(statementSeparator, [ctx.Do[0], statement]),
261
- ctx.While[0],
262
- (0, printer_utils_1.rejectAndConcat)([
263
- (0, printer_utils_1.putIntoBraces)(expression, softline, ctx.LBrace[0], ctx.RBrace[0]),
264
- ctx.Semicolon[0]
265
- ])
266
- ]);
267
- };
268
- BlocksAndStatementPrettierVisitor.prototype.forStatement = function (ctx) {
269
- return this.visitSingle(ctx);
270
- };
271
- BlocksAndStatementPrettierVisitor.prototype.basicForStatement = function (ctx) {
272
- var forInit = this.visit(ctx.forInit);
273
- var expression = this.visit(ctx.expression);
274
- var forUpdate = this.visit(ctx.forUpdate);
275
- var statement = this.visit(ctx.statement[0], {
276
- allowEmptyStatement: true
277
- });
278
- var statementSeparator = (0, printer_utils_1.isStatementEmptyStatement)(statement) ? "" : " ";
279
- return (0, printer_utils_1.rejectAndConcat)([
280
- (0, printer_utils_1.rejectAndJoin)(" ", [
281
- ctx.For[0],
282
- (0, printer_utils_1.putIntoBraces)((0, printer_utils_1.rejectAndConcat)([
283
- forInit,
284
- (0, printer_utils_1.rejectAndJoin)(line, [ctx.Semicolon[0], expression]),
285
- (0, printer_utils_1.rejectAndJoin)(line, [ctx.Semicolon[1], forUpdate])
286
- ]), softline, ctx.LBrace[0], ctx.RBrace[0])
287
- ]),
288
- statementSeparator,
289
- statement
290
- ]);
291
- };
292
- BlocksAndStatementPrettierVisitor.prototype.forInit = function (ctx) {
293
- return this.visitSingle(ctx);
294
- };
295
- BlocksAndStatementPrettierVisitor.prototype.forUpdate = function (ctx) {
296
- return this.visitSingle(ctx);
297
- };
298
- BlocksAndStatementPrettierVisitor.prototype.statementExpressionList = function (ctx) {
299
- var statementExpressions = this.mapVisit(ctx.statementExpression);
300
- var commas = ctx.Comma
301
- ? ctx.Comma.map(function (elt) {
302
- return (0, prettier_builder_1.concat)([(0, format_comments_1.printTokenWithComments)(elt), " "]);
303
- })
304
- : [];
305
- return (0, printer_utils_1.rejectAndJoinSeps)(commas, statementExpressions);
306
- };
307
- BlocksAndStatementPrettierVisitor.prototype.enhancedForStatement = function (ctx) {
308
- var variableModifiers = this.mapVisit(ctx.variableModifier);
309
- var localVariableType = this.visit(ctx.localVariableType);
310
- var variableDeclaratorId = this.visit(ctx.variableDeclaratorId);
311
- var expression = this.visit(ctx.expression);
312
- var statement = this.visit(ctx.statement[0], {
313
- allowEmptyStatement: true
314
- });
315
- var statementSeparator = (0, printer_utils_1.isStatementEmptyStatement)(statement) ? "" : " ";
316
- return (0, printer_utils_1.rejectAndConcat)([
317
- (0, printer_utils_1.rejectAndJoin)(" ", [ctx.For[0], ctx.LBrace[0]]),
318
- (0, printer_utils_1.rejectAndJoin)(" ", [
319
- (0, printer_utils_1.rejectAndJoin)(" ", variableModifiers),
320
- localVariableType,
321
- variableDeclaratorId
322
- ]),
323
- (0, prettier_builder_1.concat)([" ", ctx.Colon[0], " "]),
324
- expression,
325
- (0, prettier_builder_1.concat)([ctx.RBrace[0], statementSeparator]),
326
- statement
327
- ]);
328
- };
329
- BlocksAndStatementPrettierVisitor.prototype.breakStatement = function (ctx) {
330
- if (ctx.Identifier) {
331
- var identifier = ctx.Identifier[0];
332
- return (0, printer_utils_1.rejectAndConcat)([
333
- (0, prettier_builder_1.concat)([ctx.Break[0], " "]),
334
- identifier,
335
- ctx.Semicolon[0]
336
- ]);
337
- }
338
- return (0, prettier_builder_1.concat)([ctx.Break[0], ctx.Semicolon[0]]);
339
- };
340
- BlocksAndStatementPrettierVisitor.prototype.continueStatement = function (ctx) {
341
- if (ctx.Identifier) {
342
- var identifier = ctx.Identifier[0];
343
- return (0, printer_utils_1.rejectAndConcat)([
344
- (0, prettier_builder_1.concat)([ctx.Continue[0], " "]),
345
- identifier,
346
- ctx.Semicolon[0]
347
- ]);
348
- }
349
- return (0, printer_utils_1.rejectAndConcat)([ctx.Continue[0], ctx.Semicolon[0]]);
350
- };
351
- BlocksAndStatementPrettierVisitor.prototype.returnStatement = function (ctx) {
352
- if (ctx.expression) {
353
- var expression = this.visit(ctx.expression, {
354
- addParenthesisToWrapStatement: true
355
- });
356
- return (0, printer_utils_1.rejectAndConcat)([
357
- (0, prettier_builder_1.concat)([ctx.Return[0], " "]),
358
- expression,
359
- ctx.Semicolon[0]
360
- ]);
361
- }
362
- return (0, printer_utils_1.rejectAndConcat)([ctx.Return[0], ctx.Semicolon[0]]);
363
- };
364
- BlocksAndStatementPrettierVisitor.prototype.throwStatement = function (ctx) {
365
- var expression = this.visit(ctx.expression);
366
- return (0, printer_utils_1.rejectAndConcat)([
367
- (0, prettier_builder_1.concat)([ctx.Throw[0], " "]),
368
- expression,
369
- ctx.Semicolon[0]
370
- ]);
371
- };
372
- BlocksAndStatementPrettierVisitor.prototype.synchronizedStatement = function (ctx) {
373
- var expression = this.visit(ctx.expression);
374
- var block = this.visit(ctx.block);
375
- return (0, printer_utils_1.rejectAndConcat)([
376
- (0, prettier_builder_1.join)(" ", [
377
- ctx.Synchronized[0],
378
- (0, prettier_builder_1.concat)([
379
- (0, printer_utils_1.putIntoBraces)(expression, softline, ctx.LBrace[0], ctx.RBrace[0]),
380
- " "
381
- ])
382
- ]),
383
- block
384
- ]);
385
- };
386
- BlocksAndStatementPrettierVisitor.prototype.tryStatement = function (ctx) {
387
- if (ctx.tryWithResourcesStatement) {
388
- return this.visit(ctx.tryWithResourcesStatement);
389
- }
390
- var block = this.visit(ctx.block);
391
- var catches = this.visit(ctx.catches);
392
- var finallyBlock = this.visit(ctx.finally);
393
- return (0, printer_utils_1.rejectAndJoin)(" ", [ctx.Try[0], block, catches, finallyBlock]);
394
- };
395
- BlocksAndStatementPrettierVisitor.prototype.catches = function (ctx) {
396
- var catchClauses = this.mapVisit(ctx.catchClause);
397
- return (0, printer_utils_1.rejectAndJoin)(" ", catchClauses);
398
- };
399
- BlocksAndStatementPrettierVisitor.prototype.catchClause = function (ctx) {
400
- var catchFormalParameter = this.visit(ctx.catchFormalParameter);
401
- var block = this.visit(ctx.block);
402
- return (0, printer_utils_1.rejectAndConcat)([
403
- (0, prettier_builder_1.group)((0, printer_utils_1.rejectAndConcat)([
404
- (0, printer_utils_1.rejectAndJoin)(" ", [ctx.Catch[0], ctx.LBrace[0]]),
405
- (0, prettier_builder_1.indent)((0, printer_utils_1.rejectAndConcat)([softline, catchFormalParameter])),
406
- softline,
407
- (0, prettier_builder_1.concat)([ctx.RBrace[0], " "])
408
- ])),
409
- block
410
- ]);
411
- };
412
- BlocksAndStatementPrettierVisitor.prototype.catchFormalParameter = function (ctx) {
413
- var variableModifiers = this.mapVisit(ctx.variableModifier);
414
- var catchType = this.visit(ctx.catchType);
415
- var variableDeclaratorId = this.visit(ctx.variableDeclaratorId);
416
- return (0, printer_utils_1.rejectAndJoin)(" ", [
417
- (0, printer_utils_1.rejectAndJoin)(" ", variableModifiers),
418
- catchType,
419
- variableDeclaratorId
420
- ]);
421
- };
422
- BlocksAndStatementPrettierVisitor.prototype.catchType = function (ctx) {
423
- var unannClassType = this.visit(ctx.unannClassType);
424
- var classTypes = this.mapVisit(ctx.classType);
425
- var ors = ctx.Or ? ctx.Or.map(function (elt) { return (0, prettier_builder_1.concat)([line, elt, " "]); }) : [];
426
- return (0, prettier_builder_1.group)((0, printer_utils_1.rejectAndJoinSeps)(ors, __spreadArray([unannClassType], classTypes, true)));
427
- };
428
- BlocksAndStatementPrettierVisitor.prototype.finally = function (ctx) {
429
- var block = this.visit(ctx.block);
430
- return (0, printer_utils_1.rejectAndJoin)(" ", [ctx.Finally[0], block]);
431
- };
432
- BlocksAndStatementPrettierVisitor.prototype.tryWithResourcesStatement = function (ctx) {
433
- var resourceSpecification = this.visit(ctx.resourceSpecification);
434
- var block = this.visit(ctx.block);
435
- var catches = this.visit(ctx.catches);
436
- var finallyBlock = this.visit(ctx.finally);
437
- return (0, printer_utils_1.rejectAndJoin)(" ", [
438
- ctx.Try[0],
439
- resourceSpecification,
440
- block,
441
- catches,
442
- finallyBlock
443
- ]);
444
- };
445
- BlocksAndStatementPrettierVisitor.prototype.resourceSpecification = function (ctx) {
446
- var resourceList = this.visit(ctx.resourceList);
447
- var optionalSemicolon = ctx.Semicolon ? ctx.Semicolon[0] : "";
448
- return (0, printer_utils_1.putIntoBraces)((0, printer_utils_1.rejectAndConcat)([resourceList, optionalSemicolon]), softline, ctx.LBrace[0], ctx.RBrace[0]);
449
- };
450
- BlocksAndStatementPrettierVisitor.prototype.resourceList = function (ctx) {
451
- var resources = this.mapVisit(ctx.resource);
452
- var semicolons = ctx.Semicolon
453
- ? ctx.Semicolon.map(function (elt) {
454
- return (0, prettier_builder_1.concat)([elt, line]);
455
- })
456
- : [""];
457
- return (0, printer_utils_1.rejectAndJoinSeps)(semicolons, resources);
458
- };
459
- BlocksAndStatementPrettierVisitor.prototype.resource = function (ctx) {
460
- return this.visitSingle(ctx);
461
- };
462
- BlocksAndStatementPrettierVisitor.prototype.yieldStatement = function (ctx) {
463
- var expression = this.visit(ctx.expression);
464
- return (0, prettier_builder_1.join)(" ", [ctx.Yield[0], (0, prettier_builder_1.concat)([expression, ctx.Semicolon[0]])]);
465
- };
466
- BlocksAndStatementPrettierVisitor.prototype.variableAccess = function (ctx) {
467
- return this.visitSingle(ctx);
468
- };
469
- BlocksAndStatementPrettierVisitor.prototype.isBasicForStatement = function () {
470
- return "isBasicForStatement";
471
- };
472
- BlocksAndStatementPrettierVisitor.prototype.isLocalVariableDeclaration = function () {
473
- return "isLocalVariableDeclaration";
474
- };
475
- BlocksAndStatementPrettierVisitor.prototype.isClassicSwitchLabel = function () {
476
- return "isClassicSwitchLabel";
477
- };
478
- return BlocksAndStatementPrettierVisitor;
479
- }(base_cst_printer_1.BaseCstPrettierPrinter));
480
- exports.BlocksAndStatementPrettierVisitor = BlocksAndStatementPrettierVisitor;