@openrewrite/rewrite 8.96.5 → 8.97.0
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.
- package/dist/java/tree.d.ts +2 -1
- package/dist/java/tree.d.ts.map +1 -1
- package/dist/java/tree.js.map +1 -1
- package/dist/java/visitor.d.ts +5 -0
- package/dist/java/visitor.d.ts.map +1 -1
- package/dist/java/visitor.js +264 -231
- package/dist/java/visitor.js.map +1 -1
- package/dist/javascript/dependency-workspace.d.ts +8 -2
- package/dist/javascript/dependency-workspace.d.ts.map +1 -1
- package/dist/javascript/dependency-workspace.js +36 -4
- package/dist/javascript/dependency-workspace.js.map +1 -1
- package/dist/javascript/templating/engine.d.ts +1 -0
- package/dist/javascript/templating/engine.d.ts.map +1 -1
- package/dist/javascript/templating/engine.js +28 -4
- package/dist/javascript/templating/engine.js.map +1 -1
- package/dist/javascript/templating/placeholder-replacement.d.ts +2 -0
- package/dist/javascript/templating/placeholder-replacement.d.ts.map +1 -1
- package/dist/javascript/templating/placeholder-replacement.js +24 -3
- package/dist/javascript/templating/placeholder-replacement.js.map +1 -1
- package/dist/javascript/visitor.d.ts.map +1 -1
- package/dist/javascript/visitor.js +135 -121
- package/dist/javascript/visitor.js.map +1 -1
- package/dist/rewrite-javascript-version.txt +1 -1
- package/package.json +1 -1
- package/src/java/tree.ts +2 -1
- package/src/java/visitor.ts +263 -230
- package/src/javascript/dependency-workspace.ts +35 -3
- package/src/javascript/templating/engine.ts +30 -3
- package/src/javascript/templating/placeholder-replacement.ts +24 -3
- package/src/javascript/visitor.ts +139 -121
|
@@ -78,12 +78,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
78
78
|
}
|
|
79
79
|
alias = expression as JS.Alias;
|
|
80
80
|
|
|
81
|
-
const updates: any = {
|
|
81
|
+
const updates: any = await this.visitChildrenOf(alias, async () => ({
|
|
82
82
|
prefix: await this.visitSpace(alias.prefix, p),
|
|
83
83
|
markers: await this.visitMarkers(alias.markers, p),
|
|
84
84
|
propertyName: await this.visitRightPadded(alias.propertyName, p),
|
|
85
85
|
alias: await this.visitDefined<Expression>(alias.alias, p)
|
|
86
|
-
};
|
|
86
|
+
}));
|
|
87
87
|
return updateIfChanged(alias, updates);
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -100,7 +100,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
100
100
|
}
|
|
101
101
|
arrowFunction = statement as JS.ArrowFunction;
|
|
102
102
|
|
|
103
|
-
const updates: any = {
|
|
103
|
+
const updates: any = await this.visitChildrenOf(arrowFunction, async () => ({
|
|
104
104
|
prefix: await this.visitSpace(arrowFunction.prefix, p),
|
|
105
105
|
markers: await this.visitMarkers(arrowFunction.markers, p),
|
|
106
106
|
leadingAnnotations: await mapAsync(arrowFunction.leadingAnnotations, item => this.visitDefined<J.Annotation>(item, p)),
|
|
@@ -108,7 +108,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
108
108
|
typeParameters: arrowFunction.typeParameters && await this.visitDefined<J.TypeParameters>(arrowFunction.typeParameters, p),
|
|
109
109
|
lambda: await this.visitDefined<J.Lambda>(arrowFunction.lambda, p),
|
|
110
110
|
returnTypeExpression: arrowFunction.returnTypeExpression && await this.visitDefined<TypedTree>(arrowFunction.returnTypeExpression, p)
|
|
111
|
-
};
|
|
111
|
+
}));
|
|
112
112
|
return updateIfChanged(arrowFunction, updates);
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -119,13 +119,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
119
119
|
}
|
|
120
120
|
as_ = expression as JS.As;
|
|
121
121
|
|
|
122
|
-
const updates: any = {
|
|
122
|
+
const updates: any = await this.visitChildrenOf(as_, async () => ({
|
|
123
123
|
prefix: await this.visitSpace(as_.prefix, p),
|
|
124
124
|
markers: await this.visitMarkers(as_.markers, p),
|
|
125
125
|
left: await this.visitRightPadded<Expression>(as_.left, p),
|
|
126
126
|
right: await this.visitDefined<Expression>(as_.right, p),
|
|
127
127
|
type: as_.type && await this.visitType(as_.type, p)
|
|
128
|
-
};
|
|
128
|
+
}));
|
|
129
129
|
return updateIfChanged(as_, updates);
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -136,12 +136,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
136
136
|
}
|
|
137
137
|
await_ = expression as JS.Await;
|
|
138
138
|
|
|
139
|
-
const updates: any = {
|
|
139
|
+
const updates: any = await this.visitChildrenOf(await_, async () => ({
|
|
140
140
|
prefix: await this.visitSpace(await_.prefix, p),
|
|
141
141
|
markers: await this.visitMarkers(await_.markers, p),
|
|
142
142
|
expression: await this.visitDefined<Expression>(await_.expression, p),
|
|
143
143
|
type: await_.type && await this.visitType(await_.type, p)
|
|
144
|
-
};
|
|
144
|
+
}));
|
|
145
145
|
return updateIfChanged(await_, updates);
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -152,7 +152,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
152
152
|
}
|
|
153
153
|
element = expression as JSX.Tag;
|
|
154
154
|
|
|
155
|
-
const updates: any = {
|
|
155
|
+
const updates: any = await this.visitChildrenOf(element, async () => ({
|
|
156
156
|
prefix: await this.visitSpace(element.prefix, p),
|
|
157
157
|
markers: await this.visitMarkers(element.markers, p),
|
|
158
158
|
openName: await this.visitLeftPadded(element.openName, p),
|
|
@@ -163,7 +163,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
163
163
|
children: element.children && await mapAsync(element.children, child => this.visit(child, p)),
|
|
164
164
|
closingName: element.closingName && await this.visitLeftPadded(element.closingName, p),
|
|
165
165
|
afterClosingName: element.afterClosingName && await this.visitSpace(element.afterClosingName, p)
|
|
166
|
-
};
|
|
166
|
+
}));
|
|
167
167
|
return updateIfChanged(element, updates);
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -194,11 +194,11 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
194
194
|
}
|
|
195
195
|
expr = expression as JSX.EmbeddedExpression;
|
|
196
196
|
|
|
197
|
-
const updates: any = {
|
|
197
|
+
const updates: any = await this.visitChildrenOf(expr, async () => ({
|
|
198
198
|
prefix: await this.visitSpace(expr.prefix, p),
|
|
199
199
|
markers: await this.visitMarkers(expr.markers, p),
|
|
200
200
|
expression: await this.visitRightPadded(expr.expression, p)
|
|
201
|
-
};
|
|
201
|
+
}));
|
|
202
202
|
return updateIfChanged(expr, updates);
|
|
203
203
|
}
|
|
204
204
|
|
|
@@ -229,13 +229,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
229
229
|
}
|
|
230
230
|
conditionalType = expression as JS.ConditionalType;
|
|
231
231
|
|
|
232
|
-
const updates: any = {
|
|
232
|
+
const updates: any = await this.visitChildrenOf(conditionalType, async () => ({
|
|
233
233
|
prefix: await this.visitSpace(conditionalType.prefix, p),
|
|
234
234
|
markers: await this.visitMarkers(conditionalType.markers, p),
|
|
235
235
|
checkType: await this.visitDefined<Expression>(conditionalType.checkType, p),
|
|
236
236
|
condition: await this.visitLeftPadded(conditionalType.condition, p),
|
|
237
237
|
type: conditionalType.type && await this.visitType(conditionalType.type, p)
|
|
238
|
-
};
|
|
238
|
+
}));
|
|
239
239
|
return updateIfChanged(conditionalType, updates);
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -252,11 +252,11 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
252
252
|
}
|
|
253
253
|
delete_ = statement as JS.Delete;
|
|
254
254
|
|
|
255
|
-
const updates: any = {
|
|
255
|
+
const updates: any = await this.visitChildrenOf(delete_, async () => ({
|
|
256
256
|
prefix: await this.visitSpace(delete_.prefix, p),
|
|
257
257
|
markers: await this.visitMarkers(delete_.markers, p),
|
|
258
258
|
expression: await this.visitDefined<Expression>(delete_.expression, p)
|
|
259
|
-
};
|
|
259
|
+
}));
|
|
260
260
|
return updateIfChanged(delete_, updates);
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -273,15 +273,22 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
273
273
|
}
|
|
274
274
|
expressionStatement = statement as JS.ExpressionStatement;
|
|
275
275
|
|
|
276
|
-
const updates: any = {
|
|
276
|
+
const updates: any = await this.visitChildrenOf(expressionStatement, async () => ({
|
|
277
277
|
prefix: await this.visitSpace(expressionStatement.prefix, p),
|
|
278
278
|
markers: await this.visitMarkers(expressionStatement.markers, p),
|
|
279
279
|
expression: await this.visitDefined<Expression>(expressionStatement.expression, p)
|
|
280
|
-
};
|
|
281
|
-
// Outside a `for` head the parser makes a statement the statement itself, so a visit that makes one does too
|
|
282
|
-
|
|
280
|
+
}));
|
|
281
|
+
// Outside a `for` head the parser makes a statement the statement itself, so a visit that makes one does too,
|
|
282
|
+
// where the cursor shows what holds the expression statement
|
|
283
|
+
let visited: J | undefined = updates.expression;
|
|
284
|
+
const parent = this.cursor.parentTree()?.value;
|
|
283
285
|
if (visited && visited !== expressionStatement.expression && isStatement(visited) &&
|
|
284
|
-
|
|
286
|
+
parent && parent.kind !== J.Kind.ForLoopControl) {
|
|
287
|
+
// and it holds a statement that is no expression in a JS.StatementExpression only when it is a `yield`
|
|
288
|
+
const held = visited.kind === JS.Kind.StatementExpression ? (visited as JS.StatementExpression).statement : undefined;
|
|
289
|
+
if (held && held.kind !== J.Kind.Yield) {
|
|
290
|
+
visited = {...held, prefix: concatenated(visited.prefix, held.prefix), markers: withOuterMarkers(visited.markers, held.markers)};
|
|
291
|
+
}
|
|
285
292
|
return {
|
|
286
293
|
...visited,
|
|
287
294
|
prefix: concatenated(updates.prefix, visited.prefix),
|
|
@@ -298,13 +305,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
298
305
|
}
|
|
299
306
|
expressionWithTypeArguments = expression as JS.ExpressionWithTypeArguments;
|
|
300
307
|
|
|
301
|
-
const updates: any = {
|
|
308
|
+
const updates: any = await this.visitChildrenOf(expressionWithTypeArguments, async () => ({
|
|
302
309
|
prefix: await this.visitSpace(expressionWithTypeArguments.prefix, p),
|
|
303
310
|
markers: await this.visitMarkers(expressionWithTypeArguments.markers, p),
|
|
304
311
|
clazz: await this.visitDefined<J>(expressionWithTypeArguments.clazz, p),
|
|
305
312
|
typeArguments: expressionWithTypeArguments.typeArguments && await this.visitContainer(expressionWithTypeArguments.typeArguments, p),
|
|
306
313
|
type: expressionWithTypeArguments.type && await this.visitType(expressionWithTypeArguments.type, p)
|
|
307
|
-
};
|
|
314
|
+
}));
|
|
308
315
|
return updateIfChanged(expressionWithTypeArguments, updates);
|
|
309
316
|
}
|
|
310
317
|
|
|
@@ -321,14 +328,14 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
321
328
|
}
|
|
322
329
|
functionCall = statement as JS.FunctionCall;
|
|
323
330
|
|
|
324
|
-
const updates: any = {
|
|
331
|
+
const updates: any = await this.visitChildrenOf(functionCall, async () => ({
|
|
325
332
|
prefix: await this.visitSpace(functionCall.prefix, p),
|
|
326
333
|
markers: await this.visitMarkers(functionCall.markers, p),
|
|
327
334
|
function: await this.visitOptionalRightPadded(functionCall.function, p),
|
|
328
335
|
typeParameters: await this.visitOptionalContainer(functionCall.typeParameters, p),
|
|
329
336
|
arguments: await this.visitContainer(functionCall.arguments, p),
|
|
330
337
|
methodType: await this.visitType(functionCall.methodType, p) as Type.Method | undefined
|
|
331
|
-
};
|
|
338
|
+
}));
|
|
332
339
|
return updateIfChanged(functionCall, updates);
|
|
333
340
|
}
|
|
334
341
|
|
|
@@ -339,7 +346,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
339
346
|
}
|
|
340
347
|
functionType = expression as JS.FunctionType;
|
|
341
348
|
|
|
342
|
-
const updates: any = {
|
|
349
|
+
const updates: any = await this.visitChildrenOf(functionType, async () => ({
|
|
343
350
|
prefix: await this.visitSpace(functionType.prefix, p),
|
|
344
351
|
markers: await this.visitMarkers(functionType.markers, p),
|
|
345
352
|
modifiers: await mapAsync(functionType.modifiers, item => this.visitDefined<J.Modifier>(item, p)),
|
|
@@ -347,7 +354,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
347
354
|
typeParameters: functionType.typeParameters && await this.visitDefined<J.TypeParameters>(functionType.typeParameters, p),
|
|
348
355
|
parameters: await this.visitContainer(functionType.parameters, p),
|
|
349
356
|
returnType: await this.visitLeftPadded(functionType.returnType, p)
|
|
350
|
-
};
|
|
357
|
+
}));
|
|
351
358
|
return updateIfChanged(functionType, updates);
|
|
352
359
|
}
|
|
353
360
|
|
|
@@ -358,12 +365,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
358
365
|
}
|
|
359
366
|
inferType = expression as JS.InferType;
|
|
360
367
|
|
|
361
|
-
const updates: any = {
|
|
368
|
+
const updates: any = await this.visitChildrenOf(inferType, async () => ({
|
|
362
369
|
prefix: await this.visitSpace(inferType.prefix, p),
|
|
363
370
|
markers: await this.visitMarkers(inferType.markers, p),
|
|
364
371
|
typeParameter: await this.visitLeftPadded(inferType.typeParameter, p),
|
|
365
372
|
type: inferType.type && await this.visitType(inferType.type, p)
|
|
366
|
-
};
|
|
373
|
+
}));
|
|
367
374
|
return updateIfChanged(inferType, updates);
|
|
368
375
|
}
|
|
369
376
|
|
|
@@ -374,7 +381,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
374
381
|
}
|
|
375
382
|
importType = expression as JS.ImportType;
|
|
376
383
|
|
|
377
|
-
const updates: any = {
|
|
384
|
+
const updates: any = await this.visitChildrenOf(importType, async () => ({
|
|
378
385
|
prefix: await this.visitSpace(importType.prefix, p),
|
|
379
386
|
markers: await this.visitMarkers(importType.markers, p),
|
|
380
387
|
hasTypeof: await this.visitRightPadded(importType.hasTypeof, p),
|
|
@@ -382,7 +389,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
382
389
|
qualifier: importType.qualifier && await this.visitLeftPadded(importType.qualifier, p),
|
|
383
390
|
typeArguments: importType.typeArguments && await this.visitContainer(importType.typeArguments, p),
|
|
384
391
|
type: importType.type && await this.visitType(importType.type, p)
|
|
385
|
-
};
|
|
392
|
+
}));
|
|
386
393
|
return updateIfChanged(importType, updates);
|
|
387
394
|
}
|
|
388
395
|
|
|
@@ -393,7 +400,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
393
400
|
}
|
|
394
401
|
jsImport = statement as JS.Import;
|
|
395
402
|
|
|
396
|
-
const updates: any = {
|
|
403
|
+
const updates: any = await this.visitChildrenOf(jsImport, async () => ({
|
|
397
404
|
prefix: await this.visitSpace(jsImport.prefix, p),
|
|
398
405
|
markers: await this.visitMarkers(jsImport.markers, p),
|
|
399
406
|
modifiers: await mapAsync(jsImport.modifiers, item => this.visitDefined<J.Modifier>(item, p)),
|
|
@@ -401,7 +408,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
401
408
|
moduleSpecifier: jsImport.moduleSpecifier && await this.visitLeftPadded(jsImport.moduleSpecifier, p),
|
|
402
409
|
attributes: jsImport.attributes && await this.visitDefined<JS.ImportAttributes>(jsImport.attributes, p),
|
|
403
410
|
initializer: jsImport.initializer && await this.visitLeftPadded(jsImport.initializer, p)
|
|
404
|
-
};
|
|
411
|
+
}));
|
|
405
412
|
return updateIfChanged(jsImport, updates);
|
|
406
413
|
}
|
|
407
414
|
|
|
@@ -422,12 +429,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
422
429
|
}
|
|
423
430
|
namedImports = expression as JS.NamedImports;
|
|
424
431
|
|
|
425
|
-
const updates: any = {
|
|
432
|
+
const updates: any = await this.visitChildrenOf(namedImports, async () => ({
|
|
426
433
|
prefix: await this.visitSpace(namedImports.prefix, p),
|
|
427
434
|
markers: await this.visitMarkers(namedImports.markers, p),
|
|
428
435
|
elements: await this.visitContainer(namedImports.elements, p),
|
|
429
436
|
type: namedImports.type && await this.visitType(namedImports.type, p)
|
|
430
|
-
};
|
|
437
|
+
}));
|
|
431
438
|
return updateIfChanged(namedImports, updates);
|
|
432
439
|
}
|
|
433
440
|
|
|
@@ -438,13 +445,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
438
445
|
}
|
|
439
446
|
importSpecifier = expression as JS.ImportSpecifier;
|
|
440
447
|
|
|
441
|
-
const updates: any = {
|
|
448
|
+
const updates: any = await this.visitChildrenOf(importSpecifier, async () => ({
|
|
442
449
|
prefix: await this.visitSpace(importSpecifier.prefix, p),
|
|
443
450
|
markers: await this.visitMarkers(importSpecifier.markers, p),
|
|
444
451
|
importType: await this.visitLeftPadded(importSpecifier.importType, p),
|
|
445
452
|
specifier: await this.visitDefined<JS.Alias | J.Identifier>(importSpecifier.specifier, p),
|
|
446
453
|
type: importSpecifier.type && await this.visitType(importSpecifier.type, p)
|
|
447
|
-
};
|
|
454
|
+
}));
|
|
448
455
|
return updateIfChanged(importSpecifier, updates);
|
|
449
456
|
}
|
|
450
457
|
|
|
@@ -475,12 +482,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
475
482
|
}
|
|
476
483
|
importAttribute = statement as JS.ImportAttribute;
|
|
477
484
|
|
|
478
|
-
const updates: any = {
|
|
485
|
+
const updates: any = await this.visitChildrenOf(importAttribute, async () => ({
|
|
479
486
|
prefix: await this.visitSpace(importAttribute.prefix, p),
|
|
480
487
|
markers: await this.visitMarkers(importAttribute.markers, p),
|
|
481
488
|
name: await this.visitDefined<Expression>(importAttribute.name, p),
|
|
482
489
|
value: await this.visitLeftPadded(importAttribute.value, p)
|
|
483
|
-
};
|
|
490
|
+
}));
|
|
484
491
|
return updateIfChanged(importAttribute, updates);
|
|
485
492
|
}
|
|
486
493
|
|
|
@@ -491,14 +498,14 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
491
498
|
}
|
|
492
499
|
jsBinary = expression as JS.Binary;
|
|
493
500
|
|
|
494
|
-
const updates: any = {
|
|
501
|
+
const updates: any = await this.visitChildrenOf(jsBinary, async () => ({
|
|
495
502
|
prefix: await this.visitSpace(jsBinary.prefix, p),
|
|
496
503
|
markers: await this.visitMarkers(jsBinary.markers, p),
|
|
497
504
|
left: await this.visitDefined<Expression>(jsBinary.left, p),
|
|
498
505
|
operator: await this.visitLeftPadded(jsBinary.operator, p),
|
|
499
506
|
right: await this.visitDefined<Expression>(jsBinary.right, p),
|
|
500
507
|
type: jsBinary.type && await this.visitType(jsBinary.type, p)
|
|
501
|
-
};
|
|
508
|
+
}));
|
|
502
509
|
return updateIfChanged(jsBinary, updates);
|
|
503
510
|
}
|
|
504
511
|
|
|
@@ -509,12 +516,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
509
516
|
}
|
|
510
517
|
literalType = expression as JS.LiteralType;
|
|
511
518
|
|
|
512
|
-
const updates: any = {
|
|
519
|
+
const updates: any = await this.visitChildrenOf(literalType, async () => ({
|
|
513
520
|
prefix: await this.visitSpace(literalType.prefix, p),
|
|
514
521
|
markers: await this.visitMarkers(literalType.markers, p),
|
|
515
522
|
literal: await this.visitDefined<Expression>(literalType.literal, p),
|
|
516
523
|
type: (await this.visitType(literalType.type, p))!
|
|
517
|
-
};
|
|
524
|
+
}));
|
|
518
525
|
return updateIfChanged(literalType, updates);
|
|
519
526
|
}
|
|
520
527
|
|
|
@@ -525,7 +532,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
525
532
|
}
|
|
526
533
|
mappedType = expression as JS.MappedType;
|
|
527
534
|
|
|
528
|
-
const updates: any = {
|
|
535
|
+
const updates: any = await this.visitChildrenOf(mappedType, async () => ({
|
|
529
536
|
prefix: await this.visitSpace(mappedType.prefix, p),
|
|
530
537
|
markers: await this.visitMarkers(mappedType.markers, p),
|
|
531
538
|
prefixToken: mappedType.prefixToken && await this.visitLeftPadded(mappedType.prefixToken, p),
|
|
@@ -535,7 +542,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
535
542
|
hasQuestionToken: await this.visitLeftPadded(mappedType.hasQuestionToken, p),
|
|
536
543
|
valueType: await this.visitContainer(mappedType.valueType, p),
|
|
537
544
|
type: mappedType.type && await this.visitType(mappedType.type, p)
|
|
538
|
-
};
|
|
545
|
+
}));
|
|
539
546
|
return updateIfChanged(mappedType, updates);
|
|
540
547
|
}
|
|
541
548
|
|
|
@@ -546,12 +553,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
546
553
|
}
|
|
547
554
|
keysRemapping = statement as JS.MappedType.KeysRemapping;
|
|
548
555
|
|
|
549
|
-
const updates: any = {
|
|
556
|
+
const updates: any = await this.visitChildrenOf(keysRemapping, async () => ({
|
|
550
557
|
prefix: await this.visitSpace(keysRemapping.prefix, p),
|
|
551
558
|
markers: await this.visitMarkers(keysRemapping.markers, p),
|
|
552
559
|
typeParameter: await this.visitRightPadded(keysRemapping.typeParameter, p),
|
|
553
560
|
nameType: keysRemapping.nameType && await this.visitRightPadded(keysRemapping.nameType, p)
|
|
554
|
-
};
|
|
561
|
+
}));
|
|
555
562
|
return updateIfChanged(keysRemapping, updates);
|
|
556
563
|
}
|
|
557
564
|
|
|
@@ -562,12 +569,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
562
569
|
}
|
|
563
570
|
mappedTypeParameter = statement as JS.MappedType.Parameter;
|
|
564
571
|
|
|
565
|
-
const updates: any = {
|
|
572
|
+
const updates: any = await this.visitChildrenOf(mappedTypeParameter, async () => ({
|
|
566
573
|
prefix: await this.visitSpace(mappedTypeParameter.prefix, p),
|
|
567
574
|
markers: await this.visitMarkers(mappedTypeParameter.markers, p),
|
|
568
575
|
name: await this.visitDefined<Expression>(mappedTypeParameter.name, p),
|
|
569
576
|
iterateType: await this.visitLeftPadded(mappedTypeParameter.iterateType, p)
|
|
570
|
-
};
|
|
577
|
+
}));
|
|
571
578
|
return updateIfChanged(mappedTypeParameter, updates);
|
|
572
579
|
}
|
|
573
580
|
|
|
@@ -578,7 +585,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
578
585
|
}
|
|
579
586
|
objectBindingPattern = expression as JS.ObjectBindingPattern;
|
|
580
587
|
|
|
581
|
-
const updates: any = {
|
|
588
|
+
const updates: any = await this.visitChildrenOf(objectBindingPattern, async () => ({
|
|
582
589
|
prefix: await this.visitSpace(objectBindingPattern.prefix, p),
|
|
583
590
|
markers: await this.visitMarkers(objectBindingPattern.markers, p),
|
|
584
591
|
leadingAnnotations: await mapAsync(objectBindingPattern.leadingAnnotations, item => this.visitDefined<J.Annotation>(item, p)),
|
|
@@ -586,7 +593,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
586
593
|
typeExpression: objectBindingPattern.typeExpression && await this.visitDefined<TypedTree>(objectBindingPattern.typeExpression, p),
|
|
587
594
|
bindings: await this.visitContainer(objectBindingPattern.bindings, p),
|
|
588
595
|
initializer: objectBindingPattern.initializer && await this.visitLeftPadded(objectBindingPattern.initializer, p)
|
|
589
|
-
};
|
|
596
|
+
}));
|
|
590
597
|
return updateIfChanged(objectBindingPattern, updates);
|
|
591
598
|
}
|
|
592
599
|
|
|
@@ -597,13 +604,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
597
604
|
}
|
|
598
605
|
propertyAssignment = statement as JS.PropertyAssignment;
|
|
599
606
|
|
|
600
|
-
const updates: any = {
|
|
607
|
+
const updates: any = await this.visitChildrenOf(propertyAssignment, async () => ({
|
|
601
608
|
prefix: await this.visitSpace(propertyAssignment.prefix, p),
|
|
602
609
|
markers: await this.visitMarkers(propertyAssignment.markers, p),
|
|
603
610
|
modifiers: await mapAsync(propertyAssignment.modifiers, m => this.visitDefined<J.Modifier>(m, p)),
|
|
604
611
|
name: await this.visitRightPadded(propertyAssignment.name, p),
|
|
605
612
|
initializer: propertyAssignment.initializer && await this.visitDefined<Expression>(propertyAssignment.initializer, p)
|
|
606
|
-
};
|
|
613
|
+
}));
|
|
607
614
|
return updateIfChanged(propertyAssignment, updates);
|
|
608
615
|
}
|
|
609
616
|
|
|
@@ -614,13 +621,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
614
621
|
}
|
|
615
622
|
satisfiesExpression = expression as JS.SatisfiesExpression;
|
|
616
623
|
|
|
617
|
-
const updates: any = {
|
|
624
|
+
const updates: any = await this.visitChildrenOf(satisfiesExpression, async () => ({
|
|
618
625
|
prefix: await this.visitSpace(satisfiesExpression.prefix, p),
|
|
619
626
|
markers: await this.visitMarkers(satisfiesExpression.markers, p),
|
|
620
627
|
expression: await this.visitDefined<J>(satisfiesExpression.expression, p),
|
|
621
628
|
satisfiesType: await this.visitLeftPadded(satisfiesExpression.satisfiesType, p),
|
|
622
629
|
type: satisfiesExpression.type && await this.visitType(satisfiesExpression.type, p)
|
|
623
|
-
};
|
|
630
|
+
}));
|
|
624
631
|
return updateIfChanged(satisfiesExpression, updates);
|
|
625
632
|
}
|
|
626
633
|
|
|
@@ -631,12 +638,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
631
638
|
}
|
|
632
639
|
scopedVariableDeclarations = statement as JS.ScopedVariableDeclarations;
|
|
633
640
|
|
|
634
|
-
const updates: any = {
|
|
641
|
+
const updates: any = await this.visitChildrenOf(scopedVariableDeclarations, async () => ({
|
|
635
642
|
prefix: await this.visitSpace(scopedVariableDeclarations.prefix, p),
|
|
636
643
|
markers: await this.visitMarkers(scopedVariableDeclarations.markers, p),
|
|
637
644
|
modifiers: await mapAsync(scopedVariableDeclarations.modifiers, item => this.visitDefined<J.Modifier>(item, p)),
|
|
638
645
|
variables: await mapAsync(scopedVariableDeclarations.variables, item => this.visitRightPadded(item, p))
|
|
639
|
-
};
|
|
646
|
+
}));
|
|
640
647
|
return updateIfChanged(scopedVariableDeclarations, updates);
|
|
641
648
|
}
|
|
642
649
|
|
|
@@ -661,12 +668,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
661
668
|
}
|
|
662
669
|
spread = statement as JS.Spread;
|
|
663
670
|
|
|
664
|
-
const updates: any = {
|
|
671
|
+
const updates: any = await this.visitChildrenOf(spread, async () => ({
|
|
665
672
|
prefix: await this.visitSpace(spread.prefix, p),
|
|
666
673
|
markers: await this.visitMarkers(spread.markers, p),
|
|
667
674
|
expression: await this.visitDefined<Expression>(spread.expression, p),
|
|
668
675
|
type: await this.visitType(spread.type, p)
|
|
669
|
-
};
|
|
676
|
+
}));
|
|
670
677
|
return updateIfChanged(spread, updates);
|
|
671
678
|
}
|
|
672
679
|
|
|
@@ -683,11 +690,11 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
683
690
|
}
|
|
684
691
|
statementExpression = statement as JS.StatementExpression;
|
|
685
692
|
|
|
686
|
-
const updates: any = {
|
|
693
|
+
const updates: any = await this.visitChildrenOf(statementExpression, async () => ({
|
|
687
694
|
prefix: await this.visitSpace(statementExpression.prefix, p),
|
|
688
695
|
markers: await this.visitMarkers(statementExpression.markers, p),
|
|
689
696
|
statement: await this.visitDefined<Statement>(statementExpression.statement, p)
|
|
690
|
-
};
|
|
697
|
+
}));
|
|
691
698
|
return updateIfChanged(statementExpression, updates);
|
|
692
699
|
}
|
|
693
700
|
|
|
@@ -704,14 +711,14 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
704
711
|
}
|
|
705
712
|
taggedTemplateExpression = statement as JS.TaggedTemplateExpression;
|
|
706
713
|
|
|
707
|
-
const updates: any = {
|
|
714
|
+
const updates: any = await this.visitChildrenOf(taggedTemplateExpression, async () => ({
|
|
708
715
|
prefix: await this.visitSpace(taggedTemplateExpression.prefix, p),
|
|
709
716
|
markers: await this.visitMarkers(taggedTemplateExpression.markers, p),
|
|
710
717
|
tag: taggedTemplateExpression.tag && await this.visitRightPadded(taggedTemplateExpression.tag, p),
|
|
711
718
|
typeArguments: taggedTemplateExpression.typeArguments && await this.visitContainer(taggedTemplateExpression.typeArguments, p),
|
|
712
719
|
templateExpression: await this.visitDefined<Expression>(taggedTemplateExpression.templateExpression, p),
|
|
713
720
|
type: taggedTemplateExpression.type && await this.visitType(taggedTemplateExpression.type, p)
|
|
714
|
-
};
|
|
721
|
+
}));
|
|
715
722
|
return updateIfChanged(taggedTemplateExpression, updates);
|
|
716
723
|
}
|
|
717
724
|
|
|
@@ -728,13 +735,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
728
735
|
}
|
|
729
736
|
templateExpression = statement as JS.TemplateExpression;
|
|
730
737
|
|
|
731
|
-
const updates: any = {
|
|
738
|
+
const updates: any = await this.visitChildrenOf(templateExpression, async () => ({
|
|
732
739
|
prefix: await this.visitSpace(templateExpression.prefix, p),
|
|
733
740
|
markers: await this.visitMarkers(templateExpression.markers, p),
|
|
734
741
|
head: await this.visitDefined<J.Literal>(templateExpression.head, p),
|
|
735
742
|
spans: await mapAsync(templateExpression.spans, item => this.visitRightPadded(item, p)),
|
|
736
743
|
type: templateExpression.type && await this.visitType(templateExpression.type, p)
|
|
737
|
-
};
|
|
744
|
+
}));
|
|
738
745
|
return updateIfChanged(templateExpression, updates);
|
|
739
746
|
}
|
|
740
747
|
|
|
@@ -755,12 +762,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
755
762
|
}
|
|
756
763
|
tuple = expression as JS.Tuple;
|
|
757
764
|
|
|
758
|
-
const updates: any = {
|
|
765
|
+
const updates: any = await this.visitChildrenOf(tuple, async () => ({
|
|
759
766
|
prefix: await this.visitSpace(tuple.prefix, p),
|
|
760
767
|
markers: await this.visitMarkers(tuple.markers, p),
|
|
761
768
|
elements: await this.visitContainer(tuple.elements, p),
|
|
762
769
|
type: tuple.type && await this.visitType(tuple.type, p)
|
|
763
|
-
};
|
|
770
|
+
}));
|
|
764
771
|
return updateIfChanged(tuple, updates);
|
|
765
772
|
}
|
|
766
773
|
|
|
@@ -771,7 +778,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
771
778
|
}
|
|
772
779
|
typeDeclaration = statement as JS.TypeDeclaration;
|
|
773
780
|
|
|
774
|
-
const updates: any = {
|
|
781
|
+
const updates: any = await this.visitChildrenOf(typeDeclaration, async () => ({
|
|
775
782
|
prefix: await this.visitSpace(typeDeclaration.prefix, p),
|
|
776
783
|
markers: await this.visitMarkers(typeDeclaration.markers, p),
|
|
777
784
|
modifiers: await mapAsync(typeDeclaration.modifiers, item => this.visitDefined<J.Modifier>(item, p)),
|
|
@@ -779,7 +786,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
779
786
|
typeParameters: typeDeclaration.typeParameters && await this.visitDefined<J.TypeParameters>(typeDeclaration.typeParameters, p),
|
|
780
787
|
initializer: await this.visitLeftPadded(typeDeclaration.initializer, p),
|
|
781
788
|
type: typeDeclaration.type && await this.visitType(typeDeclaration.type, p)
|
|
782
|
-
};
|
|
789
|
+
}));
|
|
783
790
|
return updateIfChanged(typeDeclaration, updates);
|
|
784
791
|
}
|
|
785
792
|
|
|
@@ -790,12 +797,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
790
797
|
}
|
|
791
798
|
typeOf = expression as JS.TypeOf;
|
|
792
799
|
|
|
793
|
-
const updates: any = {
|
|
800
|
+
const updates: any = await this.visitChildrenOf(typeOf, async () => ({
|
|
794
801
|
prefix: await this.visitSpace(typeOf.prefix, p),
|
|
795
802
|
markers: await this.visitMarkers(typeOf.markers, p),
|
|
796
803
|
expression: await this.visitDefined<Expression>(typeOf.expression, p),
|
|
797
804
|
type: typeOf.type && await this.visitType(typeOf.type, p)
|
|
798
|
-
};
|
|
805
|
+
}));
|
|
799
806
|
return updateIfChanged(typeOf, updates);
|
|
800
807
|
}
|
|
801
808
|
|
|
@@ -806,11 +813,22 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
806
813
|
}
|
|
807
814
|
typeTreeExpression = expression as JS.TypeTreeExpression;
|
|
808
815
|
|
|
809
|
-
const updates: any = {
|
|
816
|
+
const updates: any = await this.visitChildrenOf(typeTreeExpression, async () => ({
|
|
810
817
|
prefix: await this.visitSpace(typeTreeExpression.prefix, p),
|
|
811
818
|
markers: await this.visitMarkers(typeTreeExpression.markers, p),
|
|
812
819
|
expression: await this.visitDefined<Expression>(typeTreeExpression.expression, p)
|
|
813
|
-
};
|
|
820
|
+
}));
|
|
821
|
+
// The parser wraps no type tree, so a visit that makes the expression one drops the wrapper
|
|
822
|
+
const visited: J = updates.expression;
|
|
823
|
+
if (visited !== typeTreeExpression.expression && (visited.kind === J.Kind.Identifier ||
|
|
824
|
+
visited.kind === J.Kind.FieldAccess || visited.kind === J.Kind.ArrayType ||
|
|
825
|
+
visited.kind === J.Kind.ParameterizedType)) {
|
|
826
|
+
return {
|
|
827
|
+
...visited,
|
|
828
|
+
prefix: concatenated(updates.prefix, visited.prefix),
|
|
829
|
+
markers: withOuterMarkers(updates.markers, visited.markers)
|
|
830
|
+
};
|
|
831
|
+
}
|
|
814
832
|
return updateIfChanged(typeTreeExpression, updates);
|
|
815
833
|
}
|
|
816
834
|
|
|
@@ -827,14 +845,14 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
827
845
|
}
|
|
828
846
|
assignmentOperation = statement as JS.AssignmentOperation;
|
|
829
847
|
|
|
830
|
-
const updates: any = {
|
|
848
|
+
const updates: any = await this.visitChildrenOf(assignmentOperation, async () => ({
|
|
831
849
|
prefix: await this.visitSpace(assignmentOperation.prefix, p),
|
|
832
850
|
markers: await this.visitMarkers(assignmentOperation.markers, p),
|
|
833
851
|
variable: await this.visitDefined<Expression>(assignmentOperation.variable, p),
|
|
834
852
|
operator: await this.visitLeftPadded(assignmentOperation.operator, p),
|
|
835
853
|
assignment: await this.visitDefined<Expression>(assignmentOperation.assignment, p),
|
|
836
854
|
type: assignmentOperation.type && await this.visitType(assignmentOperation.type, p)
|
|
837
|
-
};
|
|
855
|
+
}));
|
|
838
856
|
return updateIfChanged(assignmentOperation, updates);
|
|
839
857
|
}
|
|
840
858
|
|
|
@@ -845,13 +863,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
845
863
|
}
|
|
846
864
|
indexedAccessType = expression as JS.IndexedAccessType;
|
|
847
865
|
|
|
848
|
-
const updates: any = {
|
|
866
|
+
const updates: any = await this.visitChildrenOf(indexedAccessType, async () => ({
|
|
849
867
|
prefix: await this.visitSpace(indexedAccessType.prefix, p),
|
|
850
868
|
markers: await this.visitMarkers(indexedAccessType.markers, p),
|
|
851
869
|
objectType: await this.visitDefined<TypedTree>(indexedAccessType.objectType, p),
|
|
852
870
|
indexType: await this.visitDefined<TypedTree>(indexedAccessType.indexType, p),
|
|
853
871
|
type: indexedAccessType.type && await this.visitType(indexedAccessType.type, p)
|
|
854
|
-
};
|
|
872
|
+
}));
|
|
855
873
|
return updateIfChanged(indexedAccessType, updates);
|
|
856
874
|
}
|
|
857
875
|
|
|
@@ -862,12 +880,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
862
880
|
}
|
|
863
881
|
indexType = expression as JS.IndexedAccessType.IndexType;
|
|
864
882
|
|
|
865
|
-
const updates: any = {
|
|
883
|
+
const updates: any = await this.visitChildrenOf(indexType, async () => ({
|
|
866
884
|
prefix: await this.visitSpace(indexType.prefix, p),
|
|
867
885
|
markers: await this.visitMarkers(indexType.markers, p),
|
|
868
886
|
element: await this.visitRightPadded(indexType.element, p),
|
|
869
887
|
type: indexType.type && await this.visitType(indexType.type, p)
|
|
870
|
-
};
|
|
888
|
+
}));
|
|
871
889
|
return updateIfChanged(indexType, updates);
|
|
872
890
|
}
|
|
873
891
|
|
|
@@ -878,13 +896,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
878
896
|
}
|
|
879
897
|
typeQuery = expression as JS.TypeQuery;
|
|
880
898
|
|
|
881
|
-
const updates: any = {
|
|
899
|
+
const updates: any = await this.visitChildrenOf(typeQuery, async () => ({
|
|
882
900
|
prefix: await this.visitSpace(typeQuery.prefix, p),
|
|
883
901
|
markers: await this.visitMarkers(typeQuery.markers, p),
|
|
884
902
|
typeExpression: await this.visitDefined<TypedTree>(typeQuery.typeExpression, p),
|
|
885
903
|
typeArguments: typeQuery.typeArguments && await this.visitContainer(typeQuery.typeArguments, p),
|
|
886
904
|
type: typeQuery.type && await this.visitType(typeQuery.type, p)
|
|
887
|
-
};
|
|
905
|
+
}));
|
|
888
906
|
return updateIfChanged(typeQuery, updates);
|
|
889
907
|
}
|
|
890
908
|
|
|
@@ -895,11 +913,11 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
895
913
|
}
|
|
896
914
|
typeInfo = expression as JS.TypeInfo;
|
|
897
915
|
|
|
898
|
-
const updates: any = {
|
|
916
|
+
const updates: any = await this.visitChildrenOf(typeInfo, async () => ({
|
|
899
917
|
prefix: await this.visitSpace(typeInfo.prefix, p),
|
|
900
918
|
markers: await this.visitMarkers(typeInfo.markers, p),
|
|
901
919
|
typeIdentifier: await this.visitDefined<TypedTree>(typeInfo.typeIdentifier, p)
|
|
902
|
-
};
|
|
920
|
+
}));
|
|
903
921
|
return updateIfChanged(typeInfo, updates);
|
|
904
922
|
}
|
|
905
923
|
|
|
@@ -910,11 +928,11 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
910
928
|
}
|
|
911
929
|
computedPropertyName = expression as JS.ComputedPropertyName;
|
|
912
930
|
|
|
913
|
-
const updates: any = {
|
|
931
|
+
const updates: any = await this.visitChildrenOf(computedPropertyName, async () => ({
|
|
914
932
|
prefix: await this.visitSpace(computedPropertyName.prefix, p),
|
|
915
933
|
markers: await this.visitMarkers(computedPropertyName.markers, p),
|
|
916
934
|
expression: await this.visitRightPadded(computedPropertyName.expression, p)
|
|
917
|
-
};
|
|
935
|
+
}));
|
|
918
936
|
return updateIfChanged(computedPropertyName, updates);
|
|
919
937
|
}
|
|
920
938
|
|
|
@@ -925,11 +943,11 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
925
943
|
}
|
|
926
944
|
typeOperator = expression as JS.TypeOperator;
|
|
927
945
|
|
|
928
|
-
const updates: any = {
|
|
946
|
+
const updates: any = await this.visitChildrenOf(typeOperator, async () => ({
|
|
929
947
|
prefix: await this.visitSpace(typeOperator.prefix, p),
|
|
930
948
|
markers: await this.visitMarkers(typeOperator.markers, p),
|
|
931
949
|
expression: await this.visitLeftPadded(typeOperator.expression, p)
|
|
932
|
-
};
|
|
950
|
+
}));
|
|
933
951
|
return updateIfChanged(typeOperator, updates);
|
|
934
952
|
}
|
|
935
953
|
|
|
@@ -940,14 +958,14 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
940
958
|
}
|
|
941
959
|
typePredicate = expression as JS.TypePredicate;
|
|
942
960
|
|
|
943
|
-
const updates: any = {
|
|
961
|
+
const updates: any = await this.visitChildrenOf(typePredicate, async () => ({
|
|
944
962
|
prefix: await this.visitSpace(typePredicate.prefix, p),
|
|
945
963
|
markers: await this.visitMarkers(typePredicate.markers, p),
|
|
946
964
|
asserts: await this.visitLeftPadded(typePredicate.asserts, p),
|
|
947
965
|
parameterName: await this.visitDefined<J.Identifier>(typePredicate.parameterName, p),
|
|
948
966
|
expression: typePredicate.expression && await this.visitLeftPadded(typePredicate.expression, p),
|
|
949
967
|
type: typePredicate.type && await this.visitType(typePredicate.type, p)
|
|
950
|
-
};
|
|
968
|
+
}));
|
|
951
969
|
return updateIfChanged(typePredicate, updates);
|
|
952
970
|
}
|
|
953
971
|
|
|
@@ -958,12 +976,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
958
976
|
}
|
|
959
977
|
union = expression as JS.Union;
|
|
960
978
|
|
|
961
|
-
const updates: any = {
|
|
979
|
+
const updates: any = await this.visitChildrenOf(union, async () => ({
|
|
962
980
|
prefix: await this.visitSpace(union.prefix, p),
|
|
963
981
|
markers: await this.visitMarkers(union.markers, p),
|
|
964
982
|
types: await mapAsync(union.types, item => this.visitRightPadded(item, p)),
|
|
965
983
|
type: union.type && await this.visitType(union.type, p)
|
|
966
|
-
};
|
|
984
|
+
}));
|
|
967
985
|
return updateIfChanged(union, updates);
|
|
968
986
|
}
|
|
969
987
|
|
|
@@ -974,12 +992,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
974
992
|
}
|
|
975
993
|
intersection = expression as JS.Intersection;
|
|
976
994
|
|
|
977
|
-
const updates: any = {
|
|
995
|
+
const updates: any = await this.visitChildrenOf(intersection, async () => ({
|
|
978
996
|
prefix: await this.visitSpace(intersection.prefix, p),
|
|
979
997
|
markers: await this.visitMarkers(intersection.markers, p),
|
|
980
998
|
types: await mapAsync(intersection.types, item => this.visitRightPadded(item, p)),
|
|
981
999
|
type: intersection.type && await this.visitType(intersection.type, p)
|
|
982
|
-
};
|
|
1000
|
+
}));
|
|
983
1001
|
return updateIfChanged(intersection, updates);
|
|
984
1002
|
}
|
|
985
1003
|
|
|
@@ -990,11 +1008,11 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
990
1008
|
}
|
|
991
1009
|
void_ = expression as JS.Void;
|
|
992
1010
|
|
|
993
|
-
const updates: any = {
|
|
1011
|
+
const updates: any = await this.visitChildrenOf(void_, async () => ({
|
|
994
1012
|
prefix: await this.visitSpace(void_.prefix, p),
|
|
995
1013
|
markers: await this.visitMarkers(void_.markers, p),
|
|
996
1014
|
expression: await this.visitDefined<Expression>(void_.expression, p)
|
|
997
|
-
};
|
|
1015
|
+
}));
|
|
998
1016
|
return updateIfChanged(void_, updates);
|
|
999
1017
|
}
|
|
1000
1018
|
|
|
@@ -1005,12 +1023,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1005
1023
|
}
|
|
1006
1024
|
withStatement = statement as JS.WithStatement;
|
|
1007
1025
|
|
|
1008
|
-
const updates: any = {
|
|
1026
|
+
const updates: any = await this.visitChildrenOf(withStatement, async () => ({
|
|
1009
1027
|
prefix: await this.visitSpace(withStatement.prefix, p),
|
|
1010
1028
|
markers: await this.visitMarkers(withStatement.markers, p),
|
|
1011
1029
|
expression: await this.visitDefined<J.ControlParentheses<Expression>>(withStatement.expression, p),
|
|
1012
1030
|
body: await this.visitRightPadded(withStatement.body, p)
|
|
1013
|
-
};
|
|
1031
|
+
}));
|
|
1014
1032
|
return updateIfChanged(withStatement, updates);
|
|
1015
1033
|
}
|
|
1016
1034
|
|
|
@@ -1021,14 +1039,14 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1021
1039
|
}
|
|
1022
1040
|
indexSignatureDeclaration = statement as JS.IndexSignatureDeclaration;
|
|
1023
1041
|
|
|
1024
|
-
const updates: any = {
|
|
1042
|
+
const updates: any = await this.visitChildrenOf(indexSignatureDeclaration, async () => ({
|
|
1025
1043
|
prefix: await this.visitSpace(indexSignatureDeclaration.prefix, p),
|
|
1026
1044
|
markers: await this.visitMarkers(indexSignatureDeclaration.markers, p),
|
|
1027
1045
|
modifiers: await mapAsync(indexSignatureDeclaration.modifiers, item => this.visitDefined<J.Modifier>(item, p)),
|
|
1028
1046
|
parameters: await this.visitContainer(indexSignatureDeclaration.parameters, p),
|
|
1029
1047
|
typeExpression: await this.visitLeftPadded(indexSignatureDeclaration.typeExpression, p),
|
|
1030
1048
|
type: indexSignatureDeclaration.type && await this.visitType(indexSignatureDeclaration.type, p)
|
|
1031
|
-
};
|
|
1049
|
+
}));
|
|
1032
1050
|
return updateIfChanged(indexSignatureDeclaration, updates);
|
|
1033
1051
|
}
|
|
1034
1052
|
|
|
@@ -1039,7 +1057,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1039
1057
|
}
|
|
1040
1058
|
computedPropMethod = statement as JS.ComputedPropertyMethodDeclaration;
|
|
1041
1059
|
|
|
1042
|
-
const updates: any = {
|
|
1060
|
+
const updates: any = await this.visitChildrenOf(computedPropMethod, async () => ({
|
|
1043
1061
|
prefix: await this.visitSpace(computedPropMethod.prefix, p),
|
|
1044
1062
|
markers: await this.visitMarkers(computedPropMethod.markers, p),
|
|
1045
1063
|
leadingAnnotations: await mapAsync(computedPropMethod.leadingAnnotations, item => this.visitDefined<J.Annotation>(item, p)),
|
|
@@ -1050,7 +1068,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1050
1068
|
parameters: await this.visitContainer(computedPropMethod.parameters, p),
|
|
1051
1069
|
body: computedPropMethod.body && await this.visitDefined<J.Block>(computedPropMethod.body, p),
|
|
1052
1070
|
methodType: computedPropMethod.methodType && (await this.visitType(computedPropMethod.methodType, p) as Type.Method)
|
|
1053
|
-
};
|
|
1071
|
+
}));
|
|
1054
1072
|
return updateIfChanged(computedPropMethod, updates);
|
|
1055
1073
|
}
|
|
1056
1074
|
|
|
@@ -1061,12 +1079,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1061
1079
|
}
|
|
1062
1080
|
forOfLoop = statement as JS.ForOfLoop;
|
|
1063
1081
|
|
|
1064
|
-
const updates: any = {
|
|
1082
|
+
const updates: any = await this.visitChildrenOf(forOfLoop, async () => ({
|
|
1065
1083
|
prefix: await this.visitSpace(forOfLoop.prefix, p),
|
|
1066
1084
|
markers: await this.visitMarkers(forOfLoop.markers, p),
|
|
1067
1085
|
await: forOfLoop.await && await this.visitSpace(forOfLoop.await, p),
|
|
1068
1086
|
loop: await this.visitDefined<J.ForEachLoop>(forOfLoop.loop, p)
|
|
1069
|
-
};
|
|
1087
|
+
}));
|
|
1070
1088
|
return updateIfChanged(forOfLoop, updates);
|
|
1071
1089
|
}
|
|
1072
1090
|
|
|
@@ -1077,12 +1095,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1077
1095
|
}
|
|
1078
1096
|
forInLoop = statement as JS.ForInLoop;
|
|
1079
1097
|
|
|
1080
|
-
const updates: any = {
|
|
1098
|
+
const updates: any = await this.visitChildrenOf(forInLoop, async () => ({
|
|
1081
1099
|
prefix: await this.visitSpace(forInLoop.prefix, p),
|
|
1082
1100
|
markers: await this.visitMarkers(forInLoop.markers, p),
|
|
1083
1101
|
control: await this.visitDefined<JS.ForInLoop.Control>(forInLoop.control, p),
|
|
1084
1102
|
body: await this.visitRightPadded(forInLoop.body, p)
|
|
1085
|
-
};
|
|
1103
|
+
}));
|
|
1086
1104
|
return updateIfChanged(forInLoop, updates);
|
|
1087
1105
|
}
|
|
1088
1106
|
|
|
@@ -1093,14 +1111,14 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1093
1111
|
}
|
|
1094
1112
|
namespaceDeclaration = statement as JS.NamespaceDeclaration;
|
|
1095
1113
|
|
|
1096
|
-
const updates: any = {
|
|
1114
|
+
const updates: any = await this.visitChildrenOf(namespaceDeclaration, async () => ({
|
|
1097
1115
|
prefix: await this.visitSpace(namespaceDeclaration.prefix, p),
|
|
1098
1116
|
markers: await this.visitMarkers(namespaceDeclaration.markers, p),
|
|
1099
1117
|
modifiers: await mapAsync(namespaceDeclaration.modifiers, item => this.visitDefined<J.Modifier>(item, p)),
|
|
1100
1118
|
keywordType: await this.visitLeftPadded(namespaceDeclaration.keywordType, p),
|
|
1101
1119
|
name: await this.visitRightPadded(namespaceDeclaration.name, p),
|
|
1102
1120
|
body: namespaceDeclaration.body && await this.visitDefined<J.Block>(namespaceDeclaration.body, p)
|
|
1103
|
-
};
|
|
1121
|
+
}));
|
|
1104
1122
|
return updateIfChanged(namespaceDeclaration, updates);
|
|
1105
1123
|
}
|
|
1106
1124
|
|
|
@@ -1111,12 +1129,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1111
1129
|
}
|
|
1112
1130
|
typeLiteral = expression as JS.TypeLiteral;
|
|
1113
1131
|
|
|
1114
|
-
const updates: any = {
|
|
1132
|
+
const updates: any = await this.visitChildrenOf(typeLiteral, async () => ({
|
|
1115
1133
|
prefix: await this.visitSpace(typeLiteral.prefix, p),
|
|
1116
1134
|
markers: await this.visitMarkers(typeLiteral.markers, p),
|
|
1117
1135
|
members: await this.visitDefined<J.Block>(typeLiteral.members, p),
|
|
1118
1136
|
type: typeLiteral.type && await this.visitType(typeLiteral.type, p)
|
|
1119
|
-
};
|
|
1137
|
+
}));
|
|
1120
1138
|
return updateIfChanged(typeLiteral, updates);
|
|
1121
1139
|
}
|
|
1122
1140
|
|
|
@@ -1127,12 +1145,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1127
1145
|
}
|
|
1128
1146
|
arrayBindingPattern = expression as JS.ArrayBindingPattern;
|
|
1129
1147
|
|
|
1130
|
-
const updates: any = {
|
|
1148
|
+
const updates: any = await this.visitChildrenOf(arrayBindingPattern, async () => ({
|
|
1131
1149
|
prefix: await this.visitSpace(arrayBindingPattern.prefix, p),
|
|
1132
1150
|
markers: await this.visitMarkers(arrayBindingPattern.markers, p),
|
|
1133
1151
|
elements: await this.visitContainer(arrayBindingPattern.elements, p),
|
|
1134
1152
|
type: arrayBindingPattern.type && await this.visitType(arrayBindingPattern.type, p)
|
|
1135
|
-
};
|
|
1153
|
+
}));
|
|
1136
1154
|
return updateIfChanged(arrayBindingPattern, updates);
|
|
1137
1155
|
}
|
|
1138
1156
|
|
|
@@ -1143,14 +1161,14 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1143
1161
|
}
|
|
1144
1162
|
bindingElement = statement as JS.BindingElement;
|
|
1145
1163
|
|
|
1146
|
-
const updates: any = {
|
|
1164
|
+
const updates: any = await this.visitChildrenOf(bindingElement, async () => ({
|
|
1147
1165
|
prefix: await this.visitSpace(bindingElement.prefix, p),
|
|
1148
1166
|
markers: await this.visitMarkers(bindingElement.markers, p),
|
|
1149
1167
|
propertyName: bindingElement.propertyName && await this.visitRightPadded(bindingElement.propertyName, p),
|
|
1150
1168
|
name: await this.visitDefined<TypedTree>(bindingElement.name, p),
|
|
1151
1169
|
initializer: bindingElement.initializer && await this.visitLeftPadded(bindingElement.initializer, p),
|
|
1152
1170
|
variableType: bindingElement.variableType && (await this.visitType(bindingElement.variableType, p) as Type.Variable)
|
|
1153
|
-
};
|
|
1171
|
+
}));
|
|
1154
1172
|
return updateIfChanged(bindingElement, updates);
|
|
1155
1173
|
}
|
|
1156
1174
|
|
|
@@ -1161,7 +1179,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1161
1179
|
}
|
|
1162
1180
|
exportDeclaration = statement as JS.ExportDeclaration;
|
|
1163
1181
|
|
|
1164
|
-
const updates: any = {
|
|
1182
|
+
const updates: any = await this.visitChildrenOf(exportDeclaration, async () => ({
|
|
1165
1183
|
prefix: await this.visitSpace(exportDeclaration.prefix, p),
|
|
1166
1184
|
markers: await this.visitMarkers(exportDeclaration.markers, p),
|
|
1167
1185
|
modifiers: await mapAsync(exportDeclaration.modifiers, item => this.visitDefined<J.Modifier>(item, p)),
|
|
@@ -1169,7 +1187,7 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1169
1187
|
exportClause: exportDeclaration.exportClause && await this.visitDefined<Expression>(exportDeclaration.exportClause, p),
|
|
1170
1188
|
moduleSpecifier: exportDeclaration.moduleSpecifier && await this.visitLeftPadded(exportDeclaration.moduleSpecifier, p),
|
|
1171
1189
|
attributes: exportDeclaration.attributes && await this.visitDefined<JS.ImportAttributes>(exportDeclaration.attributes, p)
|
|
1172
|
-
};
|
|
1190
|
+
}));
|
|
1173
1191
|
return updateIfChanged(exportDeclaration, updates);
|
|
1174
1192
|
}
|
|
1175
1193
|
|
|
@@ -1180,11 +1198,11 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1180
1198
|
}
|
|
1181
1199
|
exportAssignment = statement as JS.ExportAssignment;
|
|
1182
1200
|
|
|
1183
|
-
const updates: any = {
|
|
1201
|
+
const updates: any = await this.visitChildrenOf(exportAssignment, async () => ({
|
|
1184
1202
|
prefix: await this.visitSpace(exportAssignment.prefix, p),
|
|
1185
1203
|
markers: await this.visitMarkers(exportAssignment.markers, p),
|
|
1186
1204
|
expression: await this.visitLeftPadded<Expression>(exportAssignment.expression, p)
|
|
1187
|
-
};
|
|
1205
|
+
}));
|
|
1188
1206
|
return updateIfChanged(exportAssignment, updates);
|
|
1189
1207
|
}
|
|
1190
1208
|
|
|
@@ -1195,12 +1213,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1195
1213
|
}
|
|
1196
1214
|
namedExports = expression as JS.NamedExports;
|
|
1197
1215
|
|
|
1198
|
-
const updates: any = {
|
|
1216
|
+
const updates: any = await this.visitChildrenOf(namedExports, async () => ({
|
|
1199
1217
|
prefix: await this.visitSpace(namedExports.prefix, p),
|
|
1200
1218
|
markers: await this.visitMarkers(namedExports.markers, p),
|
|
1201
1219
|
elements: await this.visitContainer(namedExports.elements, p),
|
|
1202
1220
|
type: namedExports.type && await this.visitType(namedExports.type, p)
|
|
1203
|
-
};
|
|
1221
|
+
}));
|
|
1204
1222
|
return updateIfChanged(namedExports, updates);
|
|
1205
1223
|
}
|
|
1206
1224
|
|
|
@@ -1211,13 +1229,13 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1211
1229
|
}
|
|
1212
1230
|
exportSpecifier = expression as JS.ExportSpecifier;
|
|
1213
1231
|
|
|
1214
|
-
const updates: any = {
|
|
1232
|
+
const updates: any = await this.visitChildrenOf(exportSpecifier, async () => ({
|
|
1215
1233
|
prefix: await this.visitSpace(exportSpecifier.prefix, p),
|
|
1216
1234
|
markers: await this.visitMarkers(exportSpecifier.markers, p),
|
|
1217
1235
|
typeOnly: await this.visitLeftPadded(exportSpecifier.typeOnly, p),
|
|
1218
1236
|
specifier: await this.visitDefined<Expression>(exportSpecifier.specifier, p),
|
|
1219
1237
|
type: exportSpecifier.type && await this.visitType(exportSpecifier.type, p)
|
|
1220
|
-
};
|
|
1238
|
+
}));
|
|
1221
1239
|
return updateIfChanged(exportSpecifier, updates);
|
|
1222
1240
|
}
|
|
1223
1241
|
|