@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/dist/java/rpc.js
CHANGED
|
@@ -29,9 +29,270 @@ exports.registerJLanguageCodecs = registerJLanguageCodecs;
|
|
|
29
29
|
const visitor_1 = require("./visitor");
|
|
30
30
|
const rpc_1 = require("../rpc");
|
|
31
31
|
const tree_1 = require("./tree");
|
|
32
|
-
const visitor_2 = require("../visitor");
|
|
33
|
-
const immer_1 = require("immer");
|
|
34
32
|
const tree_2 = require("../tree");
|
|
33
|
+
const type_1 = require("./type");
|
|
34
|
+
const type_visitor_1 = require("./type-visitor");
|
|
35
|
+
const util_1 = require("../util");
|
|
36
|
+
class TypeSender extends type_visitor_1.TypeVisitor {
|
|
37
|
+
visitPrimitive(primitive, q) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
yield q.getAndSend(primitive, p => p.keyword);
|
|
40
|
+
return primitive;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
visitClass(cls, q) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
yield q.getAndSend(cls, c => c.flags);
|
|
46
|
+
yield q.getAndSend(cls, c => c.classKind);
|
|
47
|
+
yield q.getAndSend(cls, c => c.fullyQualifiedName);
|
|
48
|
+
yield q.getAndSendList(cls, c => (c.typeParameters || []).map(t => (0, rpc_1.asRef)(t)), t => type_1.Type.signature(t), t => this.visit(t, q));
|
|
49
|
+
yield q.getAndSend(cls, c => (0, rpc_1.asRef)(c.supertype), st => this.visit(st, q));
|
|
50
|
+
yield q.getAndSend(cls, c => (0, rpc_1.asRef)(c.owningClass), oc => this.visit(oc, q));
|
|
51
|
+
yield q.getAndSendList(cls, c => (c.annotations || []).map(a => (0, rpc_1.asRef)(a)), t => type_1.Type.signature(t), a => this.visit(a, q));
|
|
52
|
+
yield q.getAndSendList(cls, c => (c.interfaces || []).map(i => (0, rpc_1.asRef)(i)), t => type_1.Type.signature(t), i => this.visit(i, q));
|
|
53
|
+
yield q.getAndSendList(cls, c => (c.members || []).map(m => (0, rpc_1.asRef)(m)), t => type_1.Type.signature(t), m => this.visit(m, q));
|
|
54
|
+
yield q.getAndSendList(cls, c => (c.methods || []).map(m => (0, rpc_1.asRef)(m)), t => type_1.Type.signature(t), m => this.visit(m, q));
|
|
55
|
+
return cls;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
visitVariable(variable, q) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
yield q.getAndSend(variable, v => v.name);
|
|
61
|
+
yield q.getAndSend(variable, v => v.owner ? (0, rpc_1.asRef)(v.owner) : undefined, owner => this.visit(owner, q));
|
|
62
|
+
yield q.getAndSend(variable, v => (0, rpc_1.asRef)(v.type), t => this.visit(t, q));
|
|
63
|
+
yield q.getAndSendList(variable, v => (v.annotations || []).map(v2 => (0, rpc_1.asRef)(v2)), t => type_1.Type.signature(t), a => this.visit(a, q));
|
|
64
|
+
return variable;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
visitAnnotation(annotation, q) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
yield q.getAndSend(annotation, a => (0, rpc_1.asRef)(a.type), t => this.visit(t, q));
|
|
70
|
+
// await q.getAndSendList(annotation, a => (a.values || []).map(v => asRef(v)), v => {
|
|
71
|
+
// let value: any;
|
|
72
|
+
// if (v.kind === Type.Kind.SingleElementValue) {
|
|
73
|
+
// const single = v as Type.Annotation.SingleElementValue;
|
|
74
|
+
// value = single.constantValue !== undefined ? single.constantValue : single.referenceValue;
|
|
75
|
+
// } else {
|
|
76
|
+
// const array = v as Type.Annotation.ArrayElementValue;
|
|
77
|
+
// value = array.constantValues || array.referenceValues;
|
|
78
|
+
// }
|
|
79
|
+
// return `${Type.signature(v.element)}:${value == null ? "null" : value.toString()}`;
|
|
80
|
+
// }, async v => {
|
|
81
|
+
// // Handle element values inline like the Java implementation
|
|
82
|
+
// await q.getAndSend(v, e => asRef(e.element), elem => this.visit(elem, q));
|
|
83
|
+
// if (v.kind === Type.Kind.SingleElementValue) {
|
|
84
|
+
// const single = v as Type.Annotation.SingleElementValue;
|
|
85
|
+
// await q.getAndSend(single, s => s.constantValue);
|
|
86
|
+
// await q.getAndSend(single, s => asRef(s.referenceValue), ref => this.visit(ref, q));
|
|
87
|
+
// } else if (v.kind === Type.Kind.ArrayElementValue) {
|
|
88
|
+
// const array = v as Type.Annotation.ArrayElementValue;
|
|
89
|
+
// await q.getAndSendList(array, a => a.constantValues || [], val => val == null ? "null" : val.toString());
|
|
90
|
+
// await q.getAndSendList(array, a => (a.referenceValues || []).map(r => asRef(r)), t => Type.signature(t), r => this.visit(r, q));
|
|
91
|
+
// }
|
|
92
|
+
// });
|
|
93
|
+
return annotation;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
visitMethod(method, q) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
yield q.getAndSend(method, m => (0, rpc_1.asRef)(m.declaringType), dt => this.visit(dt, q));
|
|
99
|
+
yield q.getAndSend(method, m => m.name);
|
|
100
|
+
yield q.getAndSend(method, m => m.flags);
|
|
101
|
+
yield q.getAndSend(method, m => (0, rpc_1.asRef)(m.returnType), rt => this.visit(rt, q));
|
|
102
|
+
yield q.getAndSendList(method, m => m.parameterNames || [], v => v);
|
|
103
|
+
yield q.getAndSendList(method, m => (m.parameterTypes || []).map(t => (0, rpc_1.asRef)(t)), t => type_1.Type.signature(t), pt => this.visit(pt, q));
|
|
104
|
+
yield q.getAndSendList(method, m => (m.thrownExceptions || []).map(t => (0, rpc_1.asRef)(t)), t => type_1.Type.signature(t), et => this.visit(et, q));
|
|
105
|
+
yield q.getAndSendList(method, m => (m.annotations || []).map(a => (0, rpc_1.asRef)(a)), t => type_1.Type.signature(t), a => this.visit(a, q));
|
|
106
|
+
yield q.getAndSendList(method, m => m.defaultValue || undefined, v => v);
|
|
107
|
+
yield q.getAndSendList(method, m => m.declaredFormalTypeNames || [], v => v);
|
|
108
|
+
return method;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
visitArray(array, q) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
yield q.getAndSend(array, a => (0, rpc_1.asRef)(a.elemType), et => this.visit(et, q));
|
|
114
|
+
yield q.getAndSendList(array, a => (a.annotations || []).map(ann => (0, rpc_1.asRef)(ann)), t => type_1.Type.signature(t), ann => this.visit(ann, q));
|
|
115
|
+
return array;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
visitParameterized(parameterized, q) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
yield q.getAndSend(parameterized, p => (0, rpc_1.asRef)(p.type), t => this.visit(t, q));
|
|
121
|
+
yield q.getAndSendList(parameterized, p => (p.typeParameters || []).map(tp => (0, rpc_1.asRef)(tp)), t => type_1.Type.signature(t), tp => this.visit(tp, q));
|
|
122
|
+
return parameterized;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
visitGenericTypeVariable(generic, q) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
yield q.getAndSend(generic, g => g.name);
|
|
128
|
+
// Convert TypeScript enum to Java enum string
|
|
129
|
+
yield q.getAndSend(generic, g => {
|
|
130
|
+
switch (g.variance) {
|
|
131
|
+
case type_1.Type.GenericTypeVariable.Variance.Covariant:
|
|
132
|
+
return 'COVARIANT';
|
|
133
|
+
case type_1.Type.GenericTypeVariable.Variance.Contravariant:
|
|
134
|
+
return 'CONTRAVARIANT';
|
|
135
|
+
case type_1.Type.GenericTypeVariable.Variance.Invariant:
|
|
136
|
+
default:
|
|
137
|
+
return 'INVARIANT';
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
yield q.getAndSendList(generic, g => (g.bounds || []).map(b => (0, rpc_1.asRef)(b)), t => type_1.Type.signature(t), b => this.visit(b, q));
|
|
141
|
+
return generic;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
visitUnion(union, q) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
yield q.getAndSendList(union, u => (u.bounds || []).map(b => (0, rpc_1.asRef)(b)), t => type_1.Type.signature(t), b => this.visit(b, q));
|
|
147
|
+
return union;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
visitIntersection(intersection, q) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
yield q.getAndSendList(intersection, i => (i.bounds || []).map(b => (0, rpc_1.asRef)(b)), t => type_1.Type.signature(t), b => this.visit(b, q));
|
|
153
|
+
return intersection;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
class TypeReceiver extends type_visitor_1.TypeVisitor {
|
|
158
|
+
preVisit(_type, _q) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
// Don't call default preVisit to avoid circular references
|
|
161
|
+
return _type;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
postVisit(_type, _q) {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
// Don't call default postVisit to avoid circular references
|
|
167
|
+
return _type;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
visitPrimitive(primitive, q) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
const keyword = yield q.receive(primitive.keyword);
|
|
173
|
+
return type_1.Type.Primitive.fromKeyword(keyword);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
visitClass(cls, q) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
cls.flags = yield q.receive(cls.flags);
|
|
179
|
+
cls.classKind = yield q.receive(cls.classKind);
|
|
180
|
+
cls.fullyQualifiedName = yield q.receive(cls.fullyQualifiedName);
|
|
181
|
+
cls.typeParameters = (yield q.receiveList(cls.typeParameters, tp => this.visit(tp, q))) || [];
|
|
182
|
+
cls.supertype = yield q.receive(cls.supertype, st => this.visit(st, q));
|
|
183
|
+
cls.owningClass = yield q.receive(cls.owningClass, oc => this.visit(oc, q));
|
|
184
|
+
cls.annotations = (yield q.receiveList(cls.annotations, a => this.visit(a, q))) || [];
|
|
185
|
+
cls.interfaces = (yield q.receiveList(cls.interfaces, i => this.visit(i, q))) || [];
|
|
186
|
+
cls.members = (yield q.receiveList(cls.members, m => this.visit(m, q))) || [];
|
|
187
|
+
cls.methods = (yield q.receiveList(cls.methods, m => this.visit(m, q))) || [];
|
|
188
|
+
return cls;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
visitVariable(variable, q) {
|
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
variable.name = yield q.receive(variable.name);
|
|
194
|
+
variable.owner = yield q.receive(variable.owner, owner => this.visit(owner, q));
|
|
195
|
+
variable.type = yield q.receive(variable.type, t => this.visit(t, q));
|
|
196
|
+
variable.annotations = (yield q.receiveList(variable.annotations, a => this.visit(a, q))) || [];
|
|
197
|
+
return variable;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
visitAnnotation(annotation, q) {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
annotation.type = yield q.receive(annotation.type, t => this.visit(t, q));
|
|
203
|
+
// annotation.values = await q.receiveList(annotation.values, async v => {
|
|
204
|
+
// // Handle element values inline like the Java implementation
|
|
205
|
+
// if (v.kind === Type.Kind.SingleElementValue) {
|
|
206
|
+
// const single = v as Type.Annotation.SingleElementValue;
|
|
207
|
+
// const element = await q.receive(single.element, elem => this.visit(elem, q));
|
|
208
|
+
// const constantValue = await q.receive(single.constantValue);
|
|
209
|
+
// const referenceValue = await q.receive(single.referenceValue, ref => this.visit(ref, q));
|
|
210
|
+
// return {
|
|
211
|
+
// kind: Type.Kind.SingleElementValue,
|
|
212
|
+
// element,
|
|
213
|
+
// constantValue,
|
|
214
|
+
// referenceValue
|
|
215
|
+
// } as Type.Annotation.SingleElementValue;
|
|
216
|
+
// } else if (v.kind === Type.Kind.ArrayElementValue) {
|
|
217
|
+
// const array = v as Type.Annotation.ArrayElementValue;
|
|
218
|
+
// const element = await q.receive(array.element, elem => this.visit(elem, q));
|
|
219
|
+
// const constantValues = await q.receiveList(array.constantValues);
|
|
220
|
+
// const referenceValues = await q.receiveList(array.referenceValues, r => this.visit(r, q));
|
|
221
|
+
// return {
|
|
222
|
+
// kind: Type.Kind.ArrayElementValue,
|
|
223
|
+
// element,
|
|
224
|
+
// constantValues,
|
|
225
|
+
// referenceValues
|
|
226
|
+
// } as Type.Annotation.ArrayElementValue;
|
|
227
|
+
// }
|
|
228
|
+
// return v;
|
|
229
|
+
// }) || [];
|
|
230
|
+
return annotation;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
visitMethod(method, q) {
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
method.declaringType = yield q.receive(method.declaringType, dt => this.visit(dt, q));
|
|
236
|
+
method.name = yield q.receive(method.name);
|
|
237
|
+
method.flags = yield q.receive(method.flags);
|
|
238
|
+
method.returnType = yield q.receive(method.returnType, rt => this.visit(rt, q));
|
|
239
|
+
method.parameterNames = (yield q.receiveList(method.parameterNames)) || [];
|
|
240
|
+
method.parameterTypes = (yield q.receiveList(method.parameterTypes, pt => this.visit(pt, q))) || [];
|
|
241
|
+
method.thrownExceptions = (yield q.receiveList(method.thrownExceptions, et => this.visit(et, q))) || [];
|
|
242
|
+
method.annotations = (yield q.receiveList(method.annotations, a => this.visit(a, q))) || [];
|
|
243
|
+
method.defaultValue = yield q.receiveList(method.defaultValue);
|
|
244
|
+
method.declaredFormalTypeNames = (yield q.receiveList(method.declaredFormalTypeNames)) || [];
|
|
245
|
+
return method;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
visitArray(array, q) {
|
|
249
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
+
array.elemType = yield q.receive(array.elemType, et => this.visit(et, q));
|
|
251
|
+
array.annotations = (yield q.receiveList(array.annotations, ann => this.visit(ann, q))) || [];
|
|
252
|
+
return array;
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
visitParameterized(parameterized, q) {
|
|
256
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
257
|
+
parameterized.type = yield q.receive(parameterized.type, t => this.visit(t, q));
|
|
258
|
+
parameterized.typeParameters = (yield q.receiveList(parameterized.typeParameters, tp => this.visit(tp, q))) || [];
|
|
259
|
+
return parameterized;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
visitGenericTypeVariable(generic, q) {
|
|
263
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
generic.name = yield q.receive(generic.name);
|
|
265
|
+
const varianceStr = yield q.receive(generic.variance);
|
|
266
|
+
// Convert Java enum string to TypeScript enum
|
|
267
|
+
switch (varianceStr) {
|
|
268
|
+
case 'COVARIANT':
|
|
269
|
+
generic.variance = type_1.Type.GenericTypeVariable.Variance.Covariant;
|
|
270
|
+
break;
|
|
271
|
+
case 'CONTRAVARIANT':
|
|
272
|
+
generic.variance = type_1.Type.GenericTypeVariable.Variance.Contravariant;
|
|
273
|
+
break;
|
|
274
|
+
case 'INVARIANT':
|
|
275
|
+
default:
|
|
276
|
+
generic.variance = type_1.Type.GenericTypeVariable.Variance.Invariant;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
generic.bounds = (yield q.receiveList(generic.bounds, b => this.visit(b, q))) || [];
|
|
280
|
+
return generic;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
visitUnion(union, q) {
|
|
284
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
285
|
+
union.bounds = (yield q.receiveList(union.bounds, b => this.visit(b, q))) || [];
|
|
286
|
+
return union;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
visitIntersection(intersection, q) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
intersection.bounds = (yield q.receiveList(intersection.bounds, b => this.visit(b, q))) || [];
|
|
292
|
+
return intersection;
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
35
296
|
class JavaSender extends visitor_1.JavaVisitor {
|
|
36
297
|
preVisit(j, q) {
|
|
37
298
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -663,22 +924,25 @@ class JavaSender extends visitor_1.JavaVisitor {
|
|
|
663
924
|
}
|
|
664
925
|
visitType(javaType, q) {
|
|
665
926
|
return __awaiter(this, void 0, void 0, function* () {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
927
|
+
if (!javaType) {
|
|
928
|
+
return undefined;
|
|
929
|
+
}
|
|
930
|
+
return yield JavaSender.typeVisitor.visit(javaType, q);
|
|
669
931
|
});
|
|
670
932
|
}
|
|
671
933
|
}
|
|
672
934
|
exports.JavaSender = JavaSender;
|
|
935
|
+
JavaSender.typeVisitor = new TypeSender();
|
|
673
936
|
class JavaReceiver extends visitor_1.JavaVisitor {
|
|
674
937
|
preVisit(j, q) {
|
|
675
938
|
return __awaiter(this, void 0, void 0, function* () {
|
|
676
939
|
try {
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
940
|
+
const updates = {
|
|
941
|
+
id: yield q.receive(j.id),
|
|
942
|
+
prefix: yield q.receive(j.prefix, space => this.visitSpace(space, q)),
|
|
943
|
+
markers: yield q.receive(j.markers)
|
|
944
|
+
};
|
|
945
|
+
return (0, util_1.updateIfChanged)(j, updates);
|
|
682
946
|
}
|
|
683
947
|
catch (e) {
|
|
684
948
|
throw e;
|
|
@@ -687,129 +951,144 @@ class JavaReceiver extends visitor_1.JavaVisitor {
|
|
|
687
951
|
}
|
|
688
952
|
visitAnnotatedType(annotatedType, q) {
|
|
689
953
|
return __awaiter(this, void 0, void 0, function* () {
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
954
|
+
const updates = {
|
|
955
|
+
annotations: yield q.receiveListDefined(annotatedType.annotations, annot => this.visit(annot, q)),
|
|
956
|
+
typeExpression: yield q.receive(annotatedType.typeExpression, type => this.visit(type, q))
|
|
957
|
+
};
|
|
958
|
+
return (0, util_1.updateIfChanged)(annotatedType, updates);
|
|
694
959
|
});
|
|
695
960
|
}
|
|
696
961
|
visitAnnotation(annotation, q) {
|
|
697
962
|
return __awaiter(this, void 0, void 0, function* () {
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
963
|
+
const updates = {
|
|
964
|
+
annotationType: yield q.receive(annotation.annotationType, type => this.visit(type, q)),
|
|
965
|
+
arguments: yield q.receive(annotation.arguments, args => this.visitContainer(args, q))
|
|
966
|
+
};
|
|
967
|
+
return (0, util_1.updateIfChanged)(annotation, updates);
|
|
702
968
|
});
|
|
703
969
|
}
|
|
704
970
|
visitArrayAccess(arrayAccess, q) {
|
|
705
971
|
return __awaiter(this, void 0, void 0, function* () {
|
|
706
|
-
const
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
972
|
+
const updates = {
|
|
973
|
+
indexed: yield q.receive(arrayAccess.indexed, indexed => this.visit(indexed, q)),
|
|
974
|
+
dimension: yield q.receive(arrayAccess.dimension, dim => this.visit(dim, q))
|
|
975
|
+
};
|
|
976
|
+
return (0, util_1.updateIfChanged)(arrayAccess, updates);
|
|
710
977
|
});
|
|
711
978
|
}
|
|
712
979
|
visitArrayDimension(dimension, q) {
|
|
713
980
|
return __awaiter(this, void 0, void 0, function* () {
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
|
|
981
|
+
const updates = {
|
|
982
|
+
index: yield q.receive(dimension.index, idx => this.visitRightPadded(idx, q))
|
|
983
|
+
};
|
|
984
|
+
return (0, util_1.updateIfChanged)(dimension, updates);
|
|
717
985
|
});
|
|
718
986
|
}
|
|
719
987
|
visitArrayType(arrayType, q) {
|
|
720
988
|
return __awaiter(this, void 0, void 0, function* () {
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
989
|
+
const updates = {
|
|
990
|
+
elementType: yield q.receive(arrayType.elementType, type => this.visit(type, q)),
|
|
991
|
+
annotations: yield q.receiveListDefined(arrayType.annotations || [], annot => this.visit(annot, q)),
|
|
992
|
+
dimension: yield q.receive(arrayType.dimension, d => this.visitLeftPadded(d, q)),
|
|
993
|
+
type: yield q.receive(arrayType.type, type => this.visitType(type, q))
|
|
994
|
+
};
|
|
995
|
+
return (0, util_1.updateIfChanged)(arrayType, updates);
|
|
727
996
|
});
|
|
728
997
|
}
|
|
729
998
|
visitAssert(assert, q) {
|
|
730
999
|
return __awaiter(this, void 0, void 0, function* () {
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
1000
|
+
const updates = {
|
|
1001
|
+
condition: yield q.receive(assert.condition, cond => this.visit(cond, q)),
|
|
1002
|
+
detail: yield q.receive(assert.detail, detail => this.visitOptionalLeftPadded(detail, q))
|
|
1003
|
+
};
|
|
1004
|
+
return (0, util_1.updateIfChanged)(assert, updates);
|
|
735
1005
|
});
|
|
736
1006
|
}
|
|
737
1007
|
visitAssignment(assignment, q) {
|
|
738
1008
|
return __awaiter(this, void 0, void 0, function* () {
|
|
739
|
-
const
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
1009
|
+
const updates = {
|
|
1010
|
+
variable: yield q.receive(assignment.variable, variable => this.visit(variable, q)),
|
|
1011
|
+
assignment: yield q.receive(assignment.assignment, assign => this.visitLeftPadded(assign, q)),
|
|
1012
|
+
type: yield q.receive(assignment.type, type => this.visitType(type, q))
|
|
1013
|
+
};
|
|
1014
|
+
return (0, util_1.updateIfChanged)(assignment, updates);
|
|
744
1015
|
});
|
|
745
1016
|
}
|
|
746
1017
|
visitAssignmentOperation(assignOp, q) {
|
|
747
1018
|
return __awaiter(this, void 0, void 0, function* () {
|
|
748
|
-
const
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1019
|
+
const updates = {
|
|
1020
|
+
variable: yield q.receive(assignOp.variable, variable => this.visit(variable, q)),
|
|
1021
|
+
operator: yield q.receive(assignOp.operator, op => this.visitLeftPadded(op, q)),
|
|
1022
|
+
assignment: yield q.receive(assignOp.assignment, assign => this.visit(assign, q)),
|
|
1023
|
+
type: yield q.receive(assignOp.type, type => this.visitType(type, q))
|
|
1024
|
+
};
|
|
1025
|
+
return (0, util_1.updateIfChanged)(assignOp, updates);
|
|
754
1026
|
});
|
|
755
1027
|
}
|
|
756
1028
|
visitBinary(binary, q) {
|
|
757
1029
|
return __awaiter(this, void 0, void 0, function* () {
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
1030
|
+
const updates = {
|
|
1031
|
+
left: yield q.receive(binary.left, left => this.visit(left, q)),
|
|
1032
|
+
operator: yield q.receive(binary.operator, op => this.visitLeftPadded(op, q)),
|
|
1033
|
+
right: yield q.receive(binary.right, right => this.visit(right, q)),
|
|
1034
|
+
type: yield q.receive(binary.type, type => this.visitType(type, q))
|
|
1035
|
+
};
|
|
1036
|
+
return (0, util_1.updateIfChanged)(binary, updates);
|
|
764
1037
|
});
|
|
765
1038
|
}
|
|
766
1039
|
visitBreak(breakStmt, q) {
|
|
767
1040
|
return __awaiter(this, void 0, void 0, function* () {
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
|
|
1041
|
+
const updates = {
|
|
1042
|
+
label: yield q.receive(breakStmt.label, label => this.visit(label, q))
|
|
1043
|
+
};
|
|
1044
|
+
return (0, util_1.updateIfChanged)(breakStmt, updates);
|
|
771
1045
|
});
|
|
772
1046
|
}
|
|
773
1047
|
visitCase(caseStmt, q) {
|
|
774
1048
|
return __awaiter(this, void 0, void 0, function* () {
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
1049
|
+
const updates = {
|
|
1050
|
+
type: yield q.receive(caseStmt.type),
|
|
1051
|
+
caseLabels: yield q.receive(caseStmt.caseLabels, labels => this.visitContainer(labels, q)),
|
|
1052
|
+
statements: yield q.receive(caseStmt.statements, stmts => this.visitContainer(stmts, q)),
|
|
1053
|
+
body: yield q.receive(caseStmt.body, body => this.visitRightPadded(body, q)),
|
|
1054
|
+
guard: yield q.receive(caseStmt.guard, guard => this.visit(guard, q))
|
|
1055
|
+
};
|
|
1056
|
+
return (0, util_1.updateIfChanged)(caseStmt, updates);
|
|
782
1057
|
});
|
|
783
1058
|
}
|
|
784
1059
|
visitContinue(continueStmt, q) {
|
|
785
1060
|
return __awaiter(this, void 0, void 0, function* () {
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
|
|
1061
|
+
const updates = {
|
|
1062
|
+
label: yield q.receive(continueStmt.label, label => this.visit(label, q))
|
|
1063
|
+
};
|
|
1064
|
+
return (0, util_1.updateIfChanged)(continueStmt, updates);
|
|
789
1065
|
});
|
|
790
1066
|
}
|
|
791
1067
|
visitControlParentheses(controlParens, q) {
|
|
792
1068
|
return __awaiter(this, void 0, void 0, function* () {
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
1069
|
+
const updates = {
|
|
1070
|
+
tree: yield q.receive(controlParens.tree, tree => this.visitRightPadded(tree, q))
|
|
1071
|
+
};
|
|
1072
|
+
return (0, util_1.updateIfChanged)(controlParens, updates);
|
|
796
1073
|
});
|
|
797
1074
|
}
|
|
798
1075
|
visitDeconstructionPattern(pattern, q) {
|
|
799
1076
|
return __awaiter(this, void 0, void 0, function* () {
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
1077
|
+
const updates = {
|
|
1078
|
+
deconstructor: yield q.receive(pattern.deconstructor, deconstructor => this.visit(deconstructor, q)),
|
|
1079
|
+
nested: yield q.receive(pattern.nested, nested => this.visitContainer(nested, q)),
|
|
1080
|
+
type: yield q.receive(pattern.type, type => this.visitType(type, q))
|
|
1081
|
+
};
|
|
1082
|
+
return (0, util_1.updateIfChanged)(pattern, updates);
|
|
805
1083
|
});
|
|
806
1084
|
}
|
|
807
1085
|
visitDoWhileLoop(doWhile, q) {
|
|
808
1086
|
return __awaiter(this, void 0, void 0, function* () {
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
1087
|
+
const updates = {
|
|
1088
|
+
body: yield q.receive(doWhile.body, body => this.visitOptionalRightPadded(body, q)),
|
|
1089
|
+
whileCondition: yield q.receive(doWhile.whileCondition, cond => this.visitLeftPadded(cond, q))
|
|
1090
|
+
};
|
|
1091
|
+
return (0, util_1.updateIfChanged)(doWhile, updates);
|
|
813
1092
|
});
|
|
814
1093
|
}
|
|
815
1094
|
visitEmpty(empty) {
|
|
@@ -820,520 +1099,577 @@ class JavaReceiver extends visitor_1.JavaVisitor {
|
|
|
820
1099
|
}
|
|
821
1100
|
visitEnumValueSet(enumValueSet, q) {
|
|
822
1101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
1102
|
+
const updates = {
|
|
1103
|
+
enums: yield q.receiveListDefined(enumValueSet.enums, enumValue => this.visitRightPadded(enumValue, q)),
|
|
1104
|
+
terminatedWithSemicolon: yield q.receive(enumValueSet.terminatedWithSemicolon)
|
|
1105
|
+
};
|
|
1106
|
+
return (0, util_1.updateIfChanged)(enumValueSet, updates);
|
|
827
1107
|
});
|
|
828
1108
|
}
|
|
829
1109
|
visitEnumValue(enumValue, q) {
|
|
830
1110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1111
|
+
const updates = {
|
|
1112
|
+
annotations: yield q.receiveListDefined(enumValue.annotations, annot => this.visit(annot, q)),
|
|
1113
|
+
name: yield q.receive(enumValue.name, name => this.visit(name, q)),
|
|
1114
|
+
initializer: yield q.receive(enumValue.initializer, init => this.visit(init, q))
|
|
1115
|
+
};
|
|
1116
|
+
return (0, util_1.updateIfChanged)(enumValue, updates);
|
|
836
1117
|
});
|
|
837
1118
|
}
|
|
838
1119
|
visitErroneous(erroneous, q) {
|
|
839
1120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
1121
|
+
const updates = {
|
|
1122
|
+
text: yield q.receive(erroneous.text)
|
|
1123
|
+
};
|
|
1124
|
+
return (0, util_1.updateIfChanged)(erroneous, updates);
|
|
843
1125
|
});
|
|
844
1126
|
}
|
|
845
1127
|
visitFieldAccess(fieldAccess, q) {
|
|
846
1128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1129
|
+
const updates = {
|
|
1130
|
+
target: yield q.receive(fieldAccess.target, target => this.visit(target, q)),
|
|
1131
|
+
name: yield q.receive(fieldAccess.name, name => this.visitLeftPadded(name, q)),
|
|
1132
|
+
type: yield q.receive(fieldAccess.type, type => this.visitType(type, q))
|
|
1133
|
+
};
|
|
1134
|
+
return (0, util_1.updateIfChanged)(fieldAccess, updates);
|
|
852
1135
|
});
|
|
853
1136
|
}
|
|
854
1137
|
visitForEachLoop(forEachLoop, q) {
|
|
855
1138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
856
|
-
const
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
1139
|
+
const updates = {
|
|
1140
|
+
control: yield q.receive(forEachLoop.control, c => this.visit(c, q)),
|
|
1141
|
+
body: yield q.receive(forEachLoop.body, body => this.visitRightPadded(body, q))
|
|
1142
|
+
};
|
|
1143
|
+
return (0, util_1.updateIfChanged)(forEachLoop, updates);
|
|
860
1144
|
});
|
|
861
1145
|
}
|
|
862
1146
|
visitForEachLoopControl(control, q) {
|
|
863
1147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1148
|
+
const updates = {
|
|
1149
|
+
variable: yield q.receive(control.variable, variable => this.visitRightPadded(variable, q)),
|
|
1150
|
+
iterable: yield q.receive(control.iterable, expr => this.visitRightPadded(expr, q))
|
|
1151
|
+
};
|
|
1152
|
+
return (0, util_1.updateIfChanged)(control, updates);
|
|
868
1153
|
});
|
|
869
1154
|
}
|
|
870
1155
|
visitForLoop(forLoop, q) {
|
|
871
1156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1157
|
+
const updates = {
|
|
1158
|
+
control: yield q.receive(forLoop.control, c => this.visit(c, q)),
|
|
1159
|
+
body: yield q.receive(forLoop.body, body => this.visitRightPadded(body, q))
|
|
1160
|
+
};
|
|
1161
|
+
return (0, util_1.updateIfChanged)(forLoop, updates);
|
|
876
1162
|
});
|
|
877
1163
|
}
|
|
878
1164
|
visitForLoopControl(control, q) {
|
|
879
1165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1166
|
+
const updates = {
|
|
1167
|
+
init: yield q.receiveListDefined(control.init, init => this.visitRightPadded(init, q)),
|
|
1168
|
+
condition: yield q.receive(control.condition, cond => this.visitRightPadded(cond, q)),
|
|
1169
|
+
update: yield q.receiveListDefined(control.update, update => this.visitRightPadded(update, q))
|
|
1170
|
+
};
|
|
1171
|
+
return (0, util_1.updateIfChanged)(control, updates);
|
|
885
1172
|
});
|
|
886
1173
|
}
|
|
887
1174
|
visitIf(ifStmt, q) {
|
|
888
1175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1176
|
+
const updates = {
|
|
1177
|
+
ifCondition: yield q.receive(ifStmt.ifCondition, cond => this.visit(cond, q)),
|
|
1178
|
+
thenPart: yield q.receive(ifStmt.thenPart, thenPart => this.visitRightPadded(thenPart, q)),
|
|
1179
|
+
elsePart: yield q.receive(ifStmt.elsePart, elsePart => this.visit(elsePart, q))
|
|
1180
|
+
};
|
|
1181
|
+
return (0, util_1.updateIfChanged)(ifStmt, updates);
|
|
894
1182
|
});
|
|
895
1183
|
}
|
|
896
1184
|
visitElse(ifElse, q) {
|
|
897
1185
|
return __awaiter(this, void 0, void 0, function* () {
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
|
|
1186
|
+
const updates = {
|
|
1187
|
+
body: yield q.receive(ifElse.body, body => this.visitRightPadded(body, q))
|
|
1188
|
+
};
|
|
1189
|
+
return (0, util_1.updateIfChanged)(ifElse, updates);
|
|
901
1190
|
});
|
|
902
1191
|
}
|
|
903
1192
|
visitImport(importStmt, q) {
|
|
904
1193
|
return __awaiter(this, void 0, void 0, function* () {
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1194
|
+
const updates = {
|
|
1195
|
+
static: yield q.receive(importStmt.static, s => this.visitLeftPadded(s, q)),
|
|
1196
|
+
qualid: yield q.receive(importStmt.qualid, qualid => this.visit(qualid, q)),
|
|
1197
|
+
alias: yield q.receive(importStmt.alias, alias => this.visitLeftPadded(alias, q))
|
|
1198
|
+
};
|
|
1199
|
+
return (0, util_1.updateIfChanged)(importStmt, updates);
|
|
910
1200
|
});
|
|
911
1201
|
}
|
|
912
1202
|
visitInstanceOf(instanceOf, q) {
|
|
913
1203
|
return __awaiter(this, void 0, void 0, function* () {
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1204
|
+
const updates = {
|
|
1205
|
+
expression: yield q.receive(instanceOf.expression, expr => this.visitRightPadded(expr, q)),
|
|
1206
|
+
class: yield q.receive(instanceOf.class, clazz => this.visit(clazz, q)),
|
|
1207
|
+
pattern: yield q.receive(instanceOf.pattern, pattern => this.visit(pattern, q)),
|
|
1208
|
+
modifier: yield q.receive(instanceOf.modifier, mod => this.visit(mod, q)),
|
|
1209
|
+
type: yield q.receive(instanceOf.type, type => this.visitType(type, q))
|
|
1210
|
+
};
|
|
1211
|
+
return (0, util_1.updateIfChanged)(instanceOf, updates);
|
|
921
1212
|
});
|
|
922
1213
|
}
|
|
923
1214
|
visitIntersectionType(intersectionType, q) {
|
|
924
1215
|
return __awaiter(this, void 0, void 0, function* () {
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
|
|
1216
|
+
const updates = {
|
|
1217
|
+
bounds: yield q.receive(intersectionType.bounds, bounds => this.visitContainer(bounds, q))
|
|
1218
|
+
};
|
|
1219
|
+
return (0, util_1.updateIfChanged)(intersectionType, updates);
|
|
928
1220
|
});
|
|
929
1221
|
}
|
|
930
1222
|
visitLabel(label, q) {
|
|
931
1223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
932
|
-
const
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1224
|
+
const updates = {
|
|
1225
|
+
label: yield q.receive(label.label, lbl => this.visitRightPadded(lbl, q)),
|
|
1226
|
+
statement: yield q.receive(label.statement, stmt => this.visit(stmt, q))
|
|
1227
|
+
};
|
|
1228
|
+
return (0, util_1.updateIfChanged)(label, updates);
|
|
936
1229
|
});
|
|
937
1230
|
}
|
|
938
1231
|
visitLambda(lambda, q) {
|
|
939
1232
|
return __awaiter(this, void 0, void 0, function* () {
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1233
|
+
const updates = {
|
|
1234
|
+
parameters: yield q.receive(lambda.parameters, params => this.visit(params, q)),
|
|
1235
|
+
arrow: yield q.receive(lambda.arrow, arrow => this.visitSpace(arrow, q)),
|
|
1236
|
+
body: yield q.receive(lambda.body, body => this.visit(body, q)),
|
|
1237
|
+
type: yield q.receive(lambda.type, type => this.visitType(type, q))
|
|
1238
|
+
};
|
|
1239
|
+
return (0, util_1.updateIfChanged)(lambda, updates);
|
|
946
1240
|
});
|
|
947
1241
|
}
|
|
948
1242
|
visitLambdaParameters(params, q) {
|
|
949
1243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
950
|
-
const
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1244
|
+
const updates = {
|
|
1245
|
+
parenthesized: yield q.receive(params.parenthesized),
|
|
1246
|
+
parameters: yield q.receiveListDefined(params.parameters, param => this.visitRightPadded(param, q))
|
|
1247
|
+
};
|
|
1248
|
+
return (0, util_1.updateIfChanged)(params, updates);
|
|
954
1249
|
});
|
|
955
1250
|
}
|
|
956
1251
|
visitLiteral(literal, q) {
|
|
957
1252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
958
|
-
const
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1253
|
+
const updates = {
|
|
1254
|
+
value: yield q.receive(literal.value),
|
|
1255
|
+
valueSource: yield q.receive(literal.valueSource),
|
|
1256
|
+
unicodeEscapes: yield q.receiveList(literal.unicodeEscapes),
|
|
1257
|
+
type: yield q.receive(literal.type, type => this.visitType(type, q))
|
|
1258
|
+
};
|
|
1259
|
+
return (0, util_1.updateIfChanged)(literal, updates);
|
|
964
1260
|
});
|
|
965
1261
|
}
|
|
966
1262
|
visitMemberReference(memberRef, q) {
|
|
967
1263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1264
|
+
const updates = {
|
|
1265
|
+
containing: yield q.receive(memberRef.containing, container => this.visitRightPadded(container, q)),
|
|
1266
|
+
typeParameters: yield q.receive(memberRef.typeParameters, typeParams => this.visitContainer(typeParams, q)),
|
|
1267
|
+
reference: yield q.receive(memberRef.reference, ref => this.visitLeftPadded(ref, q)),
|
|
1268
|
+
type: yield q.receive(memberRef.type, type => this.visitType(type, q)),
|
|
1269
|
+
methodType: yield q.receive(memberRef.methodType, type => this.visitType(type, q)),
|
|
1270
|
+
variableType: yield q.receive(memberRef.variableType, type => this.visitType(type, q))
|
|
1271
|
+
};
|
|
1272
|
+
return (0, util_1.updateIfChanged)(memberRef, updates);
|
|
976
1273
|
});
|
|
977
1274
|
}
|
|
978
1275
|
visitMethodInvocation(methodInvoc, q) {
|
|
979
1276
|
return __awaiter(this, void 0, void 0, function* () {
|
|
980
|
-
const
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1277
|
+
const updates = {
|
|
1278
|
+
select: yield q.receive(methodInvoc.select, select => this.visitRightPadded(select, q)),
|
|
1279
|
+
typeParameters: yield q.receive(methodInvoc.typeParameters, typeParams => this.visitContainer(typeParams, q)),
|
|
1280
|
+
name: yield q.receive(methodInvoc.name, name => this.visit(name, q)),
|
|
1281
|
+
arguments: yield q.receive(methodInvoc.arguments, args => this.visitContainer(args, q)),
|
|
1282
|
+
methodType: yield q.receive(methodInvoc.methodType, type => this.visitType(type, q))
|
|
1283
|
+
};
|
|
1284
|
+
return (0, util_1.updateIfChanged)(methodInvoc, updates);
|
|
987
1285
|
});
|
|
988
1286
|
}
|
|
989
1287
|
visitModifier(modifier, q) {
|
|
990
1288
|
return __awaiter(this, void 0, void 0, function* () {
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1289
|
+
const updates = {
|
|
1290
|
+
keyword: yield q.receive(modifier.keyword),
|
|
1291
|
+
type: yield q.receive(modifier.type),
|
|
1292
|
+
annotations: yield q.receiveListDefined(modifier.annotations, annot => this.visit(annot, q))
|
|
1293
|
+
};
|
|
1294
|
+
return (0, util_1.updateIfChanged)(modifier, updates);
|
|
996
1295
|
});
|
|
997
1296
|
}
|
|
998
1297
|
visitMultiCatch(multiCatch, q) {
|
|
999
1298
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1002
|
-
|
|
1299
|
+
const updates = {
|
|
1300
|
+
alternatives: yield q.receiveListDefined(multiCatch.alternatives, alt => this.visitRightPadded(alt, q))
|
|
1301
|
+
};
|
|
1302
|
+
return (0, util_1.updateIfChanged)(multiCatch, updates);
|
|
1003
1303
|
});
|
|
1004
1304
|
}
|
|
1005
1305
|
visitNewArray(newArray, q) {
|
|
1006
1306
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1307
|
+
const updates = {
|
|
1308
|
+
typeExpression: yield q.receive(newArray.typeExpression, type => this.visit(type, q)),
|
|
1309
|
+
dimensions: yield q.receiveListDefined(newArray.dimensions, dim => this.visit(dim, q)),
|
|
1310
|
+
initializer: yield q.receive(newArray.initializer, init => this.visitContainer(init, q)),
|
|
1311
|
+
type: yield q.receive(newArray.type, type => this.visitType(type, q))
|
|
1312
|
+
};
|
|
1313
|
+
return (0, util_1.updateIfChanged)(newArray, updates);
|
|
1013
1314
|
});
|
|
1014
1315
|
}
|
|
1015
1316
|
visitNewClass(newClass, q) {
|
|
1016
1317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1318
|
+
const updates = {
|
|
1319
|
+
enclosing: yield q.receive(newClass.enclosing, encl => this.visitRightPadded(encl, q)),
|
|
1320
|
+
new: yield q.receive(newClass.new, new_ => this.visitSpace(new_, q)),
|
|
1321
|
+
class: yield q.receive(newClass.class, clazz => this.visit(clazz, q)),
|
|
1322
|
+
arguments: yield q.receive(newClass.arguments, args => this.visitContainer(args, q)),
|
|
1323
|
+
body: yield q.receive(newClass.body, body => this.visit(body, q)),
|
|
1324
|
+
constructorType: yield q.receive(newClass.constructorType, type => this.visitType(type, q))
|
|
1325
|
+
};
|
|
1326
|
+
return (0, util_1.updateIfChanged)(newClass, updates);
|
|
1025
1327
|
});
|
|
1026
1328
|
}
|
|
1027
1329
|
visitNullableType(nullableType, q) {
|
|
1028
1330
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1331
|
+
const updates = {
|
|
1332
|
+
annotations: yield q.receiveListDefined(nullableType.annotations, annot => this.visit(annot, q)),
|
|
1333
|
+
typeTree: yield q.receive(nullableType.typeTree, type => this.visitRightPadded(type, q))
|
|
1334
|
+
};
|
|
1335
|
+
return (0, util_1.updateIfChanged)(nullableType, updates);
|
|
1033
1336
|
});
|
|
1034
1337
|
}
|
|
1035
1338
|
visitParameterizedType(paramType, q) {
|
|
1036
1339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1340
|
+
const updates = {
|
|
1341
|
+
class: yield q.receive(paramType.class, clazz => this.visit(clazz, q)),
|
|
1342
|
+
typeParameters: yield q.receive(paramType.typeParameters, params => this.visitContainer(params, q)),
|
|
1343
|
+
type: yield q.receive(paramType.type, type => this.visitType(type, q))
|
|
1344
|
+
};
|
|
1345
|
+
return (0, util_1.updateIfChanged)(paramType, updates);
|
|
1042
1346
|
});
|
|
1043
1347
|
}
|
|
1044
1348
|
visitParentheses(parentheses, q) {
|
|
1045
1349
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
|
|
1350
|
+
const updates = {
|
|
1351
|
+
tree: yield q.receive(parentheses.tree, tree => this.visitRightPadded(tree, q))
|
|
1352
|
+
};
|
|
1353
|
+
return (0, util_1.updateIfChanged)(parentheses, updates);
|
|
1049
1354
|
});
|
|
1050
1355
|
}
|
|
1051
1356
|
visitParenthesizedTypeTree(parenthesizedType, q) {
|
|
1052
1357
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1358
|
+
const updates = {
|
|
1359
|
+
annotations: yield q.receiveListDefined(parenthesizedType.annotations, annot => this.visit(annot, q)),
|
|
1360
|
+
parenthesizedType: yield q.receive(parenthesizedType.parenthesizedType, tree => this.visit(tree, q))
|
|
1361
|
+
};
|
|
1362
|
+
return (0, util_1.updateIfChanged)(parenthesizedType, updates);
|
|
1057
1363
|
});
|
|
1058
1364
|
}
|
|
1059
1365
|
visitPrimitive(primitive, q) {
|
|
1060
1366
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
|
|
1367
|
+
const updates = {
|
|
1368
|
+
type: yield q.receive(primitive.type, type => this.visitType(type, q))
|
|
1369
|
+
};
|
|
1370
|
+
return (0, util_1.updateIfChanged)(primitive, updates);
|
|
1064
1371
|
});
|
|
1065
1372
|
}
|
|
1066
1373
|
visitSwitch(switchStmt, q) {
|
|
1067
1374
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1375
|
+
const updates = {
|
|
1376
|
+
selector: yield q.receive(switchStmt.selector, selector => this.visit(selector, q)),
|
|
1377
|
+
cases: yield q.receive(switchStmt.cases, cases => this.visit(cases, q))
|
|
1378
|
+
};
|
|
1379
|
+
return (0, util_1.updateIfChanged)(switchStmt, updates);
|
|
1072
1380
|
});
|
|
1073
1381
|
}
|
|
1074
1382
|
visitSwitchExpression(switchExpr, q) {
|
|
1075
1383
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1384
|
+
const updates = {
|
|
1385
|
+
selector: yield q.receive(switchExpr.selector, selector => this.visit(selector, q)),
|
|
1386
|
+
cases: yield q.receive(switchExpr.cases, cases => this.visit(cases, q)),
|
|
1387
|
+
type: yield q.receive(switchExpr.type, type => this.visitType(type, q))
|
|
1388
|
+
};
|
|
1389
|
+
return (0, util_1.updateIfChanged)(switchExpr, updates);
|
|
1081
1390
|
});
|
|
1082
1391
|
}
|
|
1083
1392
|
visitTernary(ternary, q) {
|
|
1084
1393
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1394
|
+
const updates = {
|
|
1395
|
+
condition: yield q.receive(ternary.condition, cond => this.visit(cond, q)),
|
|
1396
|
+
truePart: yield q.receive(ternary.truePart, truePart => this.visitLeftPadded(truePart, q)),
|
|
1397
|
+
falsePart: yield q.receive(ternary.falsePart, falsePart => this.visitLeftPadded(falsePart, q)),
|
|
1398
|
+
type: yield q.receive(ternary.type, type => this.visitType(type, q))
|
|
1399
|
+
};
|
|
1400
|
+
return (0, util_1.updateIfChanged)(ternary, updates);
|
|
1091
1401
|
});
|
|
1092
1402
|
}
|
|
1093
1403
|
visitThrow(throwStmt, q) {
|
|
1094
1404
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1097
|
-
|
|
1405
|
+
const updates = {
|
|
1406
|
+
exception: yield q.receive(throwStmt.exception, exception => this.visit(exception, q))
|
|
1407
|
+
};
|
|
1408
|
+
return (0, util_1.updateIfChanged)(throwStmt, updates);
|
|
1098
1409
|
});
|
|
1099
1410
|
}
|
|
1100
1411
|
visitTry(tryStmt, q) {
|
|
1101
1412
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1413
|
+
const updates = {
|
|
1414
|
+
resources: yield q.receive(tryStmt.resources, resources => this.visitContainer(resources, q)),
|
|
1415
|
+
body: yield q.receive(tryStmt.body, body => this.visit(body, q)),
|
|
1416
|
+
catches: yield q.receiveListDefined(tryStmt.catches, catchBlock => this.visit(catchBlock, q)),
|
|
1417
|
+
finally: yield q.receive(tryStmt.finally, finallyBlock => this.visitOptionalLeftPadded(finallyBlock, q))
|
|
1418
|
+
};
|
|
1419
|
+
return (0, util_1.updateIfChanged)(tryStmt, updates);
|
|
1108
1420
|
});
|
|
1109
1421
|
}
|
|
1110
1422
|
visitTryResource(resource, q) {
|
|
1111
1423
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1112
|
-
const
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1424
|
+
const updates = {
|
|
1425
|
+
variableDeclarations: yield q.receive(resource.variableDeclarations, variables => this.visit(variables, q)),
|
|
1426
|
+
terminatedWithSemicolon: yield q.receive(resource.terminatedWithSemicolon)
|
|
1427
|
+
};
|
|
1428
|
+
return (0, util_1.updateIfChanged)(resource, updates);
|
|
1116
1429
|
});
|
|
1117
1430
|
}
|
|
1118
1431
|
visitTryCatch(tryCatch, q) {
|
|
1119
1432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1433
|
+
const updates = {
|
|
1434
|
+
parameter: yield q.receive(tryCatch.parameter, param => this.visit(param, q)),
|
|
1435
|
+
body: yield q.receive(tryCatch.body, body => this.visit(body, q))
|
|
1436
|
+
};
|
|
1437
|
+
return (0, util_1.updateIfChanged)(tryCatch, updates);
|
|
1124
1438
|
});
|
|
1125
1439
|
}
|
|
1126
1440
|
visitUnary(unary, q) {
|
|
1127
1441
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1442
|
+
const updates = {
|
|
1443
|
+
operator: yield q.receive(unary.operator, op => this.visitLeftPadded(op, q)),
|
|
1444
|
+
expression: yield q.receive(unary.expression, expr => this.visit(expr, q)),
|
|
1445
|
+
type: yield q.receive(unary.type, type => this.visitType(type, q))
|
|
1446
|
+
};
|
|
1447
|
+
return (0, util_1.updateIfChanged)(unary, updates);
|
|
1133
1448
|
});
|
|
1134
1449
|
}
|
|
1135
1450
|
visitUnknown(unknown, q) {
|
|
1136
1451
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1452
|
+
const updates = {
|
|
1453
|
+
source: yield q.receive(unknown.source, source => this.visit(source, q))
|
|
1454
|
+
};
|
|
1455
|
+
return (0, util_1.updateIfChanged)(unknown, updates);
|
|
1140
1456
|
});
|
|
1141
1457
|
}
|
|
1142
1458
|
visitUnknownSource(unknownSource, q) {
|
|
1143
1459
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1146
|
-
|
|
1460
|
+
const updates = {
|
|
1461
|
+
text: yield q.receive(unknownSource.text)
|
|
1462
|
+
};
|
|
1463
|
+
return (0, util_1.updateIfChanged)(unknownSource, updates);
|
|
1147
1464
|
});
|
|
1148
1465
|
}
|
|
1149
1466
|
visitVariable(variable, q) {
|
|
1150
1467
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1468
|
+
const updates = {
|
|
1469
|
+
name: yield q.receive(variable.name, name => this.visit(name, q)),
|
|
1470
|
+
dimensionsAfterName: yield q.receiveListDefined(variable.dimensionsAfterName, dim => this.visitLeftPadded(dim, q)),
|
|
1471
|
+
initializer: yield q.receive(variable.initializer, init => this.visitOptionalLeftPadded(init, q)),
|
|
1472
|
+
variableType: yield q.receive(variable.variableType, type => this.visitType(type, q))
|
|
1473
|
+
};
|
|
1474
|
+
return (0, util_1.updateIfChanged)(variable, updates);
|
|
1157
1475
|
});
|
|
1158
1476
|
}
|
|
1159
1477
|
visitYield(yieldStmt, q) {
|
|
1160
1478
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1479
|
+
const updates = {
|
|
1480
|
+
implicit: yield q.receive(yieldStmt.implicit),
|
|
1481
|
+
value: yield q.receive(yieldStmt.value, value => this.visit(value, q))
|
|
1482
|
+
};
|
|
1483
|
+
return (0, util_1.updateIfChanged)(yieldStmt, updates);
|
|
1165
1484
|
});
|
|
1166
1485
|
}
|
|
1167
1486
|
visitTypeParameters(typeParams, q) {
|
|
1168
1487
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1488
|
+
const updates = {
|
|
1489
|
+
annotations: yield q.receiveListDefined(typeParams.annotations, annot => this.visit(annot, q)),
|
|
1490
|
+
typeParameters: yield q.receiveListDefined(typeParams.typeParameters, param => this.visitRightPadded(param, q))
|
|
1491
|
+
};
|
|
1492
|
+
return (0, util_1.updateIfChanged)(typeParams, updates);
|
|
1173
1493
|
});
|
|
1174
1494
|
}
|
|
1175
1495
|
visitReturn(returnStmt, q) {
|
|
1176
1496
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1497
|
+
const updates = {
|
|
1498
|
+
expression: yield q.receive(returnStmt.expression, expr => this.visit(expr, q))
|
|
1499
|
+
};
|
|
1500
|
+
return (0, util_1.updateIfChanged)(returnStmt, updates);
|
|
1180
1501
|
});
|
|
1181
1502
|
}
|
|
1182
1503
|
visitSynchronized(synchronizedStmt, q) {
|
|
1183
1504
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1505
|
+
const updates = {
|
|
1506
|
+
lock: yield q.receive(synchronizedStmt.lock, lock => this.visit(lock, q)),
|
|
1507
|
+
body: yield q.receive(synchronizedStmt.body, body => this.visit(body, q))
|
|
1508
|
+
};
|
|
1509
|
+
return (0, util_1.updateIfChanged)(synchronizedStmt, updates);
|
|
1188
1510
|
});
|
|
1189
1511
|
}
|
|
1190
1512
|
visitTypeCast(typeCast, q) {
|
|
1191
1513
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1514
|
+
const updates = {
|
|
1515
|
+
class: yield q.receive(typeCast.class, typeExpr => this.visit(typeExpr, q)),
|
|
1516
|
+
expression: yield q.receive(typeCast.expression, expr => this.visit(expr, q))
|
|
1517
|
+
};
|
|
1518
|
+
return (0, util_1.updateIfChanged)(typeCast, updates);
|
|
1196
1519
|
});
|
|
1197
1520
|
}
|
|
1198
1521
|
visitTypeParameter(typeParameter, q) {
|
|
1199
1522
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1523
|
+
const updates = {
|
|
1524
|
+
annotations: yield q.receiveListDefined(typeParameter.annotations, annot => this.visit(annot, q)),
|
|
1525
|
+
modifiers: yield q.receiveListDefined(typeParameter.modifiers, annot => this.visit(annot, q)),
|
|
1526
|
+
name: yield q.receive(typeParameter.name, name => this.visit(name, q)),
|
|
1527
|
+
bounds: yield q.receive(typeParameter.bounds, bounds => this.visitContainer(bounds, q))
|
|
1528
|
+
};
|
|
1529
|
+
return (0, util_1.updateIfChanged)(typeParameter, updates);
|
|
1206
1530
|
});
|
|
1207
1531
|
}
|
|
1208
1532
|
visitWhileLoop(whileLoop, q) {
|
|
1209
1533
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1534
|
+
const updates = {
|
|
1535
|
+
condition: yield q.receive(whileLoop.condition, cond => this.visit(cond, q)),
|
|
1536
|
+
body: yield q.receive(whileLoop.body, body => this.visitOptionalRightPadded(body, q))
|
|
1537
|
+
};
|
|
1538
|
+
return (0, util_1.updateIfChanged)(whileLoop, updates);
|
|
1214
1539
|
});
|
|
1215
1540
|
}
|
|
1216
1541
|
visitWildcard(wildcard, q) {
|
|
1217
1542
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1543
|
+
const updates = {
|
|
1544
|
+
bound: yield q.receive(wildcard.bound, bound => this.visitLeftPadded(bound, q)),
|
|
1545
|
+
boundedType: yield q.receive(wildcard.boundedType, type => this.visit(type, q))
|
|
1546
|
+
};
|
|
1547
|
+
return (0, util_1.updateIfChanged)(wildcard, updates);
|
|
1222
1548
|
});
|
|
1223
1549
|
}
|
|
1224
1550
|
visitCompilationUnit(cu, q) {
|
|
1225
1551
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1552
|
+
const updates = {
|
|
1553
|
+
sourcePath: yield q.receive(cu.sourcePath),
|
|
1554
|
+
charsetName: yield q.receive(cu.charsetName),
|
|
1555
|
+
charsetBomMarked: yield q.receive(cu.charsetBomMarked),
|
|
1556
|
+
checksum: yield q.receive(cu.checksum),
|
|
1557
|
+
fileAttributes: yield q.receive(cu.fileAttributes),
|
|
1558
|
+
packageDeclaration: yield q.receive(cu.packageDeclaration, pkg => this.visitRightPadded(pkg, q)),
|
|
1559
|
+
imports: yield q.receiveListDefined(cu.imports, imp => this.visitRightPadded(imp, q)),
|
|
1560
|
+
classes: yield q.receiveListDefined(cu.classes, cls => this.visit(cls, q)),
|
|
1561
|
+
eof: yield q.receive(cu.eof, space => this.visitSpace(space, q))
|
|
1562
|
+
};
|
|
1563
|
+
return (0, util_1.updateIfChanged)(cu, updates);
|
|
1237
1564
|
});
|
|
1238
1565
|
}
|
|
1239
1566
|
visitPackage(pkg, q) {
|
|
1240
1567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1568
|
+
const updates = {
|
|
1569
|
+
expression: yield q.receive(pkg.expression, expr => this.visit(expr, q)),
|
|
1570
|
+
annotations: yield q.receiveListDefined(pkg.annotations, annot => this.visit(annot, q))
|
|
1571
|
+
};
|
|
1572
|
+
return (0, util_1.updateIfChanged)(pkg, updates);
|
|
1245
1573
|
});
|
|
1246
1574
|
}
|
|
1247
1575
|
visitClassDeclaration(cls, q) {
|
|
1248
1576
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1577
|
+
const updates = {
|
|
1578
|
+
leadingAnnotations: yield q.receiveListDefined(cls.leadingAnnotations, annot => this.visit(annot, q)),
|
|
1579
|
+
modifiers: yield q.receiveListDefined(cls.modifiers, mod => this.visit(mod, q)),
|
|
1580
|
+
classKind: yield q.receive(cls.classKind, kind => this.visit(kind, q)),
|
|
1581
|
+
name: yield q.receive(cls.name, name => this.visit(name, q)),
|
|
1582
|
+
typeParameters: yield q.receive(cls.typeParameters, params => this.visitContainer(params, q)),
|
|
1583
|
+
primaryConstructor: yield q.receive(cls.primaryConstructor, cons => this.visitContainer(cons, q)),
|
|
1584
|
+
extends: yield q.receive(cls.extends, ext => this.visitLeftPadded(ext, q)),
|
|
1585
|
+
implements: yield q.receive(cls.implements, impl => this.visitContainer(impl, q)),
|
|
1586
|
+
permitting: yield q.receive(cls.permitting, perm => this.visitContainer(perm, q)),
|
|
1587
|
+
body: yield q.receive(cls.body, body => this.visit(body, q))
|
|
1588
|
+
};
|
|
1589
|
+
return (0, util_1.updateIfChanged)(cls, updates);
|
|
1261
1590
|
});
|
|
1262
1591
|
}
|
|
1263
1592
|
visitClassDeclarationKind(kind, q) {
|
|
1264
1593
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1594
|
+
const updates = {
|
|
1595
|
+
annotations: yield q.receiveListDefined(kind.annotations, annot => this.visit(annot, q)),
|
|
1596
|
+
type: yield q.receive(kind.type)
|
|
1597
|
+
};
|
|
1598
|
+
return (0, util_1.updateIfChanged)(kind, updates);
|
|
1269
1599
|
});
|
|
1270
1600
|
}
|
|
1271
1601
|
visitBlock(block, q) {
|
|
1272
1602
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1603
|
+
const updates = {
|
|
1604
|
+
static: yield q.receive(block.static, s => this.visitRightPadded(s, q)),
|
|
1605
|
+
statements: yield q.receiveListDefined(block.statements, stmt => this.visitRightPadded(stmt, q)),
|
|
1606
|
+
end: yield q.receive(block.end, space => this.visitSpace(space, q))
|
|
1607
|
+
};
|
|
1608
|
+
return (0, util_1.updateIfChanged)(block, updates);
|
|
1278
1609
|
});
|
|
1279
1610
|
}
|
|
1280
1611
|
visitMethodDeclaration(method, q) {
|
|
1281
1612
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1613
|
+
const updates = {
|
|
1614
|
+
leadingAnnotations: yield q.receiveListDefined(method.leadingAnnotations, annot => this.visit(annot, q)),
|
|
1615
|
+
modifiers: yield q.receiveListDefined(method.modifiers, mod => this.visit(mod, q)),
|
|
1616
|
+
typeParameters: yield q.receive(method.typeParameters, params => this.visit(params, q)),
|
|
1617
|
+
returnTypeExpression: yield q.receive(method.returnTypeExpression, type => this.visit(type, q)),
|
|
1618
|
+
nameAnnotations: (yield q.receiveList(method.nameAnnotations, name => this.visit(name, q))),
|
|
1619
|
+
name: yield q.receive(method.name, name => this.visit(name, q)),
|
|
1620
|
+
parameters: yield q.receive(method.parameters, params => this.visitContainer(params, q)),
|
|
1621
|
+
throws: yield q.receive(method.throws, throws => this.visitContainer(throws, q)),
|
|
1622
|
+
body: yield q.receive(method.body, body => this.visit(body, q)),
|
|
1623
|
+
defaultValue: yield q.receive(method.defaultValue, def => this.visitLeftPadded(def, q)),
|
|
1624
|
+
methodType: yield q.receive(method.methodType, type => this.visitType(type, q))
|
|
1625
|
+
};
|
|
1626
|
+
return (0, util_1.updateIfChanged)(method, updates);
|
|
1295
1627
|
});
|
|
1296
1628
|
}
|
|
1297
1629
|
visitVariableDeclarations(varDecls, q) {
|
|
1298
1630
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1631
|
+
const updates = {
|
|
1632
|
+
leadingAnnotations: yield q.receiveListDefined(varDecls.leadingAnnotations, annot => this.visit(annot, q)),
|
|
1633
|
+
modifiers: yield q.receiveListDefined(varDecls.modifiers, mod => this.visit(mod, q)),
|
|
1634
|
+
typeExpression: yield q.receive(varDecls.typeExpression, type => this.visit(type, q)),
|
|
1635
|
+
varargs: yield q.receive(varDecls.varargs, space => this.visitSpace(space, q)),
|
|
1636
|
+
variables: yield q.receiveListDefined(varDecls.variables, variable => this.visitRightPadded(variable, q))
|
|
1637
|
+
};
|
|
1638
|
+
return (0, util_1.updateIfChanged)(varDecls, updates);
|
|
1306
1639
|
});
|
|
1307
1640
|
}
|
|
1308
1641
|
visitIdentifier(ident, q) {
|
|
1309
1642
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1643
|
+
const updates = {
|
|
1644
|
+
annotations: yield q.receiveListDefined(ident.annotations, annot => this.visit(annot, q)),
|
|
1645
|
+
simpleName: yield q.receive(ident.simpleName),
|
|
1646
|
+
type: yield q.receive(ident.type, type => this.visitType(type, q)),
|
|
1647
|
+
fieldType: yield q.receive(ident.fieldType, type => this.visitType(type, q))
|
|
1648
|
+
};
|
|
1649
|
+
return (0, util_1.updateIfChanged)(ident, updates);
|
|
1316
1650
|
});
|
|
1317
1651
|
}
|
|
1318
1652
|
visitSpace(space, q) {
|
|
1319
1653
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1654
|
+
const updates = {
|
|
1655
|
+
comments: yield q.receiveListDefined(space.comments, (c) => __awaiter(this, void 0, void 0, function* () {
|
|
1656
|
+
if (c.kind === tree_1.J.Kind.TextComment) {
|
|
1657
|
+
const tc = c;
|
|
1658
|
+
const commentUpdates = {
|
|
1659
|
+
multiline: yield q.receive(tc.multiline),
|
|
1660
|
+
text: yield q.receive(tc.text),
|
|
1661
|
+
suffix: yield q.receive(c.suffix),
|
|
1662
|
+
markers: yield q.receive(c.markers)
|
|
1663
|
+
};
|
|
1664
|
+
return (0, util_1.updateIfChanged)(tc, commentUpdates);
|
|
1665
|
+
}
|
|
1666
|
+
else {
|
|
1667
|
+
throw new Error(`Unexpected comment type ${c.kind}`);
|
|
1668
|
+
}
|
|
1669
|
+
})),
|
|
1670
|
+
whitespace: yield q.receive(space.whitespace)
|
|
1671
|
+
};
|
|
1672
|
+
return (0, util_1.updateIfChanged)(space, updates);
|
|
1337
1673
|
});
|
|
1338
1674
|
}
|
|
1339
1675
|
visitLeftPadded(left, q) {
|
|
@@ -1341,20 +1677,21 @@ class JavaReceiver extends visitor_1.JavaVisitor {
|
|
|
1341
1677
|
if (!left) {
|
|
1342
1678
|
throw new Error("TreeDataReceiveQueue should have instantiated an empty left padding");
|
|
1343
1679
|
}
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1680
|
+
const updates = {
|
|
1681
|
+
before: yield q.receive(left.before, space => this.visitSpace(space, q)),
|
|
1682
|
+
element: yield q.receive(left.element, elem => {
|
|
1683
|
+
if ((0, tree_1.isSpace)(elem)) {
|
|
1684
|
+
return this.visitSpace(elem, q);
|
|
1685
|
+
}
|
|
1686
|
+
else if (typeof elem === 'object' && elem.kind) {
|
|
1687
|
+
// FIXME find a better way to check if it is a `Tree`
|
|
1688
|
+
return this.visit(elem, q);
|
|
1689
|
+
}
|
|
1690
|
+
return elem;
|
|
1691
|
+
}),
|
|
1692
|
+
markers: yield q.receive(left.markers)
|
|
1693
|
+
};
|
|
1694
|
+
return (0, util_1.updateIfChanged)(left, updates);
|
|
1358
1695
|
});
|
|
1359
1696
|
}
|
|
1360
1697
|
visitRightPadded(right, q) {
|
|
@@ -1362,45 +1699,47 @@ class JavaReceiver extends visitor_1.JavaVisitor {
|
|
|
1362
1699
|
if (!right) {
|
|
1363
1700
|
throw new Error("TreeDataReceiveQueue should have instantiated an empty right padding");
|
|
1364
1701
|
}
|
|
1365
|
-
const
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1702
|
+
const updates = {
|
|
1703
|
+
element: yield q.receive(right.element, elem => {
|
|
1704
|
+
if ((0, tree_1.isSpace)(elem)) {
|
|
1705
|
+
return this.visitSpace(elem, q);
|
|
1706
|
+
}
|
|
1707
|
+
else if (typeof elem === 'object' && elem.kind) {
|
|
1708
|
+
// FIXME find a better way to check if it is a `Tree`
|
|
1709
|
+
return this.visit(elem, q);
|
|
1710
|
+
}
|
|
1711
|
+
return elem;
|
|
1712
|
+
}),
|
|
1713
|
+
after: yield q.receive(right.after, space => this.visitSpace(space, q)),
|
|
1714
|
+
markers: yield q.receive(right.markers)
|
|
1715
|
+
};
|
|
1716
|
+
return (0, util_1.updateIfChanged)(right, updates);
|
|
1379
1717
|
});
|
|
1380
1718
|
}
|
|
1381
1719
|
visitContainer(container, q) {
|
|
1382
1720
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1721
|
+
const updates = {
|
|
1722
|
+
before: yield q.receive(container.before, space => this.visitSpace(space, q)),
|
|
1723
|
+
elements: yield q.receiveListDefined(container.elements, elem => this.visitRightPadded(elem, q)),
|
|
1724
|
+
markers: yield q.receive(container.markers)
|
|
1725
|
+
};
|
|
1726
|
+
return (0, util_1.updateIfChanged)(container, updates);
|
|
1388
1727
|
});
|
|
1389
1728
|
}
|
|
1390
1729
|
visitType(javaType, q) {
|
|
1391
1730
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
return yield codec.rpcReceive(javaType, q);
|
|
1731
|
+
if (!javaType) {
|
|
1732
|
+
return undefined;
|
|
1395
1733
|
}
|
|
1396
|
-
if (javaType
|
|
1397
|
-
|
|
1734
|
+
else if (javaType.kind === type_1.Type.Kind.Unknown) {
|
|
1735
|
+
return type_1.Type.unknownType;
|
|
1398
1736
|
}
|
|
1399
|
-
return
|
|
1737
|
+
return yield JavaReceiver.typeVisitor.visit(javaType, q);
|
|
1400
1738
|
});
|
|
1401
1739
|
}
|
|
1402
1740
|
}
|
|
1403
1741
|
exports.JavaReceiver = JavaReceiver;
|
|
1742
|
+
JavaReceiver.typeVisitor = new TypeReceiver();
|
|
1404
1743
|
function registerJLanguageCodecs(sourceFileType, receiver, sender, extendedKinds) {
|
|
1405
1744
|
const kinds = new Set([
|
|
1406
1745
|
...Object.values(tree_1.J.Kind),
|