@openrewrite/rewrite 8.63.0 → 8.63.2
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/index.d.ts +1 -0
- package/dist/java/index.d.ts.map +1 -1
- package/dist/java/index.js +1 -0
- package/dist/java/index.js.map +1 -1
- package/dist/java/rpc.d.ts +2 -0
- package/dist/java/rpc.d.ts.map +1 -1
- package/dist/java/rpc.js +749 -410
- package/dist/java/rpc.js.map +1 -1
- package/dist/java/tree.d.ts +1 -1
- package/dist/java/tree.d.ts.map +1 -1
- package/dist/java/type-visitor.d.ts +48 -0
- package/dist/java/type-visitor.d.ts.map +1 -0
- package/dist/java/type-visitor.js +260 -0
- package/dist/java/type-visitor.js.map +1 -0
- package/dist/java/type.d.ts +2 -0
- package/dist/java/type.d.ts.map +1 -1
- package/dist/java/type.js +0 -317
- package/dist/java/type.js.map +1 -1
- package/dist/java/visitor.d.ts.map +1 -1
- package/dist/java/visitor.js +579 -363
- package/dist/java/visitor.js.map +1 -1
- package/dist/javascript/preconditions.d.ts +1 -1
- package/dist/javascript/preconditions.d.ts.map +1 -1
- package/dist/javascript/preconditions.js +7 -6
- package/dist/javascript/preconditions.js.map +1 -1
- package/dist/javascript/rpc.js +430 -350
- package/dist/javascript/rpc.js.map +1 -1
- package/dist/javascript/tree.d.ts +1 -1
- package/dist/javascript/tree.d.ts.map +1 -1
- package/dist/javascript/type-mapping.d.ts.map +1 -1
- package/dist/javascript/type-mapping.js +7 -0
- package/dist/javascript/type-mapping.js.map +1 -1
- package/dist/javascript/visitor.d.ts.map +1 -1
- package/dist/javascript/visitor.js +504 -309
- package/dist/javascript/visitor.js.map +1 -1
- package/dist/json/visitor.d.ts.map +1 -1
- package/dist/json/visitor.js +46 -21
- package/dist/json/visitor.js.map +1 -1
- package/dist/rpc/queue.d.ts +7 -4
- package/dist/rpc/queue.d.ts.map +1 -1
- package/dist/rpc/queue.js +22 -32
- package/dist/rpc/queue.js.map +1 -1
- package/dist/rpc/request/generate.d.ts.map +1 -1
- package/dist/rpc/request/generate.js +2 -3
- package/dist/rpc/request/generate.js.map +1 -1
- package/dist/rpc/request/get-languages.d.ts.map +1 -1
- package/dist/rpc/request/get-languages.js +4 -3
- package/dist/rpc/request/get-languages.js.map +1 -1
- package/dist/rpc/request/get-object.d.ts +1 -1
- package/dist/rpc/request/get-object.d.ts.map +1 -1
- package/dist/rpc/request/get-object.js +8 -7
- package/dist/rpc/request/get-object.js.map +1 -1
- package/dist/rpc/request/get-recipes.d.ts.map +1 -1
- package/dist/rpc/request/get-recipes.js +2 -2
- package/dist/rpc/request/get-recipes.js.map +1 -1
- package/dist/rpc/request/index.d.ts +1 -0
- package/dist/rpc/request/index.d.ts.map +1 -1
- package/dist/rpc/request/index.js +1 -0
- package/dist/rpc/request/index.js.map +1 -1
- package/dist/rpc/request/install-recipes.d.ts.map +1 -1
- package/dist/rpc/request/install-recipes.js +30 -21
- package/dist/rpc/request/install-recipes.js.map +1 -1
- package/dist/rpc/request/metrics.d.ts +10 -10
- package/dist/rpc/request/metrics.d.ts.map +1 -1
- package/dist/rpc/request/metrics.js +38 -31
- package/dist/rpc/request/metrics.js.map +1 -1
- package/dist/rpc/request/parse.d.ts.map +1 -1
- package/dist/rpc/request/parse.js +10 -12
- package/dist/rpc/request/parse.js.map +1 -1
- package/dist/rpc/request/prepare-recipe.d.ts.map +1 -1
- package/dist/rpc/request/prepare-recipe.js +4 -4
- package/dist/rpc/request/prepare-recipe.js.map +1 -1
- package/dist/rpc/request/print.d.ts +1 -1
- package/dist/rpc/request/print.d.ts.map +1 -1
- package/dist/rpc/request/print.js +10 -6
- package/dist/rpc/request/print.js.map +1 -1
- package/dist/rpc/request/trace-get-object.d.ts +5 -0
- package/dist/rpc/request/trace-get-object.d.ts.map +1 -0
- package/dist/rpc/request/trace-get-object.js +3 -0
- package/dist/rpc/request/trace-get-object.js.map +1 -0
- package/dist/rpc/request/visit.d.ts.map +1 -1
- package/dist/rpc/request/visit.js +2 -3
- package/dist/rpc/request/visit.js.map +1 -1
- package/dist/rpc/rewrite-rpc.d.ts +2 -3
- package/dist/rpc/rewrite-rpc.d.ts.map +1 -1
- package/dist/rpc/rewrite-rpc.js +14 -5
- package/dist/rpc/rewrite-rpc.js.map +1 -1
- package/dist/rpc/server.d.ts.map +1 -1
- package/dist/rpc/server.js +15 -44
- package/dist/rpc/server.js.map +1 -1
- package/dist/rpc/trace.d.ts +1 -1
- package/dist/rpc/trace.d.ts.map +1 -1
- package/dist/rpc/trace.js +3 -3
- package/dist/rpc/trace.js.map +1 -1
- package/dist/util.d.ts +6 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +14 -0
- package/dist/util.js.map +1 -1
- package/dist/version.txt +1 -1
- package/package.json +1 -1
- package/src/java/index.ts +1 -0
- package/src/java/rpc.ts +726 -537
- package/src/java/tree.ts +1 -1
- package/src/java/type-visitor.ts +241 -0
- package/src/java/type.ts +13 -277
- package/src/java/visitor.ts +581 -378
- package/src/javascript/preconditions.ts +7 -6
- package/src/javascript/rpc.ts +431 -360
- package/src/javascript/tree.ts +1 -1
- package/src/javascript/type-mapping.ts +7 -0
- package/src/javascript/visitor.ts +505 -310
- package/src/json/visitor.ts +47 -22
- package/src/rpc/queue.ts +20 -17
- package/src/rpc/request/generate.ts +31 -25
- package/src/rpc/request/get-languages.ts +18 -10
- package/src/rpc/request/get-object.ts +42 -34
- package/src/rpc/request/get-recipes.ts +15 -8
- package/src/rpc/request/index.ts +1 -0
- package/src/rpc/request/install-recipes.ts +96 -79
- package/src/rpc/request/metrics.ts +54 -48
- package/src/rpc/request/parse.ts +31 -25
- package/src/rpc/request/prepare-recipe.ts +31 -23
- package/src/rpc/request/print.ts +28 -14
- package/src/rpc/request/trace-get-object.ts +4 -0
- package/src/rpc/request/visit.ts +22 -16
- package/src/rpc/rewrite-rpc.ts +23 -10
- package/src/rpc/server.ts +17 -52
- package/src/rpc/trace.ts +3 -3
- package/src/util.ts +14 -0
- package/dist/rpc/chrome-profiler.d.ts +0 -25
- package/dist/rpc/chrome-profiler.d.ts.map +0 -1
- package/dist/rpc/chrome-profiler.js +0 -405
- package/dist/rpc/chrome-profiler.js.map +0 -1
- package/src/rpc/chrome-profiler.ts +0 -373
package/src/java/visitor.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import {Cursor, isTree, SourceFile} from "../tree";
|
|
17
|
-
import {mapAsync} from "../util";
|
|
17
|
+
import {mapAsync, updateIfChanged} from "../util";
|
|
18
18
|
import {produceAsync, TreeVisitor, ValidImmerRecipeReturnType} from "../visitor";
|
|
19
19
|
import {Expression, isSpace, J, NameTree, Statement, TypedTree, TypeTree} from "./tree";
|
|
20
20
|
import {createDraft, Draft, finishDraft} from "immer";
|
|
@@ -82,10 +82,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
82
82
|
}
|
|
83
83
|
annotatedType = expression as J.AnnotatedType;
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
const updates = {
|
|
86
|
+
prefix: await this.visitSpace(annotatedType.prefix, p),
|
|
87
|
+
markers: await this.visitMarkers(annotatedType.markers, p),
|
|
88
|
+
annotations: await mapAsync(annotatedType.annotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
89
|
+
typeExpression: await this.visitDefined(annotatedType.typeExpression, p) as TypedTree
|
|
90
|
+
};
|
|
91
|
+
return updateIfChanged(annotatedType, updates);
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
protected async visitAnnotation(annotation: J.Annotation, p: P): Promise<J | undefined> {
|
|
@@ -95,10 +98,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
95
98
|
}
|
|
96
99
|
annotation = expression as J.Annotation;
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
const updates = {
|
|
102
|
+
prefix: await this.visitSpace(annotation.prefix, p),
|
|
103
|
+
markers: await this.visitMarkers(annotation.markers, p),
|
|
104
|
+
annotationType: await this.visitTypeName(annotation.annotationType, p),
|
|
105
|
+
arguments: await this.visitOptionalContainer(annotation.arguments, p)
|
|
106
|
+
};
|
|
107
|
+
return updateIfChanged(annotation, updates);
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
protected async visitArrayAccess(arrayAccess: J.ArrayAccess, p: P): Promise<J | undefined> {
|
|
@@ -108,18 +114,25 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
108
114
|
}
|
|
109
115
|
arrayAccess = expression as J.ArrayAccess;
|
|
110
116
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
const updates = {
|
|
118
|
+
prefix: await this.visitSpace(arrayAccess.prefix, p),
|
|
119
|
+
markers: await this.visitMarkers(arrayAccess.markers, p),
|
|
120
|
+
indexed: await this.visitDefined(arrayAccess.indexed, p) as Expression,
|
|
121
|
+
dimension: await this.visitDefined(arrayAccess.dimension, p) as J.ArrayDimension
|
|
122
|
+
};
|
|
123
|
+
return updateIfChanged(arrayAccess, updates);
|
|
115
124
|
}
|
|
116
125
|
|
|
117
126
|
protected async visitArrayDimension(arrayDimension: J.ArrayDimension, p: P): Promise<J | undefined> {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
const updates = {
|
|
128
|
+
prefix: await this.visitSpace(arrayDimension.prefix, p),
|
|
129
|
+
markers: await this.visitMarkers(arrayDimension.markers, p),
|
|
130
|
+
index: await this.visitRightPadded(arrayDimension.index, p)
|
|
131
|
+
};
|
|
132
|
+
return updateIfChanged(arrayDimension, updates);
|
|
121
133
|
}
|
|
122
134
|
|
|
135
|
+
|
|
123
136
|
protected async visitArrayType(arrayType: J.ArrayType, p: P): Promise<J | undefined> {
|
|
124
137
|
const expression = await this.visitExpression(arrayType, p);
|
|
125
138
|
if (!expression?.kind || expression.kind !== J.Kind.ArrayType) {
|
|
@@ -127,14 +140,17 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
127
140
|
}
|
|
128
141
|
arrayType = expression as J.ArrayType;
|
|
129
142
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
const updates: any = {
|
|
144
|
+
prefix: await this.visitSpace(arrayType.prefix, p),
|
|
145
|
+
markers: await this.visitMarkers(arrayType.markers, p),
|
|
146
|
+
elementType: await this.visitDefined(arrayType.elementType, p) as TypedTree,
|
|
147
|
+
dimension: await this.visitLeftPadded(arrayType.dimension, p),
|
|
148
|
+
type: await this.visitType(arrayType.type, p)
|
|
149
|
+
};
|
|
150
|
+
if (arrayType.annotations) {
|
|
151
|
+
updates.annotations = await mapAsync(arrayType.annotations, a => this.visitDefined<J.Annotation>(a, p));
|
|
152
|
+
}
|
|
153
|
+
return updateIfChanged(arrayType, updates);
|
|
138
154
|
}
|
|
139
155
|
|
|
140
156
|
protected async visitAssert(anAssert: J.Assert, p: P): Promise<J | undefined> {
|
|
@@ -144,10 +160,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
144
160
|
}
|
|
145
161
|
anAssert = statement as J.Assert;
|
|
146
162
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
163
|
+
const updates = {
|
|
164
|
+
prefix: await this.visitSpace(anAssert.prefix, p),
|
|
165
|
+
markers: await this.visitMarkers(anAssert.markers, p),
|
|
166
|
+
condition: await this.visitDefined(anAssert.condition, p) as Expression,
|
|
167
|
+
detail: await this.visitOptionalLeftPadded(anAssert.detail, p)
|
|
168
|
+
};
|
|
169
|
+
return updateIfChanged(anAssert, updates);
|
|
151
170
|
}
|
|
152
171
|
|
|
153
172
|
protected async visitAssignment(assignment: J.Assignment, p: P): Promise<J | undefined> {
|
|
@@ -163,11 +182,14 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
163
182
|
}
|
|
164
183
|
assignment = statement as J.Assignment;
|
|
165
184
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
185
|
+
const updates = {
|
|
186
|
+
prefix: await this.visitSpace(assignment.prefix, p),
|
|
187
|
+
markers: await this.visitMarkers(assignment.markers, p),
|
|
188
|
+
variable: await this.visitDefined(assignment.variable, p) as Expression,
|
|
189
|
+
assignment: await this.visitLeftPadded(assignment.assignment, p),
|
|
190
|
+
type: await this.visitType(assignment.type, p)
|
|
191
|
+
};
|
|
192
|
+
return updateIfChanged(assignment, updates);
|
|
171
193
|
}
|
|
172
194
|
|
|
173
195
|
protected async visitAssignmentOperation(assignOp: J.AssignmentOperation, p: P): Promise<J | undefined> {
|
|
@@ -177,12 +199,15 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
177
199
|
}
|
|
178
200
|
assignOp = expression as J.AssignmentOperation;
|
|
179
201
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
202
|
+
const updates = {
|
|
203
|
+
prefix: await this.visitSpace(assignOp.prefix, p),
|
|
204
|
+
markers: await this.visitMarkers(assignOp.markers, p),
|
|
205
|
+
variable: await this.visitDefined(assignOp.variable, p) as Expression,
|
|
206
|
+
operator: await this.visitLeftPadded(assignOp.operator, p),
|
|
207
|
+
assignment: await this.visitDefined(assignOp.assignment, p) as Expression,
|
|
208
|
+
type: await this.visitType(assignOp.type, p)
|
|
209
|
+
};
|
|
210
|
+
return updateIfChanged(assignOp, updates);
|
|
186
211
|
}
|
|
187
212
|
|
|
188
213
|
protected async visitBinary(binary: J.Binary, p: P): Promise<J | undefined> {
|
|
@@ -192,20 +217,26 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
192
217
|
}
|
|
193
218
|
binary = expression as J.Binary;
|
|
194
219
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
220
|
+
const updates = {
|
|
221
|
+
prefix: await this.visitSpace(binary.prefix, p),
|
|
222
|
+
markers: await this.visitMarkers(binary.markers, p),
|
|
223
|
+
left: await this.visitDefined(binary.left, p) as Expression,
|
|
224
|
+
operator: await this.visitLeftPadded(binary.operator, p),
|
|
225
|
+
right: await this.visitDefined(binary.right, p) as Expression,
|
|
226
|
+
type: await this.visitType(binary.type, p)
|
|
227
|
+
};
|
|
228
|
+
return updateIfChanged(binary, updates);
|
|
201
229
|
}
|
|
202
230
|
|
|
203
231
|
protected async visitBlock(block: J.Block, p: P): Promise<J | undefined> {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
232
|
+
const updates = {
|
|
233
|
+
prefix: await this.visitSpace(block.prefix, p),
|
|
234
|
+
markers: await this.visitMarkers(block.markers, p),
|
|
235
|
+
static: await this.visitRightPadded(block.static, p),
|
|
236
|
+
statements: await mapAsync(block.statements, stmt => this.visitRightPadded(stmt, p)),
|
|
237
|
+
end: await this.visitSpace(block.end, p)
|
|
238
|
+
};
|
|
239
|
+
return updateIfChanged(block, updates);
|
|
209
240
|
}
|
|
210
241
|
|
|
211
242
|
protected async visitBreak(breakStatement: J.Break, p: P): Promise<J | undefined> {
|
|
@@ -215,11 +246,14 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
215
246
|
}
|
|
216
247
|
breakStatement = statement as J.Break;
|
|
217
248
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
249
|
+
const updates: any = {
|
|
250
|
+
prefix: await this.visitSpace(breakStatement.prefix, p),
|
|
251
|
+
markers: await this.visitMarkers(breakStatement.markers, p)
|
|
252
|
+
};
|
|
253
|
+
if (breakStatement.label) {
|
|
254
|
+
updates.label = await this.visitDefined(breakStatement.label, p) as J.Identifier;
|
|
255
|
+
}
|
|
256
|
+
return updateIfChanged(breakStatement, updates);
|
|
223
257
|
}
|
|
224
258
|
|
|
225
259
|
protected async visitCase(aCase: J.Case, p: P): Promise<J | undefined> {
|
|
@@ -229,14 +263,17 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
229
263
|
}
|
|
230
264
|
aCase = statement as J.Case;
|
|
231
265
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
266
|
+
const updates: any = {
|
|
267
|
+
prefix: await this.visitSpace(aCase.prefix, p),
|
|
268
|
+
markers: await this.visitMarkers(aCase.markers, p),
|
|
269
|
+
caseLabels: await this.visitContainer(aCase.caseLabels, p),
|
|
270
|
+
statements: await this.visitContainer(aCase.statements, p),
|
|
271
|
+
body: await this.visitOptionalRightPadded(aCase.body, p)
|
|
272
|
+
};
|
|
273
|
+
if (aCase.guard) {
|
|
274
|
+
updates.guard = await this.visitDefined(aCase.guard, p) as Expression;
|
|
275
|
+
}
|
|
276
|
+
return updateIfChanged(aCase, updates);
|
|
240
277
|
}
|
|
241
278
|
|
|
242
279
|
protected async visitClassDeclaration(classDecl: J.ClassDeclaration, p: P): Promise<J | undefined> {
|
|
@@ -246,34 +283,43 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
246
283
|
}
|
|
247
284
|
classDecl = statement as J.ClassDeclaration;
|
|
248
285
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
286
|
+
const updates: any = {
|
|
287
|
+
prefix: await this.visitSpace(classDecl.prefix, p),
|
|
288
|
+
markers: await this.visitMarkers(classDecl.markers, p),
|
|
289
|
+
leadingAnnotations: await mapAsync(classDecl.leadingAnnotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
290
|
+
modifiers: await mapAsync(classDecl.modifiers, m => this.visitDefined<J.Modifier>(m, p)),
|
|
291
|
+
classKind: await this.visitDefined(classDecl.classKind, p) as J.ClassDeclaration.Kind,
|
|
292
|
+
name: await this.visitDefined(classDecl.name, p) as J.Identifier,
|
|
293
|
+
typeParameters: await this.visitOptionalContainer(classDecl.typeParameters, p),
|
|
294
|
+
primaryConstructor: await this.visitOptionalContainer(classDecl.primaryConstructor, p),
|
|
295
|
+
extends: await this.visitOptionalLeftPadded(classDecl.extends, p),
|
|
296
|
+
implements: await this.visitOptionalContainer(classDecl.implements, p),
|
|
297
|
+
permitting: await this.visitOptionalContainer(classDecl.permitting, p),
|
|
298
|
+
body: await this.visitDefined(classDecl.body, p) as J.Block,
|
|
299
|
+
type: await this.visitType(classDecl.type, p) as Type.Class | undefined
|
|
300
|
+
};
|
|
301
|
+
return updateIfChanged(classDecl, updates);
|
|
262
302
|
}
|
|
263
303
|
|
|
264
304
|
protected async visitClassDeclarationKind(kind: J.ClassDeclaration.Kind, p: P): Promise<J | undefined> {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
305
|
+
const updates: any = {
|
|
306
|
+
prefix: await this.visitSpace(kind.prefix, p),
|
|
307
|
+
markers: await this.visitMarkers(kind.markers, p),
|
|
308
|
+
annotations: await mapAsync(kind.annotations, a => this.visitDefined<J.Annotation>(a, p))
|
|
309
|
+
};
|
|
310
|
+
return updateIfChanged(kind, updates);
|
|
268
311
|
}
|
|
269
312
|
|
|
270
313
|
protected async visitCompilationUnit(cu: J.CompilationUnit, p: P): Promise<J | undefined> {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
314
|
+
const updates: any = {
|
|
315
|
+
prefix: await this.visitSpace(cu.prefix, p),
|
|
316
|
+
markers: await this.visitMarkers(cu.markers, p),
|
|
317
|
+
packageDeclaration: await this.visitRightPadded(cu.packageDeclaration, p) as J.RightPadded<J.Package>,
|
|
318
|
+
imports: await mapAsync(cu.imports, imp => this.visitRightPadded(imp, p)),
|
|
319
|
+
classes: await mapAsync(cu.classes, cls => this.visitDefined(cls, p) as Promise<J.ClassDeclaration>),
|
|
320
|
+
eof: await this.visitSpace(cu.eof, p)
|
|
321
|
+
};
|
|
322
|
+
return updateIfChanged(cu, updates);
|
|
277
323
|
}
|
|
278
324
|
|
|
279
325
|
protected async visitContinue(continueStatement: J.Continue, p: P): Promise<J | undefined> {
|
|
@@ -283,25 +329,34 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
283
329
|
}
|
|
284
330
|
continueStatement = statement as J.Continue;
|
|
285
331
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
332
|
+
const updates: any = {
|
|
333
|
+
prefix: await this.visitSpace(continueStatement.prefix, p),
|
|
334
|
+
markers: await this.visitMarkers(continueStatement.markers, p)
|
|
335
|
+
};
|
|
336
|
+
if (continueStatement.label) {
|
|
337
|
+
updates.label = await this.visitDefined(continueStatement.label, p) as J.Identifier;
|
|
338
|
+
}
|
|
339
|
+
return updateIfChanged(continueStatement, updates);
|
|
291
340
|
}
|
|
292
341
|
|
|
293
342
|
protected async visitControlParentheses<T extends J>(controlParens: J.ControlParentheses<T>, p: P): Promise<J | undefined> {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
343
|
+
const updates: any = {
|
|
344
|
+
prefix: await this.visitSpace(controlParens.prefix, p),
|
|
345
|
+
markers: await this.visitMarkers(controlParens.markers, p),
|
|
346
|
+
tree: await this.visitRightPadded(controlParens.tree, p)
|
|
347
|
+
};
|
|
348
|
+
return updateIfChanged(controlParens, updates);
|
|
297
349
|
}
|
|
298
350
|
|
|
299
351
|
protected async visitDeconstructionPattern(pattern: J.DeconstructionPattern, p: P): Promise<J | undefined> {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
352
|
+
const updates: any = {
|
|
353
|
+
prefix: await this.visitSpace(pattern.prefix, p),
|
|
354
|
+
markers: await this.visitMarkers(pattern.markers, p),
|
|
355
|
+
deconstructor: await this.visitDefined(pattern.deconstructor, p) as Expression,
|
|
356
|
+
nested: await this.visitContainer(pattern.nested, p),
|
|
357
|
+
type: await this.visitType(pattern.type, p)
|
|
358
|
+
};
|
|
359
|
+
return updateIfChanged(pattern, updates);
|
|
305
360
|
}
|
|
306
361
|
|
|
307
362
|
protected async visitDoWhileLoop(doWhileLoop: J.DoWhileLoop, p: P): Promise<J | undefined> {
|
|
@@ -311,10 +366,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
311
366
|
}
|
|
312
367
|
doWhileLoop = statement as J.DoWhileLoop;
|
|
313
368
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
369
|
+
const updates: any = {
|
|
370
|
+
prefix: await this.visitSpace(doWhileLoop.prefix, p),
|
|
371
|
+
markers: await this.visitMarkers(doWhileLoop.markers, p),
|
|
372
|
+
body: await this.visitRightPadded(doWhileLoop.body, p),
|
|
373
|
+
whileCondition: await this.visitLeftPadded(doWhileLoop.whileCondition, p)
|
|
374
|
+
};
|
|
375
|
+
return updateIfChanged(doWhileLoop, updates);
|
|
318
376
|
}
|
|
319
377
|
|
|
320
378
|
protected async visitEmpty(empty: J.Empty, p: P): Promise<J | undefined> {
|
|
@@ -330,17 +388,24 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
330
388
|
}
|
|
331
389
|
empty = statement as J.Empty;
|
|
332
390
|
|
|
333
|
-
|
|
391
|
+
const updates: any = {
|
|
392
|
+
prefix: await this.visitSpace(empty.prefix, p),
|
|
393
|
+
markers: await this.visitMarkers(empty.markers, p)
|
|
394
|
+
};
|
|
395
|
+
return updateIfChanged(empty, updates);
|
|
334
396
|
}
|
|
335
397
|
|
|
336
398
|
protected async visitEnumValue(enumValue: J.EnumValue, p: P): Promise<J | undefined> {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
399
|
+
const updates: any = {
|
|
400
|
+
prefix: await this.visitSpace(enumValue.prefix, p),
|
|
401
|
+
markers: await this.visitMarkers(enumValue.markers, p),
|
|
402
|
+
annotations: await mapAsync(enumValue.annotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
403
|
+
name: await this.visitDefined(enumValue.name, p) as J.Identifier
|
|
404
|
+
};
|
|
405
|
+
if (enumValue.initializer) {
|
|
406
|
+
updates.initializer = await this.visitDefined(enumValue.initializer, p) as J.NewClass;
|
|
407
|
+
}
|
|
408
|
+
return updateIfChanged(enumValue, updates);
|
|
344
409
|
}
|
|
345
410
|
|
|
346
411
|
protected async visitEnumValueSet(enumValueSet: J.EnumValueSet, p: P): Promise<J | undefined> {
|
|
@@ -350,9 +415,12 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
350
415
|
}
|
|
351
416
|
enumValueSet = statement as J.EnumValueSet;
|
|
352
417
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
418
|
+
const updates: any = {
|
|
419
|
+
prefix: await this.visitSpace(enumValueSet.prefix, p),
|
|
420
|
+
markers: await this.visitMarkers(enumValueSet.markers, p),
|
|
421
|
+
enums: await mapAsync(enumValueSet.enums, e => this.visitRightPadded(e, p))
|
|
422
|
+
};
|
|
423
|
+
return updateIfChanged(enumValueSet, updates);
|
|
356
424
|
}
|
|
357
425
|
|
|
358
426
|
protected async visitErroneous(erroneous: J.Erroneous, p: P): Promise<J | undefined> {
|
|
@@ -368,7 +436,11 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
368
436
|
}
|
|
369
437
|
erroneous = statement as J.Erroneous;
|
|
370
438
|
|
|
371
|
-
|
|
439
|
+
const updates: any = {
|
|
440
|
+
prefix: await this.visitSpace(erroneous.prefix, p),
|
|
441
|
+
markers: await this.visitMarkers(erroneous.markers, p)
|
|
442
|
+
};
|
|
443
|
+
return updateIfChanged(erroneous, updates);
|
|
372
444
|
}
|
|
373
445
|
|
|
374
446
|
protected async visitFieldAccess(fieldAccess: J.FieldAccess, p: P): Promise<J | undefined> {
|
|
@@ -384,11 +456,14 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
384
456
|
}
|
|
385
457
|
fieldAccess = statement as J.FieldAccess;
|
|
386
458
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
459
|
+
const updates: any = {
|
|
460
|
+
prefix: await this.visitSpace(fieldAccess.prefix, p),
|
|
461
|
+
markers: await this.visitMarkers(fieldAccess.markers, p),
|
|
462
|
+
target: await this.visitDefined(fieldAccess.target, p) as Expression,
|
|
463
|
+
name: await this.visitLeftPadded(fieldAccess.name, p),
|
|
464
|
+
type: await this.visitType(fieldAccess.type, p)
|
|
465
|
+
};
|
|
466
|
+
return updateIfChanged(fieldAccess, updates);
|
|
392
467
|
}
|
|
393
468
|
|
|
394
469
|
protected async visitForEachLoop(forLoop: J.ForEachLoop, p: P): Promise<J | undefined> {
|
|
@@ -398,17 +473,23 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
398
473
|
}
|
|
399
474
|
forLoop = statement as J.ForEachLoop;
|
|
400
475
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
476
|
+
const updates: any = {
|
|
477
|
+
prefix: await this.visitSpace(forLoop.prefix, p),
|
|
478
|
+
markers: await this.visitMarkers(forLoop.markers, p),
|
|
479
|
+
control: await this.visitDefined(forLoop.control, p) as J.ForEachLoop.Control,
|
|
480
|
+
body: await this.visitRightPadded(forLoop.body, p)
|
|
481
|
+
};
|
|
482
|
+
return updateIfChanged(forLoop, updates);
|
|
405
483
|
}
|
|
406
484
|
|
|
407
485
|
protected async visitForEachLoopControl(control: J.ForEachLoop.Control, p: P): Promise<J | undefined> {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
486
|
+
const updates: any = {
|
|
487
|
+
prefix: await this.visitSpace(control.prefix, p),
|
|
488
|
+
markers: await this.visitMarkers(control.markers, p),
|
|
489
|
+
variable: await this.visitRightPadded(control.variable, p),
|
|
490
|
+
iterable: await this.visitRightPadded(control.iterable, p)
|
|
491
|
+
};
|
|
492
|
+
return updateIfChanged(control, updates);
|
|
412
493
|
}
|
|
413
494
|
|
|
414
495
|
protected async visitForLoop(forLoop: J.ForLoop, p: P): Promise<J | undefined> {
|
|
@@ -418,18 +499,24 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
418
499
|
}
|
|
419
500
|
forLoop = statement as J.ForLoop;
|
|
420
501
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
502
|
+
const updates: any = {
|
|
503
|
+
prefix: await this.visitSpace(forLoop.prefix, p),
|
|
504
|
+
markers: await this.visitMarkers(forLoop.markers, p),
|
|
505
|
+
control: await this.visitDefined(forLoop.control, p) as J.ForLoop.Control,
|
|
506
|
+
body: await this.visitRightPadded(forLoop.body, p)
|
|
507
|
+
};
|
|
508
|
+
return updateIfChanged(forLoop, updates);
|
|
425
509
|
}
|
|
426
510
|
|
|
427
511
|
protected async visitForLoopControl(control: J.ForLoop.Control, p: P): Promise<J | undefined> {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
512
|
+
const updates: any = {
|
|
513
|
+
prefix: await this.visitSpace(control.prefix, p),
|
|
514
|
+
markers: await this.visitMarkers(control.markers, p),
|
|
515
|
+
init: await mapAsync(control.init, i => this.visitRightPadded(i, p)),
|
|
516
|
+
condition: await this.visitOptionalRightPadded(control.condition, p),
|
|
517
|
+
update: await mapAsync(control.update, u => this.visitRightPadded(u, p))
|
|
518
|
+
};
|
|
519
|
+
return updateIfChanged(control, updates);
|
|
433
520
|
}
|
|
434
521
|
|
|
435
522
|
protected async visitIdentifier(ident: J.Identifier, p: P): Promise<J | undefined> {
|
|
@@ -439,11 +526,14 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
439
526
|
}
|
|
440
527
|
ident = expression as J.Identifier;
|
|
441
528
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
529
|
+
const updates: any = {
|
|
530
|
+
prefix: await this.visitSpace(ident.prefix, p),
|
|
531
|
+
markers: await this.visitMarkers(ident.markers, p),
|
|
532
|
+
annotations: await mapAsync(ident.annotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
533
|
+
type: await this.visitType(ident.type, p),
|
|
534
|
+
fieldType: await this.visitType(ident.fieldType, p) as Type.Variable | undefined
|
|
535
|
+
};
|
|
536
|
+
return updateIfChanged(ident, updates);
|
|
447
537
|
}
|
|
448
538
|
|
|
449
539
|
protected async visitIf(iff: J.If, p: P): Promise<J | undefined> {
|
|
@@ -453,27 +543,36 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
453
543
|
}
|
|
454
544
|
iff = statement as J.If;
|
|
455
545
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
546
|
+
const updates: any = {
|
|
547
|
+
prefix: await this.visitSpace(iff.prefix, p),
|
|
548
|
+
markers: await this.visitMarkers(iff.markers, p),
|
|
549
|
+
ifCondition: await this.visitDefined(iff.ifCondition, p) as J.ControlParentheses<Expression>,
|
|
550
|
+
thenPart: await this.visitRightPadded(iff.thenPart, p)
|
|
551
|
+
};
|
|
552
|
+
if (iff.elsePart) {
|
|
553
|
+
updates.elsePart = await this.visitDefined(iff.elsePart, p) as J.If.Else;
|
|
554
|
+
}
|
|
555
|
+
return updateIfChanged(iff, updates);
|
|
463
556
|
}
|
|
464
557
|
|
|
465
558
|
protected async visitElse(anElse: J.If.Else, p: P): Promise<J | undefined> {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
559
|
+
const updates: any = {
|
|
560
|
+
prefix: await this.visitSpace(anElse.prefix, p),
|
|
561
|
+
markers: await this.visitMarkers(anElse.markers, p),
|
|
562
|
+
body: await this.visitRightPadded(anElse.body, p)
|
|
563
|
+
};
|
|
564
|
+
return updateIfChanged(anElse, updates);
|
|
469
565
|
}
|
|
470
566
|
|
|
471
567
|
protected async visitImport(anImport: J.Import, p: P): Promise<J | undefined> {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
568
|
+
const updates: any = {
|
|
569
|
+
prefix: await this.visitSpace(anImport.prefix, p),
|
|
570
|
+
markers: await this.visitMarkers(anImport.markers, p),
|
|
571
|
+
static: await this.visitLeftPadded(anImport.static, p),
|
|
572
|
+
qualid: await this.visitDefined(anImport.qualid, p) as J.FieldAccess,
|
|
573
|
+
alias: await this.visitOptionalLeftPadded(anImport.alias, p)
|
|
574
|
+
};
|
|
575
|
+
return updateIfChanged(anImport, updates);
|
|
477
576
|
}
|
|
478
577
|
|
|
479
578
|
protected async visitInstanceOf(instanceOf: J.InstanceOf, p: P): Promise<J | undefined> {
|
|
@@ -483,17 +582,20 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
483
582
|
}
|
|
484
583
|
instanceOf = expression as J.InstanceOf;
|
|
485
584
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
585
|
+
const updates: any = {
|
|
586
|
+
prefix: await this.visitSpace(instanceOf.prefix, p),
|
|
587
|
+
markers: await this.visitMarkers(instanceOf.markers, p),
|
|
588
|
+
expression: await this.visitRightPadded(instanceOf.expression, p),
|
|
589
|
+
class: await this.visitDefined(instanceOf.class, p) as J,
|
|
590
|
+
type: await this.visitType(instanceOf.type, p)
|
|
591
|
+
};
|
|
592
|
+
if (instanceOf.pattern) {
|
|
593
|
+
updates.pattern = await this.visitDefined(instanceOf.pattern, p) as J;
|
|
594
|
+
}
|
|
595
|
+
if (instanceOf.modifier) {
|
|
596
|
+
updates.modifier = await this.visitDefined(instanceOf.modifier, p) as J.Modifier;
|
|
597
|
+
}
|
|
598
|
+
return updateIfChanged(instanceOf, updates);
|
|
497
599
|
}
|
|
498
600
|
|
|
499
601
|
protected async visitIntersectionType(intersectionType: J.IntersectionType, p: P): Promise<J | undefined> {
|
|
@@ -503,9 +605,12 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
503
605
|
}
|
|
504
606
|
intersectionType = expression as J.IntersectionType;
|
|
505
607
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
608
|
+
const updates: any = {
|
|
609
|
+
prefix: await this.visitSpace(intersectionType.prefix, p),
|
|
610
|
+
markers: await this.visitMarkers(intersectionType.markers, p),
|
|
611
|
+
bounds: await this.visitContainer(intersectionType.bounds, p)
|
|
612
|
+
};
|
|
613
|
+
return updateIfChanged(intersectionType, updates);
|
|
509
614
|
}
|
|
510
615
|
|
|
511
616
|
protected async visitLabel(label: J.Label, p: P): Promise<J | undefined> {
|
|
@@ -515,10 +620,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
515
620
|
}
|
|
516
621
|
label = statement as J.Label;
|
|
517
622
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
623
|
+
const updates: any = {
|
|
624
|
+
prefix: await this.visitSpace(label.prefix, p),
|
|
625
|
+
markers: await this.visitMarkers(label.markers, p),
|
|
626
|
+
label: await this.visitRightPadded(label.label, p),
|
|
627
|
+
statement: await this.visitDefined(label.statement, p) as Statement
|
|
628
|
+
};
|
|
629
|
+
return updateIfChanged(label, updates);
|
|
522
630
|
}
|
|
523
631
|
|
|
524
632
|
protected async visitLambda(lambda: J.Lambda, p: P): Promise<J | undefined> {
|
|
@@ -534,18 +642,24 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
534
642
|
}
|
|
535
643
|
lambda = statement as J.Lambda;
|
|
536
644
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
645
|
+
const updates: any = {
|
|
646
|
+
prefix: await this.visitSpace(lambda.prefix, p),
|
|
647
|
+
markers: await this.visitMarkers(lambda.markers, p),
|
|
648
|
+
parameters: await this.visitDefined(lambda.parameters, p) as J.Lambda.Parameters,
|
|
649
|
+
arrow: await this.visitSpace(lambda.arrow, p),
|
|
650
|
+
body: await this.visitDefined(lambda.body, p) as Statement | Expression,
|
|
651
|
+
type: await this.visitType(lambda.type, p)
|
|
652
|
+
};
|
|
653
|
+
return updateIfChanged(lambda, updates);
|
|
543
654
|
}
|
|
544
655
|
|
|
545
656
|
protected async visitLambdaParameters(params: J.Lambda.Parameters, p: P): Promise<J | undefined> {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
657
|
+
const updates: any = {
|
|
658
|
+
prefix: await this.visitSpace(params.prefix, p),
|
|
659
|
+
markers: await this.visitMarkers(params.markers, p),
|
|
660
|
+
parameters: await mapAsync(params.parameters, param => this.visitRightPadded(param, p))
|
|
661
|
+
};
|
|
662
|
+
return updateIfChanged(params, updates);
|
|
549
663
|
}
|
|
550
664
|
|
|
551
665
|
protected async visitLiteral(literal: J.Literal, p: P): Promise<J | undefined> {
|
|
@@ -555,9 +669,12 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
555
669
|
}
|
|
556
670
|
literal = expression as J.Literal;
|
|
557
671
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
672
|
+
const updates: any = {
|
|
673
|
+
prefix: await this.visitSpace(literal.prefix, p),
|
|
674
|
+
markers: await this.visitMarkers(literal.markers, p),
|
|
675
|
+
type: await this.visitType(literal.type, p) as Type.Primitive | undefined
|
|
676
|
+
};
|
|
677
|
+
return updateIfChanged(literal, updates);
|
|
561
678
|
}
|
|
562
679
|
|
|
563
680
|
protected async visitMemberReference(memberRef: J.MemberReference, p: P): Promise<J | undefined> {
|
|
@@ -567,14 +684,17 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
567
684
|
}
|
|
568
685
|
memberRef = expression as J.MemberReference;
|
|
569
686
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
687
|
+
const updates: any = {
|
|
688
|
+
prefix: await this.visitSpace(memberRef.prefix, p),
|
|
689
|
+
markers: await this.visitMarkers(memberRef.markers, p),
|
|
690
|
+
containing: await this.visitRightPadded(memberRef.containing, p),
|
|
691
|
+
typeParameters: await this.visitOptionalContainer(memberRef.typeParameters, p),
|
|
692
|
+
reference: await this.visitLeftPadded(memberRef.reference, p),
|
|
693
|
+
type: await this.visitType(memberRef.type, p),
|
|
694
|
+
methodType: await this.visitType(memberRef.methodType, p) as Type.Method | undefined,
|
|
695
|
+
variableType: await this.visitType(memberRef.variableType, p) as Type.Variable | undefined
|
|
696
|
+
};
|
|
697
|
+
return updateIfChanged(memberRef, updates);
|
|
578
698
|
}
|
|
579
699
|
|
|
580
700
|
protected async visitMethodDeclaration(method: J.MethodDeclaration, p: P): Promise<J | undefined> {
|
|
@@ -584,26 +704,26 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
584
704
|
}
|
|
585
705
|
method = statement as J.MethodDeclaration;
|
|
586
706
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
707
|
+
const updates: any = {
|
|
708
|
+
prefix: await this.visitSpace(method.prefix, p),
|
|
709
|
+
markers: await this.visitMarkers(method.markers, p),
|
|
710
|
+
leadingAnnotations: await mapAsync(method.leadingAnnotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
711
|
+
modifiers: await mapAsync(method.modifiers, m => this.visitDefined<J.Modifier>(m, p)),
|
|
712
|
+
nameAnnotations: await mapAsync(method.nameAnnotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
713
|
+
name: await this.visitDefined(method.name, p),
|
|
714
|
+
parameters: await this.visitContainer(method.parameters, p),
|
|
715
|
+
throws: method.throws && await this.visitContainer(method.throws, p),
|
|
716
|
+
body: method.body && await this.visitDefined(method.body, p) as J.Block,
|
|
717
|
+
defaultValue: await this.visitOptionalLeftPadded(method.defaultValue, p),
|
|
718
|
+
methodType: await this.visitType(method.methodType, p) as Type.Method | undefined
|
|
719
|
+
};
|
|
720
|
+
if (method.typeParameters) {
|
|
721
|
+
updates.typeParameters = await this.visitDefined(method.typeParameters, p) as J.TypeParameters;
|
|
722
|
+
}
|
|
723
|
+
if (method.returnTypeExpression) {
|
|
724
|
+
updates.returnTypeExpression = await this.visitDefined(method.returnTypeExpression, p) as TypedTree;
|
|
725
|
+
}
|
|
726
|
+
return updateIfChanged(method, updates);
|
|
607
727
|
}
|
|
608
728
|
|
|
609
729
|
protected async visitMethodInvocation(method: J.MethodInvocation, p: P): Promise<J | undefined> {
|
|
@@ -619,25 +739,34 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
619
739
|
}
|
|
620
740
|
method = statement as J.MethodInvocation;
|
|
621
741
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
742
|
+
const updates: any = {
|
|
743
|
+
prefix: await this.visitSpace(method.prefix, p),
|
|
744
|
+
markers: await this.visitMarkers(method.markers, p),
|
|
745
|
+
select: await this.visitOptionalRightPadded(method.select, p),
|
|
746
|
+
typeParameters: await this.visitOptionalContainer(method.typeParameters, p),
|
|
747
|
+
name: await this.visitDefined(method.name, p) as J.Identifier,
|
|
748
|
+
arguments: await this.visitContainer(method.arguments, p),
|
|
749
|
+
methodType: await this.visitType(method.methodType, p) as Type.Method | undefined
|
|
750
|
+
};
|
|
751
|
+
return updateIfChanged(method, updates);
|
|
629
752
|
}
|
|
630
753
|
|
|
631
754
|
protected async visitModifier(modifier: J.Modifier, p: P): Promise<J | undefined> {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
755
|
+
const updates: any = {
|
|
756
|
+
prefix: await this.visitSpace(modifier.prefix, p),
|
|
757
|
+
markers: await this.visitMarkers(modifier.markers, p),
|
|
758
|
+
annotations: await mapAsync(modifier.annotations, a => this.visitDefined<J.Annotation>(a, p))
|
|
759
|
+
};
|
|
760
|
+
return updateIfChanged(modifier, updates);
|
|
635
761
|
}
|
|
636
762
|
|
|
637
763
|
protected async visitMultiCatch(multiCatch: J.MultiCatch, p: P): Promise<J | undefined> {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
764
|
+
const updates: any = {
|
|
765
|
+
prefix: await this.visitSpace(multiCatch.prefix, p),
|
|
766
|
+
markers: await this.visitMarkers(multiCatch.markers, p),
|
|
767
|
+
alternatives: await mapAsync(multiCatch.alternatives, alt => this.visitRightPadded(alt, p))
|
|
768
|
+
};
|
|
769
|
+
return updateIfChanged(multiCatch, updates);
|
|
641
770
|
}
|
|
642
771
|
|
|
643
772
|
protected async visitNewArray(newArray: J.NewArray, p: P): Promise<J | undefined> {
|
|
@@ -647,17 +776,17 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
647
776
|
}
|
|
648
777
|
newArray = expression as J.NewArray;
|
|
649
778
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
779
|
+
const updates: any = {
|
|
780
|
+
prefix: await this.visitSpace(newArray.prefix, p),
|
|
781
|
+
markers: await this.visitMarkers(newArray.markers, p),
|
|
782
|
+
dimensions: await mapAsync(newArray.dimensions, dim => this.visitDefined<J.ArrayDimension>(dim, p)),
|
|
783
|
+
initializer: await this.visitOptionalContainer(newArray.initializer, p),
|
|
784
|
+
type: await this.visitType(newArray.type, p)
|
|
785
|
+
};
|
|
786
|
+
if (newArray.typeExpression) {
|
|
787
|
+
updates.typeExpression = await this.visitDefined(newArray.typeExpression, p) as TypedTree;
|
|
788
|
+
}
|
|
789
|
+
return updateIfChanged(newArray, updates);
|
|
661
790
|
}
|
|
662
791
|
|
|
663
792
|
protected async visitNewClass(newClass: J.NewClass, p: P): Promise<J | undefined> {
|
|
@@ -667,25 +796,23 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
667
796
|
}
|
|
668
797
|
newClass = expression as J.NewClass;
|
|
669
798
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
draft.constructorType = await this.visitType(newClass.constructorType, p) as Type.Method | undefined;
|
|
688
|
-
});
|
|
799
|
+
const updates: any = {
|
|
800
|
+
prefix: await this.visitSpace(newClass.prefix, p),
|
|
801
|
+
markers: await this.visitMarkers(newClass.markers, p),
|
|
802
|
+
new: await this.visitSpace(newClass.new, p),
|
|
803
|
+
arguments: await this.visitContainer(newClass.arguments, p),
|
|
804
|
+
constructorType: await this.visitType(newClass.constructorType, p) as Type.Method | undefined
|
|
805
|
+
};
|
|
806
|
+
if (newClass.enclosing) {
|
|
807
|
+
updates.enclosing = await this.visitRightPadded(newClass.enclosing, p);
|
|
808
|
+
}
|
|
809
|
+
if (newClass.class) {
|
|
810
|
+
updates.class = await this.visitDefined(newClass.class, p) as TypedTree;
|
|
811
|
+
}
|
|
812
|
+
if (newClass.body) {
|
|
813
|
+
updates.body = await this.visitDefined(newClass.body, p) as J.Block;
|
|
814
|
+
}
|
|
815
|
+
return updateIfChanged(newClass, updates);
|
|
689
816
|
}
|
|
690
817
|
|
|
691
818
|
protected async visitNullableType(nullableType: J.NullableType, p: P): Promise<J | undefined> {
|
|
@@ -695,33 +822,45 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
695
822
|
}
|
|
696
823
|
nullableType = expression as J.NullableType;
|
|
697
824
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
825
|
+
const updates: any = {
|
|
826
|
+
prefix: await this.visitSpace(nullableType.prefix, p),
|
|
827
|
+
markers: await this.visitMarkers(nullableType.markers, p),
|
|
828
|
+
annotations: await mapAsync(nullableType.annotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
829
|
+
typeTree: await this.visitRightPadded(nullableType.typeTree, p)
|
|
830
|
+
};
|
|
831
|
+
return updateIfChanged(nullableType, updates);
|
|
702
832
|
}
|
|
703
833
|
|
|
704
834
|
protected async visitPackage(aPackage: J.Package, p: P): Promise<J | undefined> {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
835
|
+
const updates: any = {
|
|
836
|
+
prefix: await this.visitSpace(aPackage.prefix, p),
|
|
837
|
+
markers: await this.visitMarkers(aPackage.markers, p),
|
|
838
|
+
expression: await this.visitDefined(aPackage.expression, p) as Expression
|
|
839
|
+
};
|
|
840
|
+
if (aPackage.annotations) {
|
|
841
|
+
updates.annotations = await mapAsync(aPackage.annotations, a => this.visitDefined<J.Annotation>(a, p));
|
|
842
|
+
}
|
|
843
|
+
return updateIfChanged(aPackage, updates);
|
|
711
844
|
}
|
|
712
845
|
|
|
713
846
|
protected async visitParameterizedType(parameterizedType: J.ParameterizedType, p: P): Promise<J | undefined> {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
847
|
+
const updates: any = {
|
|
848
|
+
prefix: await this.visitSpace(parameterizedType.prefix, p),
|
|
849
|
+
markers: await this.visitMarkers(parameterizedType.markers, p),
|
|
850
|
+
class: await this.visitTypeName(parameterizedType.class, p),
|
|
851
|
+
typeParameters: await this.visitOptionalContainer(parameterizedType.typeParameters, p),
|
|
852
|
+
type: await this.visitType(parameterizedType.type, p)
|
|
853
|
+
};
|
|
854
|
+
return updateIfChanged(parameterizedType, updates);
|
|
719
855
|
}
|
|
720
856
|
|
|
721
857
|
protected async visitParentheses<T extends J>(parentheses: J.Parentheses<T>, p: P): Promise<J | undefined> {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
858
|
+
const updates: any = {
|
|
859
|
+
prefix: await this.visitSpace(parentheses.prefix, p),
|
|
860
|
+
markers: await this.visitMarkers(parentheses.markers, p),
|
|
861
|
+
tree: await this.visitRightPadded(parentheses.tree, p)
|
|
862
|
+
};
|
|
863
|
+
return updateIfChanged(parentheses, updates);
|
|
725
864
|
}
|
|
726
865
|
|
|
727
866
|
protected async visitParenthesizedTypeTree(parTypeTree: J.ParenthesizedTypeTree, p: P): Promise<J | undefined> {
|
|
@@ -731,10 +870,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
731
870
|
}
|
|
732
871
|
parTypeTree = expression as J.ParenthesizedTypeTree;
|
|
733
872
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
873
|
+
const updates: any = {
|
|
874
|
+
prefix: await this.visitSpace(parTypeTree.prefix, p),
|
|
875
|
+
markers: await this.visitMarkers(parTypeTree.markers, p),
|
|
876
|
+
annotations: await mapAsync(parTypeTree.annotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
877
|
+
parenthesizedType: await this.visitDefined(parTypeTree.parenthesizedType, p) as J.Parentheses<TypeTree>
|
|
878
|
+
};
|
|
879
|
+
return updateIfChanged(parTypeTree, updates);
|
|
738
880
|
}
|
|
739
881
|
|
|
740
882
|
protected async visitPrimitive(primitive: J.Primitive, p: P): Promise<J | undefined> {
|
|
@@ -744,9 +886,12 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
744
886
|
}
|
|
745
887
|
primitive = expression as J.Primitive;
|
|
746
888
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
889
|
+
const updates: any = {
|
|
890
|
+
prefix: await this.visitSpace(primitive.prefix, p),
|
|
891
|
+
markers: await this.visitMarkers(primitive.markers, p),
|
|
892
|
+
type: await this.visitType(primitive.type, p) as Type.Primitive
|
|
893
|
+
};
|
|
894
|
+
return updateIfChanged(primitive, updates);
|
|
750
895
|
}
|
|
751
896
|
|
|
752
897
|
protected async visitReturn(ret: J.Return, p: P): Promise<J | undefined> {
|
|
@@ -756,11 +901,14 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
756
901
|
}
|
|
757
902
|
ret = statement as J.Return;
|
|
758
903
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
904
|
+
const updates: any = {
|
|
905
|
+
prefix: await this.visitSpace(ret.prefix, p),
|
|
906
|
+
markers: await this.visitMarkers(ret.markers, p)
|
|
907
|
+
};
|
|
908
|
+
if (ret.expression) {
|
|
909
|
+
updates.expression = await this.visitDefined(ret.expression, p) as Expression;
|
|
910
|
+
}
|
|
911
|
+
return updateIfChanged(ret, updates);
|
|
764
912
|
}
|
|
765
913
|
|
|
766
914
|
protected async visitSwitch(aSwitch: J.Switch, p: P): Promise<J | undefined> {
|
|
@@ -770,10 +918,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
770
918
|
}
|
|
771
919
|
aSwitch = statement as J.Switch;
|
|
772
920
|
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
921
|
+
const updates: any = {
|
|
922
|
+
prefix: await this.visitSpace(aSwitch.prefix, p),
|
|
923
|
+
markers: await this.visitMarkers(aSwitch.markers, p),
|
|
924
|
+
selector: await this.visitDefined(aSwitch.selector, p) as J.ControlParentheses<Expression>,
|
|
925
|
+
cases: await this.visitDefined(aSwitch.cases, p) as J.Block
|
|
926
|
+
};
|
|
927
|
+
return updateIfChanged(aSwitch, updates);
|
|
777
928
|
}
|
|
778
929
|
|
|
779
930
|
protected async visitSwitchExpression(switchExpr: J.SwitchExpression, p: P): Promise<J | undefined> {
|
|
@@ -783,11 +934,14 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
783
934
|
}
|
|
784
935
|
switchExpr = expression as J.SwitchExpression;
|
|
785
936
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
937
|
+
const updates: any = {
|
|
938
|
+
prefix: await this.visitSpace(switchExpr.prefix, p),
|
|
939
|
+
markers: await this.visitMarkers(switchExpr.markers, p),
|
|
940
|
+
selector: await this.visitDefined(switchExpr.selector, p) as J.ControlParentheses<Expression>,
|
|
941
|
+
cases: await this.visitDefined(switchExpr.cases, p) as J.Block,
|
|
942
|
+
type: await this.visitType(switchExpr.type, p)
|
|
943
|
+
};
|
|
944
|
+
return updateIfChanged(switchExpr, updates);
|
|
791
945
|
}
|
|
792
946
|
|
|
793
947
|
protected async visitSynchronized(sync: J.Synchronized, p: P): Promise<J | undefined> {
|
|
@@ -797,10 +951,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
797
951
|
}
|
|
798
952
|
sync = statement as J.Synchronized;
|
|
799
953
|
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
954
|
+
const updates: any = {
|
|
955
|
+
prefix: await this.visitSpace(sync.prefix, p),
|
|
956
|
+
markers: await this.visitMarkers(sync.markers, p),
|
|
957
|
+
lock: await this.visitDefined(sync.lock, p) as J.ControlParentheses<Expression>,
|
|
958
|
+
body: await this.visitDefined(sync.body, p) as J.Block
|
|
959
|
+
};
|
|
960
|
+
return updateIfChanged(sync, updates);
|
|
804
961
|
}
|
|
805
962
|
|
|
806
963
|
protected async visitTernary(ternary: J.Ternary, p: P): Promise<J | undefined> {
|
|
@@ -816,12 +973,15 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
816
973
|
}
|
|
817
974
|
ternary = statement as J.Ternary;
|
|
818
975
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
976
|
+
const updates: any = {
|
|
977
|
+
prefix: await this.visitSpace(ternary.prefix, p),
|
|
978
|
+
markers: await this.visitMarkers(ternary.markers, p),
|
|
979
|
+
condition: await this.visitDefined(ternary.condition, p) as Expression,
|
|
980
|
+
truePart: await this.visitLeftPadded(ternary.truePart, p),
|
|
981
|
+
falsePart: await this.visitLeftPadded(ternary.falsePart, p),
|
|
982
|
+
type: await this.visitType(ternary.type, p)
|
|
983
|
+
};
|
|
984
|
+
return updateIfChanged(ternary, updates);
|
|
825
985
|
}
|
|
826
986
|
|
|
827
987
|
protected async visitThrow(thrown: J.Throw, p: P): Promise<J | undefined> {
|
|
@@ -831,9 +991,12 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
831
991
|
}
|
|
832
992
|
thrown = statement as J.Throw;
|
|
833
993
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
994
|
+
const updates: any = {
|
|
995
|
+
prefix: await this.visitSpace(thrown.prefix, p),
|
|
996
|
+
markers: await this.visitMarkers(thrown.markers, p),
|
|
997
|
+
exception: await this.visitDefined(thrown.exception, p) as Expression
|
|
998
|
+
};
|
|
999
|
+
return updateIfChanged(thrown, updates);
|
|
837
1000
|
}
|
|
838
1001
|
|
|
839
1002
|
protected async visitTry(tryable: J.Try, p: P): Promise<J | undefined> {
|
|
@@ -843,25 +1006,34 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
843
1006
|
}
|
|
844
1007
|
tryable = statement as J.Try;
|
|
845
1008
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1009
|
+
const updates: any = {
|
|
1010
|
+
prefix: await this.visitSpace(tryable.prefix, p),
|
|
1011
|
+
markers: await this.visitMarkers(tryable.markers, p),
|
|
1012
|
+
resources: await this.visitOptionalContainer(tryable.resources, p),
|
|
1013
|
+
body: await this.visitDefined(tryable.body, p) as J.Block,
|
|
1014
|
+
catches: await mapAsync(tryable.catches, c => this.visitDefined<J.Try.Catch>(c, p)),
|
|
1015
|
+
finally: await this.visitOptionalLeftPadded(tryable.finally, p)
|
|
1016
|
+
};
|
|
1017
|
+
return updateIfChanged(tryable, updates);
|
|
852
1018
|
}
|
|
853
1019
|
|
|
854
1020
|
protected async visitTryResource(resource: J.Try.Resource, p: P): Promise<J | undefined> {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1021
|
+
const updates: any = {
|
|
1022
|
+
prefix: await this.visitSpace(resource.prefix, p),
|
|
1023
|
+
markers: await this.visitMarkers(resource.markers, p),
|
|
1024
|
+
variableDeclarations: await this.visitDefined(resource.variableDeclarations, p) as TypedTree
|
|
1025
|
+
};
|
|
1026
|
+
return updateIfChanged(resource, updates);
|
|
858
1027
|
}
|
|
859
1028
|
|
|
860
1029
|
protected async visitTryCatch(tryCatch: J.Try.Catch, p: P): Promise<J | undefined> {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1030
|
+
const updates: any = {
|
|
1031
|
+
prefix: await this.visitSpace(tryCatch.prefix, p),
|
|
1032
|
+
markers: await this.visitMarkers(tryCatch.markers, p),
|
|
1033
|
+
parameter: await this.visitDefined(tryCatch.parameter, p) as J.ControlParentheses<J.VariableDeclarations>,
|
|
1034
|
+
body: await this.visitDefined(tryCatch.body, p) as J.Block
|
|
1035
|
+
};
|
|
1036
|
+
return updateIfChanged(tryCatch, updates);
|
|
865
1037
|
}
|
|
866
1038
|
|
|
867
1039
|
protected async visitTypeCast(typeCast: J.TypeCast, p: P): Promise<J | undefined> {
|
|
@@ -871,26 +1043,35 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
871
1043
|
}
|
|
872
1044
|
typeCast = expression as J.TypeCast;
|
|
873
1045
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1046
|
+
const updates: any = {
|
|
1047
|
+
prefix: await this.visitSpace(typeCast.prefix, p),
|
|
1048
|
+
markers: await this.visitMarkers(typeCast.markers, p),
|
|
1049
|
+
class: await this.visitDefined(typeCast.class, p) as J.ControlParentheses<TypedTree>,
|
|
1050
|
+
expression: await this.visitDefined(typeCast.expression, p) as Expression
|
|
1051
|
+
};
|
|
1052
|
+
return updateIfChanged(typeCast, updates);
|
|
878
1053
|
}
|
|
879
1054
|
|
|
880
1055
|
protected async visitTypeParameter(typeParam: J.TypeParameter, p: P): Promise<J | undefined> {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1056
|
+
const updates: any = {
|
|
1057
|
+
prefix: await this.visitSpace(typeParam.prefix, p),
|
|
1058
|
+
markers: await this.visitMarkers(typeParam.markers, p),
|
|
1059
|
+
annotations: await mapAsync(typeParam.annotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
1060
|
+
modifiers: await mapAsync(typeParam.modifiers, m => this.visitDefined<J.Modifier>(m, p)),
|
|
1061
|
+
name: await this.visitDefined(typeParam.name, p) as J.Identifier,
|
|
1062
|
+
bounds: await this.visitOptionalContainer(typeParam.bounds, p)
|
|
1063
|
+
};
|
|
1064
|
+
return updateIfChanged(typeParam, updates);
|
|
887
1065
|
}
|
|
888
1066
|
|
|
889
1067
|
protected async visitTypeParameters(typeParams: J.TypeParameters, p: P): Promise<J | undefined> {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1068
|
+
const updates: any = {
|
|
1069
|
+
prefix: await this.visitSpace(typeParams.prefix, p),
|
|
1070
|
+
markers: await this.visitMarkers(typeParams.markers, p),
|
|
1071
|
+
annotations: await mapAsync(typeParams.annotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
1072
|
+
typeParameters: await mapAsync(typeParams.typeParameters, tp => this.visitRightPadded(tp, p))
|
|
1073
|
+
};
|
|
1074
|
+
return updateIfChanged(typeParams, updates);
|
|
894
1075
|
}
|
|
895
1076
|
|
|
896
1077
|
protected async visitUnary(unary: J.Unary, p: P): Promise<J | undefined> {
|
|
@@ -906,11 +1087,14 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
906
1087
|
}
|
|
907
1088
|
unary = statement as J.Unary;
|
|
908
1089
|
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
1090
|
+
const updates: any = {
|
|
1091
|
+
prefix: await this.visitSpace(unary.prefix, p),
|
|
1092
|
+
markers: await this.visitMarkers(unary.markers, p),
|
|
1093
|
+
operator: await this.visitLeftPadded(unary.operator, p),
|
|
1094
|
+
expression: await this.visitDefined(unary.expression, p) as Expression,
|
|
1095
|
+
type: await this.visitType(unary.type, p)
|
|
1096
|
+
};
|
|
1097
|
+
return updateIfChanged(unary, updates);
|
|
914
1098
|
}
|
|
915
1099
|
|
|
916
1100
|
protected async visitUnknown(unknown: J.Unknown, p: P): Promise<J | undefined> {
|
|
@@ -926,13 +1110,20 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
926
1110
|
}
|
|
927
1111
|
unknown = statement as J.Unknown;
|
|
928
1112
|
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1113
|
+
const updates: any = {
|
|
1114
|
+
prefix: await this.visitSpace(unknown.prefix, p),
|
|
1115
|
+
markers: await this.visitMarkers(unknown.markers, p),
|
|
1116
|
+
source: await this.visitDefined(unknown.source, p) as J.UnknownSource
|
|
1117
|
+
};
|
|
1118
|
+
return updateIfChanged(unknown, updates);
|
|
932
1119
|
}
|
|
933
1120
|
|
|
934
1121
|
protected async visitUnknownSource(source: J.UnknownSource, p: P): Promise<J | undefined> {
|
|
935
|
-
|
|
1122
|
+
const updates: any = {
|
|
1123
|
+
prefix: await this.visitSpace(source.prefix, p),
|
|
1124
|
+
markers: await this.visitMarkers(source.markers, p)
|
|
1125
|
+
};
|
|
1126
|
+
return updateIfChanged(source, updates);
|
|
936
1127
|
}
|
|
937
1128
|
|
|
938
1129
|
protected async visitVariableDeclarations(varDecls: J.VariableDeclarations, p: P): Promise<J | undefined> {
|
|
@@ -942,29 +1133,32 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
942
1133
|
}
|
|
943
1134
|
varDecls = statement as J.VariableDeclarations;
|
|
944
1135
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1136
|
+
const updates: any = {
|
|
1137
|
+
prefix: await this.visitSpace(varDecls.prefix, p),
|
|
1138
|
+
markers: await this.visitMarkers(varDecls.markers, p),
|
|
1139
|
+
leadingAnnotations: await mapAsync(varDecls.leadingAnnotations, a => this.visitDefined<J.Annotation>(a, p)),
|
|
1140
|
+
modifiers: await mapAsync(varDecls.modifiers, m => this.visitDefined<J.Modifier>(m, p)),
|
|
1141
|
+
variables: await mapAsync(varDecls.variables, v => this.visitRightPadded(v, p))
|
|
1142
|
+
};
|
|
1143
|
+
if (varDecls.typeExpression) {
|
|
1144
|
+
updates.typeExpression = await this.visitDefined(varDecls.typeExpression, p) as TypedTree;
|
|
1145
|
+
}
|
|
1146
|
+
if (varDecls.varargs) {
|
|
1147
|
+
updates.varargs = await this.visitSpace(varDecls.varargs, p);
|
|
1148
|
+
}
|
|
1149
|
+
return updateIfChanged(varDecls, updates);
|
|
959
1150
|
}
|
|
960
1151
|
|
|
961
1152
|
protected async visitVariable(variable: J.VariableDeclarations.NamedVariable, p: P): Promise<J | undefined> {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1153
|
+
const updates: any = {
|
|
1154
|
+
prefix: await this.visitSpace(variable.prefix, p),
|
|
1155
|
+
markers: await this.visitMarkers(variable.markers, p),
|
|
1156
|
+
name: await this.visitDefined(variable.name, p) as J.Identifier,
|
|
1157
|
+
dimensionsAfterName: await mapAsync(variable.dimensionsAfterName, dim => this.visitLeftPadded(dim, p)),
|
|
1158
|
+
initializer: await this.visitOptionalLeftPadded(variable.initializer, p),
|
|
1159
|
+
variableType: await this.visitType(variable.variableType, p) as Type.Variable | undefined
|
|
1160
|
+
};
|
|
1161
|
+
return updateIfChanged(variable, updates);
|
|
968
1162
|
}
|
|
969
1163
|
|
|
970
1164
|
protected async visitWhileLoop(whileLoop: J.WhileLoop, p: P): Promise<J | undefined> {
|
|
@@ -974,10 +1168,13 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
974
1168
|
}
|
|
975
1169
|
whileLoop = statement as J.WhileLoop;
|
|
976
1170
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1171
|
+
const updates: any = {
|
|
1172
|
+
prefix: await this.visitSpace(whileLoop.prefix, p),
|
|
1173
|
+
markers: await this.visitMarkers(whileLoop.markers, p),
|
|
1174
|
+
condition: await this.visitDefined(whileLoop.condition, p) as J.ControlParentheses<Expression>,
|
|
1175
|
+
body: await this.visitRightPadded(whileLoop.body, p)
|
|
1176
|
+
};
|
|
1177
|
+
return updateIfChanged(whileLoop, updates);
|
|
981
1178
|
}
|
|
982
1179
|
|
|
983
1180
|
protected async visitWildcard(wildcard: J.Wildcard, p: P): Promise<J | undefined> {
|
|
@@ -987,12 +1184,15 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
987
1184
|
}
|
|
988
1185
|
wildcard = expression as J.Wildcard;
|
|
989
1186
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1187
|
+
const updates: any = {
|
|
1188
|
+
prefix: await this.visitSpace(wildcard.prefix, p),
|
|
1189
|
+
markers: await this.visitMarkers(wildcard.markers, p),
|
|
1190
|
+
bound: await this.visitOptionalLeftPadded(wildcard.bound, p)
|
|
1191
|
+
};
|
|
1192
|
+
if (wildcard.boundedType) {
|
|
1193
|
+
updates.boundedType = await this.visitTypeName(wildcard.boundedType, p);
|
|
1194
|
+
}
|
|
1195
|
+
return updateIfChanged(wildcard, updates);
|
|
996
1196
|
}
|
|
997
1197
|
|
|
998
1198
|
protected async visitYield(aYield: J.Yield, p: P): Promise<J | undefined> {
|
|
@@ -1002,9 +1202,12 @@ export class JavaVisitor<P> extends TreeVisitor<J, P> {
|
|
|
1002
1202
|
}
|
|
1003
1203
|
aYield = statement as J.Yield;
|
|
1004
1204
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1205
|
+
const updates: any = {
|
|
1206
|
+
prefix: await this.visitSpace(aYield.prefix, p),
|
|
1207
|
+
markers: await this.visitMarkers(aYield.markers, p),
|
|
1208
|
+
value: await this.visitDefined(aYield.value, p) as Expression
|
|
1209
|
+
};
|
|
1210
|
+
return updateIfChanged(aYield, updates);
|
|
1008
1211
|
}
|
|
1009
1212
|
|
|
1010
1213
|
protected async visitOptionalRightPadded<T extends J | boolean>(right: J.RightPadded<T> | undefined, p: P): Promise<J.RightPadded<T> | undefined> {
|