@openrewrite/rewrite 8.72.2 → 8.72.4

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.
Files changed (197) hide show
  1. package/dist/execution.js +3 -16
  2. package/dist/execution.js.map +1 -1
  3. package/dist/index.js +34 -49
  4. package/dist/index.js.map +1 -1
  5. package/dist/java/markers.js +12 -29
  6. package/dist/java/markers.js.map +1 -1
  7. package/dist/java/print.js +2 -13
  8. package/dist/java/print.js.map +1 -1
  9. package/dist/java/rpc.js +1344 -1725
  10. package/dist/java/rpc.js.map +1 -1
  11. package/dist/java/type-visitor.js +143 -184
  12. package/dist/java/type-visitor.js.map +1 -1
  13. package/dist/java/visitor.js +1072 -1249
  14. package/dist/java/visitor.js.map +1 -1
  15. package/dist/javascript/add-import.js +495 -534
  16. package/dist/javascript/add-import.js.map +1 -1
  17. package/dist/javascript/autodetect.js +116 -159
  18. package/dist/javascript/autodetect.js.map +1 -1
  19. package/dist/javascript/cleanup/add-parse-int-radix.js +41 -57
  20. package/dist/javascript/cleanup/add-parse-int-radix.js.map +1 -1
  21. package/dist/javascript/cleanup/prefer-optional-chain.js +89 -105
  22. package/dist/javascript/cleanup/prefer-optional-chain.js.map +1 -1
  23. package/dist/javascript/cleanup/use-object-property-shorthand.js +74 -95
  24. package/dist/javascript/cleanup/use-object-property-shorthand.js.map +1 -1
  25. package/dist/javascript/comparator.js +815 -1167
  26. package/dist/javascript/comparator.js.map +1 -1
  27. package/dist/javascript/dependency-workspace.js +206 -219
  28. package/dist/javascript/dependency-workspace.js.map +1 -1
  29. package/dist/javascript/format/format.js +682 -908
  30. package/dist/javascript/format/format.js.map +1 -1
  31. package/dist/javascript/format/minimum-viable-spacing-visitor.js +152 -231
  32. package/dist/javascript/format/minimum-viable-spacing-visitor.js.map +1 -1
  33. package/dist/javascript/format/normalize-whitespace-visitor.js +12 -31
  34. package/dist/javascript/format/normalize-whitespace-visitor.js.map +1 -1
  35. package/dist/javascript/format/prettier-config-loader.js +134 -153
  36. package/dist/javascript/format/prettier-config-loader.js.map +1 -1
  37. package/dist/javascript/format/prettier-format.js +112 -129
  38. package/dist/javascript/format/prettier-format.js.map +1 -1
  39. package/dist/javascript/format/tabs-and-indents-visitor.js +112 -136
  40. package/dist/javascript/format/tabs-and-indents-visitor.js.map +1 -1
  41. package/dist/javascript/markers.js +59 -92
  42. package/dist/javascript/markers.js.map +1 -1
  43. package/dist/javascript/migrate/es6/modernize-octal-escape-sequences.js +39 -52
  44. package/dist/javascript/migrate/es6/modernize-octal-escape-sequences.js.map +1 -1
  45. package/dist/javascript/migrate/es6/modernize-octal-literals.js +25 -38
  46. package/dist/javascript/migrate/es6/modernize-octal-literals.js.map +1 -1
  47. package/dist/javascript/migrate/es6/remove-duplicate-object-keys.js +66 -82
  48. package/dist/javascript/migrate/es6/remove-duplicate-object-keys.js.map +1 -1
  49. package/dist/javascript/migrate/typescript/export-assignment-to-export-default.js +10 -23
  50. package/dist/javascript/migrate/typescript/export-assignment-to-export-default.js.map +1 -1
  51. package/dist/javascript/node-resolution-result.js +137 -166
  52. package/dist/javascript/node-resolution-result.js.map +1 -1
  53. package/dist/javascript/package-json-parser.js +312 -343
  54. package/dist/javascript/package-json-parser.js.map +1 -1
  55. package/dist/javascript/package-manager.js +145 -170
  56. package/dist/javascript/package-manager.js.map +1 -1
  57. package/dist/javascript/parser.d.ts.map +1 -1
  58. package/dist/javascript/parser.js +94 -68
  59. package/dist/javascript/parser.js.map +1 -1
  60. package/dist/javascript/print.js +1572 -1835
  61. package/dist/javascript/print.js.map +1 -1
  62. package/dist/javascript/project-parser.js +151 -172
  63. package/dist/javascript/project-parser.js.map +1 -1
  64. package/dist/javascript/recipes/add-dependency.js +140 -175
  65. package/dist/javascript/recipes/add-dependency.js.map +1 -1
  66. package/dist/javascript/recipes/async-callback-in-sync-array-method.js +20 -36
  67. package/dist/javascript/recipes/async-callback-in-sync-array-method.js.map +1 -1
  68. package/dist/javascript/recipes/auto-format.js +3 -14
  69. package/dist/javascript/recipes/auto-format.js.map +1 -1
  70. package/dist/javascript/recipes/change-import.js +447 -495
  71. package/dist/javascript/recipes/change-import.js.map +1 -1
  72. package/dist/javascript/recipes/order-imports.js +162 -175
  73. package/dist/javascript/recipes/order-imports.js.map +1 -1
  74. package/dist/javascript/recipes/upgrade-dependency-version.js +167 -197
  75. package/dist/javascript/recipes/upgrade-dependency-version.js.map +1 -1
  76. package/dist/javascript/recipes/upgrade-transitive-dependency-version.js +166 -193
  77. package/dist/javascript/recipes/upgrade-transitive-dependency-version.js.map +1 -1
  78. package/dist/javascript/remove-import.js +689 -724
  79. package/dist/javascript/remove-import.js.map +1 -1
  80. package/dist/javascript/rpc.js +1007 -1332
  81. package/dist/javascript/rpc.js.map +1 -1
  82. package/dist/javascript/search/find-dependency.js +84 -110
  83. package/dist/javascript/search/find-dependency.js.map +1 -1
  84. package/dist/javascript/search/uses-method.js +5 -19
  85. package/dist/javascript/search/uses-method.js.map +1 -1
  86. package/dist/javascript/search/uses-type.js +9 -20
  87. package/dist/javascript/search/uses-type.js.map +1 -1
  88. package/dist/javascript/templating/comparator.js +737 -822
  89. package/dist/javascript/templating/comparator.js.map +1 -1
  90. package/dist/javascript/templating/engine.js +211 -245
  91. package/dist/javascript/templating/engine.js.map +1 -1
  92. package/dist/javascript/templating/pattern.js +169 -190
  93. package/dist/javascript/templating/pattern.js.map +1 -1
  94. package/dist/javascript/templating/placeholder-replacement.js +172 -210
  95. package/dist/javascript/templating/placeholder-replacement.js.map +1 -1
  96. package/dist/javascript/templating/rewrite.js +75 -97
  97. package/dist/javascript/templating/rewrite.js.map +1 -1
  98. package/dist/javascript/templating/template.js +69 -82
  99. package/dist/javascript/templating/template.js.map +1 -1
  100. package/dist/javascript/tree-debug.js +109 -137
  101. package/dist/javascript/tree-debug.js.map +1 -1
  102. package/dist/javascript/visitor.js +1090 -1254
  103. package/dist/javascript/visitor.js.map +1 -1
  104. package/dist/json/print.js +72 -103
  105. package/dist/json/print.js.map +1 -1
  106. package/dist/json/rpc.js +120 -181
  107. package/dist/json/rpc.js.map +1 -1
  108. package/dist/json/visitor.js +69 -100
  109. package/dist/json/visitor.js.map +1 -1
  110. package/dist/marketplace.js +20 -33
  111. package/dist/marketplace.js.map +1 -1
  112. package/dist/parse-error.js +41 -62
  113. package/dist/parse-error.js.map +1 -1
  114. package/dist/parser.js +7 -18
  115. package/dist/parser.js.map +1 -1
  116. package/dist/path-utils.js +46 -59
  117. package/dist/path-utils.js.map +1 -1
  118. package/dist/preconditions.js +30 -47
  119. package/dist/preconditions.js.map +1 -1
  120. package/dist/print.js +6 -19
  121. package/dist/print.js.map +1 -1
  122. package/dist/recipe.js +42 -73
  123. package/dist/recipe.js.map +1 -1
  124. package/dist/rpc/index.js +74 -115
  125. package/dist/rpc/index.js.map +1 -1
  126. package/dist/rpc/queue.js +71 -90
  127. package/dist/rpc/queue.js.map +1 -1
  128. package/dist/rpc/recipe.js +32 -57
  129. package/dist/rpc/recipe.js.map +1 -1
  130. package/dist/rpc/request/generate.js +4 -13
  131. package/dist/rpc/request/generate.js.map +1 -1
  132. package/dist/rpc/request/get-languages.js +2 -11
  133. package/dist/rpc/request/get-languages.js.map +1 -1
  134. package/dist/rpc/request/get-marketplace.js +9 -20
  135. package/dist/rpc/request/get-marketplace.js.map +1 -1
  136. package/dist/rpc/request/get-object.js +4 -13
  137. package/dist/rpc/request/get-object.js.map +1 -1
  138. package/dist/rpc/request/install-recipes.js +25 -36
  139. package/dist/rpc/request/install-recipes.js.map +1 -1
  140. package/dist/rpc/request/metrics.js +8 -17
  141. package/dist/rpc/request/metrics.js.map +1 -1
  142. package/dist/rpc/request/parse-project.js +36 -45
  143. package/dist/rpc/request/parse-project.js.map +1 -1
  144. package/dist/rpc/request/parse.js +5 -14
  145. package/dist/rpc/request/parse.js.map +1 -1
  146. package/dist/rpc/request/prepare-recipe.js +37 -52
  147. package/dist/rpc/request/prepare-recipe.js.map +1 -1
  148. package/dist/rpc/request/print.js +5 -14
  149. package/dist/rpc/request/print.js.map +1 -1
  150. package/dist/rpc/request/visit.js +56 -71
  151. package/dist/rpc/request/visit.js.map +1 -1
  152. package/dist/rpc/rewrite-rpc.js +70 -97
  153. package/dist/rpc/rewrite-rpc.js.map +1 -1
  154. package/dist/rpc/server.js +76 -89
  155. package/dist/rpc/server.js.map +1 -1
  156. package/dist/run.js +47 -66
  157. package/dist/run.js.map +1 -1
  158. package/dist/search/is-source-file.js +8 -19
  159. package/dist/search/is-source-file.js.map +1 -1
  160. package/dist/test/rewrite-test.js +154 -188
  161. package/dist/test/rewrite-test.js.map +1 -1
  162. package/dist/text/print.js +23 -38
  163. package/dist/text/print.js.map +1 -1
  164. package/dist/text/rpc.js +29 -44
  165. package/dist/text/rpc.js.map +1 -1
  166. package/dist/text/visitor.js +16 -33
  167. package/dist/text/visitor.js.map +1 -1
  168. package/dist/util.js +13 -24
  169. package/dist/util.js.map +1 -1
  170. package/dist/version.txt +1 -1
  171. package/dist/visitor.js +84 -115
  172. package/dist/visitor.js.map +1 -1
  173. package/dist/yaml/index.d.ts +2 -0
  174. package/dist/yaml/index.d.ts.map +1 -1
  175. package/dist/yaml/index.js +2 -0
  176. package/dist/yaml/index.js.map +1 -1
  177. package/dist/yaml/markers.d.ts +21 -0
  178. package/dist/yaml/markers.d.ts.map +1 -0
  179. package/dist/yaml/markers.js +37 -0
  180. package/dist/yaml/markers.js.map +1 -0
  181. package/dist/yaml/parser.d.ts.map +1 -1
  182. package/dist/yaml/parser.js +4 -1
  183. package/dist/yaml/parser.js.map +1 -1
  184. package/dist/yaml/print.d.ts +1 -1
  185. package/dist/yaml/print.d.ts.map +1 -1
  186. package/dist/yaml/print.js +175 -208
  187. package/dist/yaml/print.js.map +1 -1
  188. package/dist/yaml/rpc.js +154 -219
  189. package/dist/yaml/rpc.js.map +1 -1
  190. package/dist/yaml/visitor.js +78 -113
  191. package/dist/yaml/visitor.js.map +1 -1
  192. package/package.json +1 -1
  193. package/src/javascript/parser.ts +56 -14
  194. package/src/yaml/index.ts +2 -0
  195. package/src/yaml/markers.ts +70 -0
  196. package/src/yaml/parser.ts +5 -1
  197. package/src/yaml/print.ts +5 -2
package/dist/java/rpc.js CHANGED
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.JavaReceiver = exports.JavaSender = void 0;
13
4
  exports.registerJLanguageCodecs = registerJLanguageCodecs;
@@ -34,263 +25,219 @@ const type_1 = require("./type");
34
25
  const type_visitor_1 = require("./type-visitor");
35
26
  const util_1 = require("../util");
36
27
  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;
28
+ async visitPrimitive(primitive, q) {
29
+ await q.getAndSend(primitive, p => p.keyword);
30
+ return primitive;
31
+ }
32
+ async visitClass(cls, q) {
33
+ await q.getAndSend(cls, c => c.flags);
34
+ await q.getAndSend(cls, c => c.classKind);
35
+ await q.getAndSend(cls, c => c.fullyQualifiedName);
36
+ await q.getAndSendList(cls, c => (c.typeParameters || []).map(t => (0, rpc_1.asRef)(t)), t => type_1.Type.signature(t), t => this.visit(t, q));
37
+ await q.getAndSend(cls, c => (0, rpc_1.asRef)(c.supertype), st => this.visit(st, q));
38
+ await q.getAndSend(cls, c => (0, rpc_1.asRef)(c.owningClass), oc => this.visit(oc, q));
39
+ await q.getAndSendList(cls, c => (c.annotations || []).map(a => (0, rpc_1.asRef)(a)), t => type_1.Type.signature(t), a => this.visit(a, q));
40
+ await q.getAndSendList(cls, c => (c.interfaces || []).map(i => (0, rpc_1.asRef)(i)), t => type_1.Type.signature(t), i => this.visit(i, q));
41
+ await q.getAndSendList(cls, c => (c.members || []).map(m => (0, rpc_1.asRef)(m)), t => type_1.Type.signature(t), m => this.visit(m, q));
42
+ await q.getAndSendList(cls, c => (c.methods || []).map(m => (0, rpc_1.asRef)(m)), t => type_1.Type.signature(t), m => this.visit(m, q));
43
+ return cls;
44
+ }
45
+ async visitVariable(variable, q) {
46
+ await q.getAndSend(variable, v => v.name);
47
+ await q.getAndSend(variable, v => v.owner ? (0, rpc_1.asRef)(v.owner) : undefined, owner => this.visit(owner, q));
48
+ await q.getAndSend(variable, v => (0, rpc_1.asRef)(v.type), t => this.visit(t, q));
49
+ await q.getAndSendList(variable, v => (v.annotations || []).map(v2 => (0, rpc_1.asRef)(v2)), t => type_1.Type.signature(t), a => this.visit(a, q));
50
+ return variable;
51
+ }
52
+ async visitAnnotation(annotation, q) {
53
+ await q.getAndSend(annotation, a => (0, rpc_1.asRef)(a.type), t => this.visit(t, q));
54
+ // await q.getAndSendList(annotation, a => (a.values || []).map(v => asRef(v)), v => {
55
+ // let value: any;
56
+ // if (v.kind === Type.Kind.SingleElementValue) {
57
+ // const single = v as Type.Annotation.SingleElementValue;
58
+ // value = single.constantValue !== undefined ? single.constantValue : single.referenceValue;
59
+ // } else {
60
+ // const array = v as Type.Annotation.ArrayElementValue;
61
+ // value = array.constantValues || array.referenceValues;
62
+ // }
63
+ // return `${Type.signature(v.element)}:${value == null ? "null" : value.toString()}`;
64
+ // }, async v => {
65
+ // // Handle element values inline like the Java implementation
66
+ // await q.getAndSend(v, e => asRef(e.element), elem => this.visit(elem, q));
67
+ // if (v.kind === Type.Kind.SingleElementValue) {
68
+ // const single = v as Type.Annotation.SingleElementValue;
69
+ // await q.getAndSend(single, s => s.constantValue);
70
+ // await q.getAndSend(single, s => asRef(s.referenceValue), ref => this.visit(ref, q));
71
+ // } else if (v.kind === Type.Kind.ArrayElementValue) {
72
+ // const array = v as Type.Annotation.ArrayElementValue;
73
+ // await q.getAndSendList(array, a => a.constantValues || [], val => val == null ? "null" : val.toString());
74
+ // await q.getAndSendList(array, a => (a.referenceValues || []).map(r => asRef(r)), t => Type.signature(t), r => this.visit(r, q));
75
+ // }
76
+ // });
77
+ return annotation;
78
+ }
79
+ async visitMethod(method, q) {
80
+ await q.getAndSend(method, m => (0, rpc_1.asRef)(m.declaringType), dt => this.visit(dt, q));
81
+ await q.getAndSend(method, m => m.name);
82
+ await q.getAndSend(method, m => m.flags);
83
+ await q.getAndSend(method, m => (0, rpc_1.asRef)(m.returnType), rt => this.visit(rt, q));
84
+ await q.getAndSendList(method, m => m.parameterNames || [], v => v);
85
+ await q.getAndSendList(method, m => (m.parameterTypes || []).map(t => (0, rpc_1.asRef)(t)), t => type_1.Type.signature(t), pt => this.visit(pt, q));
86
+ await q.getAndSendList(method, m => (m.thrownExceptions || []).map(t => (0, rpc_1.asRef)(t)), t => type_1.Type.signature(t), et => this.visit(et, q));
87
+ await q.getAndSendList(method, m => (m.annotations || []).map(a => (0, rpc_1.asRef)(a)), t => type_1.Type.signature(t), a => this.visit(a, q));
88
+ await q.getAndSendList(method, m => m.defaultValue || undefined, v => v);
89
+ await q.getAndSendList(method, m => m.declaredFormalTypeNames || [], v => v);
90
+ return method;
91
+ }
92
+ async visitArray(array, q) {
93
+ await q.getAndSend(array, a => (0, rpc_1.asRef)(a.elemType), et => this.visit(et, q));
94
+ await q.getAndSendList(array, a => (a.annotations || []).map(ann => (0, rpc_1.asRef)(ann)), t => type_1.Type.signature(t), ann => this.visit(ann, q));
95
+ return array;
96
+ }
97
+ async visitParameterized(parameterized, q) {
98
+ await q.getAndSend(parameterized, p => (0, rpc_1.asRef)(p.type), t => this.visit(t, q));
99
+ await q.getAndSendList(parameterized, p => (p.typeParameters || []).map(tp => (0, rpc_1.asRef)(tp)), t => type_1.Type.signature(t), tp => this.visit(tp, q));
100
+ return parameterized;
101
+ }
102
+ async visitGenericTypeVariable(generic, q) {
103
+ await q.getAndSend(generic, g => g.name);
104
+ // Convert TypeScript enum to Java enum string
105
+ await q.getAndSend(generic, g => {
106
+ switch (g.variance) {
107
+ case type_1.Type.GenericTypeVariable.Variance.Covariant:
108
+ return 'COVARIANT';
109
+ case type_1.Type.GenericTypeVariable.Variance.Contravariant:
110
+ return 'CONTRAVARIANT';
111
+ case type_1.Type.GenericTypeVariable.Variance.Invariant:
112
+ default:
113
+ return 'INVARIANT';
114
+ }
142
115
  });
116
+ await q.getAndSendList(generic, g => (g.bounds || []).map(b => (0, rpc_1.asRef)(b)), t => type_1.Type.signature(t), b => this.visit(b, q));
117
+ return generic;
143
118
  }
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
- });
119
+ async visitUnion(union, q) {
120
+ await q.getAndSendList(union, u => (u.bounds || []).map(b => (0, rpc_1.asRef)(b)), t => type_1.Type.signature(t), b => this.visit(b, q));
121
+ return union;
149
122
  }
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
- });
123
+ async visitIntersection(intersection, q) {
124
+ await q.getAndSendList(intersection, i => (i.bounds || []).map(b => (0, rpc_1.asRef)(b)), t => type_1.Type.signature(t), b => this.visit(b, q));
125
+ return intersection;
155
126
  }
156
127
  }
157
128
  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
- });
129
+ async preVisit(_type, _q) {
130
+ // Don't call default preVisit to avoid circular references
131
+ return _type;
132
+ }
133
+ async postVisit(_type, _q) {
134
+ // Don't call default postVisit to avoid circular references
135
+ return _type;
136
+ }
137
+ async visitPrimitive(primitive, q) {
138
+ const keyword = await q.receive(primitive.keyword);
139
+ return type_1.Type.Primitive.fromKeyword(keyword);
140
+ }
141
+ async visitClass(cls, q) {
142
+ cls.flags = await q.receive(cls.flags);
143
+ cls.classKind = await q.receive(cls.classKind);
144
+ cls.fullyQualifiedName = await q.receive(cls.fullyQualifiedName);
145
+ cls.typeParameters = await q.receiveList(cls.typeParameters, tp => this.visit(tp, q)) || [];
146
+ cls.supertype = await q.receive(cls.supertype, st => this.visit(st, q));
147
+ cls.owningClass = await q.receive(cls.owningClass, oc => this.visit(oc, q));
148
+ cls.annotations = await q.receiveList(cls.annotations, a => this.visit(a, q)) || [];
149
+ cls.interfaces = await q.receiveList(cls.interfaces, i => this.visit(i, q)) || [];
150
+ cls.members = await q.receiveList(cls.members, m => this.visit(m, q)) || [];
151
+ cls.methods = await q.receiveList(cls.methods, m => this.visit(m, q)) || [];
152
+ return cls;
153
+ }
154
+ async visitVariable(variable, q) {
155
+ variable.name = await q.receive(variable.name);
156
+ variable.owner = await q.receive(variable.owner, owner => this.visit(owner, q));
157
+ variable.type = await q.receive(variable.type, t => this.visit(t, q));
158
+ variable.annotations = await q.receiveList(variable.annotations, a => this.visit(a, q)) || [];
159
+ return variable;
160
+ }
161
+ async visitAnnotation(annotation, q) {
162
+ annotation.type = await q.receive(annotation.type, t => this.visit(t, q));
163
+ // annotation.values = await q.receiveList(annotation.values, async v => {
164
+ // // Handle element values inline like the Java implementation
165
+ // if (v.kind === Type.Kind.SingleElementValue) {
166
+ // const single = v as Type.Annotation.SingleElementValue;
167
+ // const element = await q.receive(single.element, elem => this.visit(elem, q));
168
+ // const constantValue = await q.receive(single.constantValue);
169
+ // const referenceValue = await q.receive(single.referenceValue, ref => this.visit(ref, q));
170
+ // return {
171
+ // kind: Type.Kind.SingleElementValue,
172
+ // element,
173
+ // constantValue,
174
+ // referenceValue
175
+ // } as Type.Annotation.SingleElementValue;
176
+ // } else if (v.kind === Type.Kind.ArrayElementValue) {
177
+ // const array = v as Type.Annotation.ArrayElementValue;
178
+ // const element = await q.receive(array.element, elem => this.visit(elem, q));
179
+ // const constantValues = await q.receiveList(array.constantValues);
180
+ // const referenceValues = await q.receiveList(array.referenceValues, r => this.visit(r, q));
181
+ // return {
182
+ // kind: Type.Kind.ArrayElementValue,
183
+ // element,
184
+ // constantValues,
185
+ // referenceValues
186
+ // } as Type.Annotation.ArrayElementValue;
187
+ // }
188
+ // return v;
189
+ // }) || [];
190
+ return annotation;
191
+ }
192
+ async visitMethod(method, q) {
193
+ method.declaringType = await q.receive(method.declaringType, dt => this.visit(dt, q));
194
+ method.name = await q.receive(method.name);
195
+ method.flags = await q.receive(method.flags);
196
+ method.returnType = await q.receive(method.returnType, rt => this.visit(rt, q));
197
+ method.parameterNames = await q.receiveList(method.parameterNames) || [];
198
+ method.parameterTypes = await q.receiveList(method.parameterTypes, pt => this.visit(pt, q)) || [];
199
+ method.thrownExceptions = await q.receiveList(method.thrownExceptions, et => this.visit(et, q)) || [];
200
+ method.annotations = await q.receiveList(method.annotations, a => this.visit(a, q)) || [];
201
+ method.defaultValue = await q.receiveList(method.defaultValue);
202
+ method.declaredFormalTypeNames = await q.receiveList(method.declaredFormalTypeNames) || [];
203
+ return method;
204
+ }
205
+ async visitArray(array, q) {
206
+ array.elemType = await q.receive(array.elemType, et => this.visit(et, q));
207
+ array.annotations = await q.receiveList(array.annotations, ann => this.visit(ann, q)) || [];
208
+ return array;
209
+ }
210
+ async visitParameterized(parameterized, q) {
211
+ parameterized.type = await q.receive(parameterized.type, t => this.visit(t, q));
212
+ parameterized.typeParameters = await q.receiveList(parameterized.typeParameters, tp => this.visit(tp, q)) || [];
213
+ return parameterized;
214
+ }
215
+ async visitGenericTypeVariable(generic, q) {
216
+ generic.name = await q.receive(generic.name);
217
+ const varianceStr = await q.receive(generic.variance);
218
+ // Convert Java enum string to TypeScript enum
219
+ switch (varianceStr) {
220
+ case 'COVARIANT':
221
+ generic.variance = type_1.Type.GenericTypeVariable.Variance.Covariant;
222
+ break;
223
+ case 'CONTRAVARIANT':
224
+ generic.variance = type_1.Type.GenericTypeVariable.Variance.Contravariant;
225
+ break;
226
+ case 'INVARIANT':
227
+ default:
228
+ generic.variance = type_1.Type.GenericTypeVariable.Variance.Invariant;
229
+ break;
230
+ }
231
+ generic.bounds = await q.receiveList(generic.bounds, b => this.visit(b, q)) || [];
232
+ return generic;
282
233
  }
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
- });
234
+ async visitUnion(union, q) {
235
+ union.bounds = await q.receiveList(union.bounds, b => this.visit(b, q)) || [];
236
+ return union;
288
237
  }
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
- });
238
+ async visitIntersection(intersection, q) {
239
+ intersection.bounds = await q.receiveList(intersection.bounds, b => this.visit(b, q)) || [];
240
+ return intersection;
294
241
  }
295
242
  }
296
243
  class JavaSender extends visitor_1.JavaVisitor {
@@ -298,641 +245,487 @@ class JavaSender extends visitor_1.JavaVisitor {
298
245
  super(...arguments);
299
246
  this.typeVisitor = new TypeSender();
300
247
  }
301
- preVisit(j, q) {
302
- return __awaiter(this, void 0, void 0, function* () {
303
- yield q.getAndSend(j, j2 => j2.id);
304
- yield q.getAndSend(j, j2 => j2.prefix, space => this.visitSpace(space, q));
305
- yield q.getAndSend(j, j2 => j2.markers);
306
- return j;
307
- });
308
- }
309
- visitAnnotatedType(annotatedType, q) {
310
- return __awaiter(this, void 0, void 0, function* () {
311
- yield q.getAndSendList(annotatedType, a => a.annotations, annot => annot.id, annot => this.visit(annot, q));
312
- yield q.getAndSend(annotatedType, a => a.typeExpression, type => this.visit(type, q));
313
- return annotatedType;
314
- });
315
- }
316
- visitAnnotation(annotation, q) {
317
- return __awaiter(this, void 0, void 0, function* () {
318
- yield q.getAndSend(annotation, a => a.annotationType, type => this.visit(type, q));
319
- yield q.getAndSend(annotation, a => a.arguments, args => this.visitContainer(args, q));
320
- return annotation;
321
- });
322
- }
323
- visitArrayAccess(arrayAccess, q) {
324
- return __awaiter(this, void 0, void 0, function* () {
325
- yield q.getAndSend(arrayAccess, a => a.indexed, indexed => this.visit(indexed, q));
326
- yield q.getAndSend(arrayAccess, a => a.dimension, dim => this.visit(dim, q));
327
- return arrayAccess;
328
- });
329
- }
330
- visitArrayDimension(dimension, q) {
331
- return __awaiter(this, void 0, void 0, function* () {
332
- yield q.getAndSend(dimension, d => d.index, idx => this.visitRightPadded(idx, q));
333
- return dimension;
334
- });
335
- }
336
- visitArrayType(arrayType, q) {
337
- return __awaiter(this, void 0, void 0, function* () {
338
- yield q.getAndSend(arrayType, a => a.elementType, type => this.visit(type, q));
339
- yield q.getAndSendList(arrayType, a => a.annotations || [], annot => annot.id, annot => this.visit(annot, q));
340
- yield q.getAndSend(arrayType, a => a.dimension, d => this.visitLeftPadded(d, q));
341
- yield q.getAndSend(arrayType, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
342
- return arrayType;
343
- });
344
- }
345
- visitAssert(assert, q) {
346
- return __awaiter(this, void 0, void 0, function* () {
347
- yield q.getAndSend(assert, a => a.condition, cond => this.visit(cond, q));
348
- yield q.getAndSend(assert, a => a.detail, detail => this.visitLeftPadded(detail, q));
349
- return assert;
350
- });
351
- }
352
- visitAssignment(assignment, q) {
353
- return __awaiter(this, void 0, void 0, function* () {
354
- yield q.getAndSend(assignment, a => a.variable, variable => this.visit(variable, q));
355
- yield q.getAndSend(assignment, a => a.assignment, assign => this.visitLeftPadded(assign, q));
356
- yield q.getAndSend(assignment, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
357
- return assignment;
358
- });
359
- }
360
- visitAssignmentOperation(assignOp, q) {
361
- return __awaiter(this, void 0, void 0, function* () {
362
- yield q.getAndSend(assignOp, a => a.variable, variable => this.visit(variable, q));
363
- yield q.getAndSend(assignOp, a => a.operator, op => this.visitLeftPadded(op, q));
364
- yield q.getAndSend(assignOp, a => a.assignment, assign => this.visit(assign, q));
365
- yield q.getAndSend(assignOp, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
366
- return assignOp;
367
- });
368
- }
369
- visitBinary(binary, q) {
370
- return __awaiter(this, void 0, void 0, function* () {
371
- yield q.getAndSend(binary, b => b.left, left => this.visit(left, q));
372
- yield q.getAndSend(binary, b => b.operator, op => this.visitLeftPadded(op, q));
373
- yield q.getAndSend(binary, b => b.right, right => this.visit(right, q));
374
- yield q.getAndSend(binary, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
375
- return binary;
376
- });
377
- }
378
- visitBreak(breakStmt, q) {
379
- return __awaiter(this, void 0, void 0, function* () {
380
- yield q.getAndSend(breakStmt, b => b.label, label => this.visit(label, q));
381
- return breakStmt;
382
- });
383
- }
384
- visitCase(caseStmt, q) {
385
- return __awaiter(this, void 0, void 0, function* () {
386
- yield q.getAndSend(caseStmt, c => c.type);
387
- yield q.getAndSend(caseStmt, c => c.caseLabels, labels => this.visitContainer(labels, q));
388
- yield q.getAndSend(caseStmt, c => c.statements, stmts => this.visitContainer(stmts, q));
389
- yield q.getAndSend(caseStmt, c => c.body, body => this.visitRightPadded(body, q));
390
- yield q.getAndSend(caseStmt, c => c.guard, guard => this.visit(guard, q));
391
- return caseStmt;
392
- });
393
- }
394
- visitContinue(continueStmt, q) {
395
- return __awaiter(this, void 0, void 0, function* () {
396
- yield q.getAndSend(continueStmt, c => c.label, label => this.visit(label, q));
397
- return continueStmt;
398
- });
399
- }
400
- visitControlParentheses(controlParens, q) {
401
- return __awaiter(this, void 0, void 0, function* () {
402
- yield q.getAndSend(controlParens, c => c.tree, tree => this.visitRightPadded(tree, q));
403
- return controlParens;
404
- });
405
- }
406
- visitDeconstructionPattern(pattern, q) {
407
- return __awaiter(this, void 0, void 0, function* () {
408
- yield q.getAndSend(pattern, p => p.deconstructor, deconstructor => this.visit(deconstructor, q));
409
- yield q.getAndSend(pattern, p => p.nested, nested => this.visitContainer(nested, q));
410
- yield q.getAndSend(pattern, p => (0, rpc_1.asRef)(p.type), type => this.visitType(type, q));
411
- return pattern;
412
- });
413
- }
414
- visitDoWhileLoop(doWhile, q) {
415
- return __awaiter(this, void 0, void 0, function* () {
416
- yield q.getAndSend(doWhile, d => d.body, body => this.visitRightPadded(body, q));
417
- yield q.getAndSend(doWhile, d => d.whileCondition, cond => this.visitLeftPadded(cond, q));
418
- return doWhile;
419
- });
420
- }
421
- visitEmpty(empty, _q) {
422
- return __awaiter(this, void 0, void 0, function* () {
423
- // No additional properties to send
424
- return empty;
425
- });
426
- }
427
- visitEnumValueSet(enumValueSet, q) {
428
- return __awaiter(this, void 0, void 0, function* () {
429
- yield q.getAndSendList(enumValueSet, e => e.enums, enumValue => enumValue.element.id, enumValue => this.visitRightPadded(enumValue, q));
430
- yield q.getAndSend(enumValueSet, e => e.terminatedWithSemicolon);
431
- return enumValueSet;
432
- });
433
- }
434
- visitEnumValue(enumValue, q) {
435
- return __awaiter(this, void 0, void 0, function* () {
436
- yield q.getAndSendList(enumValue, e => e.annotations, annot => annot.id, annot => this.visit(annot, q));
437
- yield q.getAndSend(enumValue, e => e.name, name => this.visit(name, q));
438
- yield q.getAndSend(enumValue, e => e.initializer, init => this.visit(init, q));
439
- return enumValue;
440
- });
441
- }
442
- visitErroneous(erroneous, q) {
443
- return __awaiter(this, void 0, void 0, function* () {
444
- yield q.getAndSend(erroneous, e => e.text);
445
- return erroneous;
446
- });
447
- }
448
- visitFieldAccess(fieldAccess, q) {
449
- return __awaiter(this, void 0, void 0, function* () {
450
- yield q.getAndSend(fieldAccess, f => f.target, target => this.visit(target, q));
451
- yield q.getAndSend(fieldAccess, f => f.name, name => this.visitLeftPadded(name, q));
452
- yield q.getAndSend(fieldAccess, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
453
- return fieldAccess;
454
- });
455
- }
456
- visitForEachLoop(forEach, q) {
457
- return __awaiter(this, void 0, void 0, function* () {
458
- yield q.getAndSend(forEach, f => f.control, control => this.visit(control, q));
459
- yield q.getAndSend(forEach, f => f.body, body => this.visitRightPadded(body, q));
460
- return forEach;
461
- });
462
- }
463
- visitForEachLoopControl(control, q) {
464
- return __awaiter(this, void 0, void 0, function* () {
465
- yield q.getAndSend(control, c => c.variable, variable => this.visitRightPadded(variable, q));
466
- yield q.getAndSend(control, c => c.iterable, iterable => this.visitRightPadded(iterable, q));
467
- return control;
468
- });
469
- }
470
- visitForLoop(forLoop, q) {
471
- return __awaiter(this, void 0, void 0, function* () {
472
- yield q.getAndSend(forLoop, f => f.control, control => this.visit(control, q));
473
- yield q.getAndSend(forLoop, f => f.body, body => this.visitRightPadded(body, q));
474
- return forLoop;
475
- });
476
- }
477
- visitForLoopControl(control, q) {
478
- return __awaiter(this, void 0, void 0, function* () {
479
- yield q.getAndSendList(control, c => c.init, i => i.element.id, i => this.visitRightPadded(i, q));
480
- yield q.getAndSend(control, c => c.condition, c => this.visitRightPadded(c, q));
481
- yield q.getAndSendList(control, c => c.update, u => u.element.id, u => this.visitRightPadded(u, q));
482
- return control;
483
- });
484
- }
485
- visitIf(ifStmt, q) {
486
- return __awaiter(this, void 0, void 0, function* () {
487
- yield q.getAndSend(ifStmt, i => i.ifCondition, cond => this.visit(cond, q));
488
- yield q.getAndSend(ifStmt, i => i.thenPart, then => this.visitRightPadded(then, q));
489
- yield q.getAndSend(ifStmt, i => i.elsePart, elsePart => this.visit(elsePart, q));
490
- return ifStmt;
491
- });
492
- }
493
- visitElse(ifElse, q) {
494
- return __awaiter(this, void 0, void 0, function* () {
495
- yield q.getAndSend(ifElse, e => e.body, body => this.visitRightPadded(body, q));
496
- return ifElse;
497
- });
498
- }
499
- visitImport(importStmt, q) {
500
- return __awaiter(this, void 0, void 0, function* () {
501
- yield q.getAndSend(importStmt, i => i.static, static_ => this.visitLeftPadded(static_, q));
502
- yield q.getAndSend(importStmt, i => i.qualid, qualid => this.visit(qualid, q));
503
- yield q.getAndSend(importStmt, i => i.alias, alias => this.visitLeftPadded(alias, q));
504
- return importStmt;
505
- });
506
- }
507
- visitInstanceOf(instanceOf, q) {
508
- return __awaiter(this, void 0, void 0, function* () {
509
- yield q.getAndSend(instanceOf, i => i.expression, expr => this.visitRightPadded(expr, q));
510
- yield q.getAndSend(instanceOf, i => i.class, clazz => this.visit(clazz, q));
511
- yield q.getAndSend(instanceOf, i => i.pattern, pattern => this.visit(pattern, q));
512
- yield q.getAndSend(instanceOf, i => (0, rpc_1.asRef)(i.type), type => this.visitType(type, q));
513
- yield q.getAndSend(instanceOf, i => i.modifier, modifier => this.visit(modifier, q));
514
- return instanceOf;
515
- });
516
- }
517
- visitIntersectionType(intersectionType, q) {
518
- return __awaiter(this, void 0, void 0, function* () {
519
- yield q.getAndSend(intersectionType, i => i.bounds, bounds => this.visitContainer(bounds, q));
520
- return intersectionType;
521
- });
522
- }
523
- visitLabel(label, q) {
524
- return __awaiter(this, void 0, void 0, function* () {
525
- yield q.getAndSend(label, l => l.label, id => this.visitRightPadded(id, q));
526
- yield q.getAndSend(label, l => l.statement, stmt => this.visit(stmt, q));
527
- return label;
528
- });
529
- }
530
- visitLambda(lambda, q) {
531
- return __awaiter(this, void 0, void 0, function* () {
532
- yield q.getAndSend(lambda, l => l.parameters, params => this.visit(params, q));
533
- yield q.getAndSend(lambda, l => l.arrow, arrow => this.visitSpace(arrow, q));
534
- yield q.getAndSend(lambda, l => l.body, body => this.visit(body, q));
535
- yield q.getAndSend(lambda, l => (0, rpc_1.asRef)(l.type), type => this.visitType(type, q));
536
- return lambda;
537
- });
538
- }
539
- visitLambdaParameters(params, q) {
540
- return __awaiter(this, void 0, void 0, function* () {
541
- yield q.getAndSend(params, p => p.parenthesized);
542
- yield q.getAndSendList(params, p => p.parameters, param => param.element.id, param => this.visitRightPadded(param, q));
543
- return params;
544
- });
545
- }
546
- visitLiteral(literal, q) {
547
- return __awaiter(this, void 0, void 0, function* () {
548
- yield q.getAndSend(literal, l => l.value);
549
- yield q.getAndSend(literal, l => l.valueSource);
550
- yield q.getAndSendList(literal, l => l.unicodeEscapes, e => e.valueSourceIndex + e.codePoint);
551
- yield q.getAndSend(literal, l => (0, rpc_1.asRef)(l.type), type => this.visitType(type, q));
552
- return literal;
553
- });
554
- }
555
- visitMemberReference(memberRef, q) {
556
- return __awaiter(this, void 0, void 0, function* () {
557
- yield q.getAndSend(memberRef, m => m.containing, cont => this.visitRightPadded(cont, q));
558
- yield q.getAndSend(memberRef, m => m.typeParameters, params => this.visitContainer(params, q));
559
- yield q.getAndSend(memberRef, m => m.reference, ref => this.visitLeftPadded(ref, q));
560
- yield q.getAndSend(memberRef, m => (0, rpc_1.asRef)(m.type), type => this.visitType(type, q));
561
- yield q.getAndSend(memberRef, m => (0, rpc_1.asRef)(m.methodType), type => this.visitType(type, q));
562
- yield q.getAndSend(memberRef, m => (0, rpc_1.asRef)(m.variableType), type => this.visitType(type, q));
563
- return memberRef;
564
- });
565
- }
566
- visitMethodInvocation(invocation, q) {
567
- return __awaiter(this, void 0, void 0, function* () {
568
- yield q.getAndSend(invocation, m => m.select, select => this.visitRightPadded(select, q));
569
- yield q.getAndSend(invocation, m => m.typeParameters, params => this.visitContainer(params, q));
570
- yield q.getAndSend(invocation, m => m.name, name => this.visit(name, q));
571
- yield q.getAndSend(invocation, m => m.arguments, args => this.visitContainer(args, q));
572
- yield q.getAndSend(invocation, m => (0, rpc_1.asRef)(m.methodType), type => this.visitType(type, q));
573
- return invocation;
574
- });
575
- }
576
- visitModifier(modifier, q) {
577
- return __awaiter(this, void 0, void 0, function* () {
578
- yield q.getAndSend(modifier, m => m.keyword);
579
- yield q.getAndSend(modifier, m => m.type);
580
- yield q.getAndSendList(modifier, m => m.annotations, annot => annot.id, annot => this.visit(annot, q));
581
- return modifier;
582
- });
583
- }
584
- visitMultiCatch(multiCatch, q) {
585
- return __awaiter(this, void 0, void 0, function* () {
586
- yield q.getAndSendList(multiCatch, m => m.alternatives, alt => alt.element.id, alt => this.visitRightPadded(alt, q));
587
- return multiCatch;
588
- });
589
- }
590
- visitNewArray(newArray, q) {
591
- return __awaiter(this, void 0, void 0, function* () {
592
- yield q.getAndSend(newArray, n => n.typeExpression, type => this.visit(type, q));
593
- yield q.getAndSendList(newArray, n => n.dimensions, dim => dim.id, dim => this.visit(dim, q));
594
- yield q.getAndSend(newArray, n => n.initializer, init => this.visitContainer(init, q));
595
- yield q.getAndSend(newArray, n => (0, rpc_1.asRef)(n.type), type => this.visitType(type, q));
596
- return newArray;
597
- });
598
- }
599
- visitNewClass(newClass, q) {
600
- return __awaiter(this, void 0, void 0, function* () {
601
- yield q.getAndSend(newClass, n => n.enclosing, encl => this.visitRightPadded(encl, q));
602
- yield q.getAndSend(newClass, n => n.new, n => this.visitSpace(n, q));
603
- yield q.getAndSend(newClass, n => n.class, clazz => this.visit(clazz, q));
604
- yield q.getAndSend(newClass, n => n.arguments, args => this.visitContainer(args, q));
605
- yield q.getAndSend(newClass, n => n.body, body => this.visit(body, q));
606
- yield q.getAndSend(newClass, n => (0, rpc_1.asRef)(n.constructorType), type => this.visitType(type, q));
607
- return newClass;
608
- });
609
- }
610
- visitNullableType(nullableType, q) {
611
- return __awaiter(this, void 0, void 0, function* () {
612
- yield q.getAndSendList(nullableType, a => a.annotations, annot => annot.id, annot => this.visit(annot, q));
613
- yield q.getAndSend(nullableType, n => n.typeTree, type => this.visitRightPadded(type, q));
614
- return nullableType;
615
- });
616
- }
617
- visitParameterizedType(paramType, q) {
618
- return __awaiter(this, void 0, void 0, function* () {
619
- yield q.getAndSend(paramType, p => p.class, clazz => this.visit(clazz, q));
620
- yield q.getAndSend(paramType, p => p.typeParameters, params => this.visitContainer(params, q));
621
- yield q.getAndSend(paramType, p => (0, rpc_1.asRef)(p.type), type => this.visitType(type, q));
622
- return paramType;
623
- });
624
- }
625
- visitParentheses(parentheses, q) {
626
- return __awaiter(this, void 0, void 0, function* () {
627
- yield q.getAndSend(parentheses, p => p.tree, tree => this.visitRightPadded(tree, q));
628
- return parentheses;
629
- });
630
- }
631
- visitParenthesizedTypeTree(parenthesizedType, q) {
632
- return __awaiter(this, void 0, void 0, function* () {
633
- yield q.getAndSendList(parenthesizedType, a => a.annotations, annot => annot.id, annot => this.visit(annot, q));
634
- yield q.getAndSend(parenthesizedType, p => p.parenthesizedType, tree => this.visit(tree, q));
635
- return parenthesizedType;
636
- });
637
- }
638
- visitPrimitive(primitive, q) {
639
- return __awaiter(this, void 0, void 0, function* () {
640
- yield q.getAndSend(primitive, p => (0, rpc_1.asRef)(p.type), type => this.visitType(type, q));
641
- return primitive;
642
- });
643
- }
644
- visitReturn(returnStmt, q) {
645
- return __awaiter(this, void 0, void 0, function* () {
646
- yield q.getAndSend(returnStmt, r => r.expression, expr => this.visit(expr, q));
647
- return returnStmt;
648
- });
649
- }
650
- visitSwitch(aSwitch, q) {
651
- return __awaiter(this, void 0, void 0, function* () {
652
- yield q.getAndSend(aSwitch, s => s.selector, sel => this.visit(sel, q));
653
- yield q.getAndSend(aSwitch, s => s.cases, block => this.visit(block, q));
654
- return aSwitch;
655
- });
656
- }
657
- visitSwitchExpression(switchExpr, q) {
658
- return __awaiter(this, void 0, void 0, function* () {
659
- yield q.getAndSend(switchExpr, s => s.selector, sel => this.visit(sel, q));
660
- yield q.getAndSend(switchExpr, s => s.cases, block => this.visit(block, q));
661
- yield q.getAndSend(switchExpr, s => (0, rpc_1.asRef)(s.type), type => this.visitType(type, q));
662
- return switchExpr;
663
- });
664
- }
665
- visitSynchronized(syncStmt, q) {
666
- return __awaiter(this, void 0, void 0, function* () {
667
- yield q.getAndSend(syncStmt, s => s.lock, lock => this.visit(lock, q));
668
- yield q.getAndSend(syncStmt, s => s.body, body => this.visit(body, q));
669
- return syncStmt;
670
- });
671
- }
672
- visitTernary(ternary, q) {
673
- return __awaiter(this, void 0, void 0, function* () {
674
- yield q.getAndSend(ternary, t => t.condition, cond => this.visit(cond, q));
675
- yield q.getAndSend(ternary, t => t.truePart, truePart => this.visitLeftPadded(truePart, q));
676
- yield q.getAndSend(ternary, t => t.falsePart, falsePart => this.visitLeftPadded(falsePart, q));
677
- yield q.getAndSend(ternary, t => (0, rpc_1.asRef)(t.type), type => this.visitType(type, q));
678
- return ternary;
679
- });
680
- }
681
- visitThrow(throwStmt, q) {
682
- return __awaiter(this, void 0, void 0, function* () {
683
- yield q.getAndSend(throwStmt, t => t.exception, exc => this.visit(exc, q));
684
- return throwStmt;
685
- });
686
- }
687
- visitTry(tryStmt, q) {
688
- return __awaiter(this, void 0, void 0, function* () {
689
- yield q.getAndSend(tryStmt, t => t.resources, res => this.visitContainer(res, q));
690
- yield q.getAndSend(tryStmt, t => t.body, body => this.visit(body, q));
691
- yield q.getAndSendList(tryStmt, t => t.catches, catch_ => catch_.id, catch_ => this.visit(catch_, q));
692
- yield q.getAndSend(tryStmt, t => t.finally, fin => this.visitLeftPadded(fin, q));
693
- return tryStmt;
694
- });
695
- }
696
- visitTryResource(resource, q) {
697
- return __awaiter(this, void 0, void 0, function* () {
698
- yield q.getAndSend(resource, r => r.variableDeclarations, variable => this.visit(variable, q));
699
- yield q.getAndSend(resource, r => r.terminatedWithSemicolon);
700
- return resource;
701
- });
702
- }
703
- visitTryCatch(aCatch, q) {
704
- return __awaiter(this, void 0, void 0, function* () {
705
- yield q.getAndSend(aCatch, c => c.parameter, param => this.visit(param, q));
706
- yield q.getAndSend(aCatch, c => c.body, body => this.visit(body, q));
707
- return aCatch;
708
- });
709
- }
710
- visitTypeCast(typeCast, q) {
711
- return __awaiter(this, void 0, void 0, function* () {
712
- yield q.getAndSend(typeCast, t => t.class, clazz => this.visit(clazz, q));
713
- yield q.getAndSend(typeCast, t => t.expression, expr => this.visit(expr, q));
714
- return typeCast;
715
- });
716
- }
717
- visitTypeParameter(typeParam, q) {
718
- return __awaiter(this, void 0, void 0, function* () {
719
- yield q.getAndSendList(typeParam, t => t.annotations, annot => annot.id, annot => this.visit(annot, q));
720
- yield q.getAndSendList(typeParam, t => t.modifiers, mod => mod.id, mod => this.visit(mod, q));
721
- yield q.getAndSend(typeParam, t => t.name, name => this.visit(name, q));
722
- yield q.getAndSend(typeParam, t => t.bounds, bounds => this.visitContainer(bounds, q));
723
- return typeParam;
724
- });
725
- }
726
- visitTypeParameters(typeParams, q) {
727
- return __awaiter(this, void 0, void 0, function* () {
728
- yield q.getAndSendList(typeParams, a => a.annotations, annot => annot.id, annot => this.visit(annot, q));
729
- yield q.getAndSendList(typeParams, t => t.typeParameters, p => p.element.id, params => this.visitRightPadded(params, q));
730
- return typeParams;
731
- });
732
- }
733
- visitUnary(unary, q) {
734
- return __awaiter(this, void 0, void 0, function* () {
735
- yield q.getAndSend(unary, u => u.operator, op => this.visitLeftPadded(op, q));
736
- yield q.getAndSend(unary, u => u.expression, expr => this.visit(expr, q));
737
- yield q.getAndSend(unary, u => (0, rpc_1.asRef)(u.type), type => this.visitType(type, q));
738
- return unary;
739
- });
740
- }
741
- visitVariable(variable, q) {
742
- return __awaiter(this, void 0, void 0, function* () {
743
- yield q.getAndSend(variable, v => v.name, name => this.visit(name, q));
744
- yield q.getAndSendList(variable, v => v.dimensionsAfterName, d => JSON.stringify(d.element), dims => this.visitLeftPadded(dims, q));
745
- yield q.getAndSend(variable, v => v.initializer, init => this.visitLeftPadded(init, q));
746
- yield q.getAndSend(variable, v => (0, rpc_1.asRef)(v.variableType), type => this.visitType(type, q));
747
- return variable;
748
- });
749
- }
750
- visitWhileLoop(whileLoop, q) {
751
- return __awaiter(this, void 0, void 0, function* () {
752
- yield q.getAndSend(whileLoop, w => w.condition, cond => this.visit(cond, q));
753
- yield q.getAndSend(whileLoop, w => w.body, body => this.visitRightPadded(body, q));
754
- return whileLoop;
755
- });
756
- }
757
- visitWildcard(wildcard, q) {
758
- return __awaiter(this, void 0, void 0, function* () {
759
- yield q.getAndSend(wildcard, w => w.bound, b => this.visitLeftPadded(b, q));
760
- yield q.getAndSend(wildcard, w => w.boundedType, type => this.visit(type, q));
761
- return wildcard;
762
- });
763
- }
764
- visitYield(yieldExpr, q) {
765
- return __awaiter(this, void 0, void 0, function* () {
766
- yield q.getAndSend(yieldExpr, y => y.implicit);
767
- yield q.getAndSend(yieldExpr, y => y.value, value => this.visit(value, q));
768
- return yieldExpr;
769
- });
770
- }
771
- visitUnknown(unknown, q) {
772
- return __awaiter(this, void 0, void 0, function* () {
773
- yield q.getAndSend(unknown, u => u.source, source => this.visit(source, q));
774
- return unknown;
775
- });
776
- }
777
- visitUnknownSource(source, q) {
778
- return __awaiter(this, void 0, void 0, function* () {
779
- yield q.getAndSend(source, s => s.text);
780
- return source;
781
- });
782
- }
783
- visitCompilationUnit(cu, q) {
784
- return __awaiter(this, void 0, void 0, function* () {
785
- yield q.getAndSend(cu, c => c.sourcePath);
786
- yield q.getAndSend(cu, c => c.charsetName);
787
- yield q.getAndSend(cu, c => c.charsetBomMarked);
788
- yield q.getAndSend(cu, c => c.checksum);
789
- yield q.getAndSend(cu, c => c.fileAttributes);
790
- yield q.getAndSend(cu, c => c.packageDeclaration, pkg => this.visitRightPadded(pkg, q));
791
- yield q.getAndSendList(cu, c => c.imports, imp => imp.element.id, imp => this.visitRightPadded(imp, q));
792
- yield q.getAndSendList(cu, c => c.classes, cls => cls.id, cls => this.visit(cls, q));
793
- yield q.getAndSend(cu, c => c.eof, space => this.visitSpace(space, q));
794
- return cu;
795
- });
796
- }
797
- visitPackage(pkg, q) {
798
- return __awaiter(this, void 0, void 0, function* () {
799
- yield q.getAndSend(pkg, p => p.expression, expr => this.visit(expr, q));
800
- yield q.getAndSendList(pkg, p => p.annotations, annot => annot.id, annot => this.visit(annot, q));
801
- return pkg;
802
- });
803
- }
804
- visitClassDeclaration(cls, q) {
805
- return __awaiter(this, void 0, void 0, function* () {
806
- yield q.getAndSendList(cls, c => c.leadingAnnotations, annot => annot.id, annot => this.visit(annot, q));
807
- yield q.getAndSendList(cls, c => c.modifiers, mod => mod.id, mod => this.visit(mod, q));
808
- yield q.getAndSend(cls, c => c.classKind, kind => this.visit(kind, q));
809
- yield q.getAndSend(cls, c => c.name, name => this.visit(name, q));
810
- yield q.getAndSend(cls, c => c.typeParameters, params => this.visitContainer(params, q));
811
- yield q.getAndSend(cls, c => c.primaryConstructor, cons => this.visitContainer(cons, q));
812
- yield q.getAndSend(cls, c => c.extends, ext => this.visitLeftPadded(ext, q));
813
- yield q.getAndSend(cls, c => c.implements, impl => this.visitContainer(impl, q));
814
- yield q.getAndSend(cls, c => c.permitting, perm => this.visitContainer(perm, q));
815
- yield q.getAndSend(cls, c => c.body, body => this.visit(body, q));
816
- return cls;
817
- });
818
- }
819
- visitClassDeclarationKind(kind, q) {
820
- return __awaiter(this, void 0, void 0, function* () {
821
- yield q.getAndSendList(kind, k => k.annotations, annot => annot.id, annot => this.visit(annot, q));
822
- yield q.getAndSend(kind, k => k.type);
823
- return kind;
824
- });
825
- }
826
- visitBlock(block, q) {
827
- return __awaiter(this, void 0, void 0, function* () {
828
- yield q.getAndSend(block, b => b.static, s => this.visitRightPadded(s, q));
829
- yield q.getAndSendList(block, b => b.statements, stmt => stmt.element.id, stmt => this.visitRightPadded(stmt, q));
830
- yield q.getAndSend(block, b => b.end, space => this.visitSpace(space, q));
831
- return block;
832
- });
833
- }
834
- visitMethodDeclaration(method, q) {
835
- return __awaiter(this, void 0, void 0, function* () {
836
- yield q.getAndSendList(method, m => m.leadingAnnotations, annot => annot.id, annot => this.visit(annot, q));
837
- yield q.getAndSendList(method, m => m.modifiers, mod => mod.id, mod => this.visit(mod, q));
838
- yield q.getAndSend(method, m => m.typeParameters, params => this.visit(params, q));
839
- yield q.getAndSend(method, m => m.returnTypeExpression, type => this.visit(type, q));
840
- yield q.getAndSendList(method, m => m.nameAnnotations, a => a.id, name => this.visit(name, q));
841
- yield q.getAndSend(method, m => m.name, name => this.visit(name, q));
842
- yield q.getAndSend(method, m => m.parameters, params => this.visitContainer(params, q));
843
- yield q.getAndSend(method, m => m.throws, throws => this.visitContainer(throws, q));
844
- yield q.getAndSend(method, m => m.body, body => this.visit(body, q));
845
- yield q.getAndSend(method, m => m.defaultValue, def => this.visitLeftPadded(def, q));
846
- yield q.getAndSend(method, m => (0, rpc_1.asRef)(m.methodType), type => this.visitType(type, q));
847
- return method;
848
- });
849
- }
850
- visitVariableDeclarations(varDecls, q) {
851
- return __awaiter(this, void 0, void 0, function* () {
852
- yield q.getAndSendList(varDecls, v => v.leadingAnnotations, annot => annot.id, annot => this.visit(annot, q));
853
- yield q.getAndSendList(varDecls, v => v.modifiers, mod => mod.id, mod => this.visit(mod, q));
854
- yield q.getAndSend(varDecls, v => v.typeExpression, type => this.visit(type, q));
855
- yield q.getAndSend(varDecls, v => v.varargs, space => this.visitSpace(space, q));
856
- yield q.getAndSendList(varDecls, v => v.variables, variable => variable.element.id, variable => this.visitRightPadded(variable, q));
857
- return varDecls;
858
- });
859
- }
860
- visitIdentifier(ident, q) {
861
- return __awaiter(this, void 0, void 0, function* () {
862
- yield q.getAndSendList(ident, id => id.annotations, annot => annot.id, annot => this.visit(annot, q));
863
- yield q.getAndSend(ident, id => id.simpleName);
864
- yield q.getAndSend(ident, id => (0, rpc_1.asRef)(id.type), type => this.visitType(type, q));
865
- yield q.getAndSend(ident, id => (0, rpc_1.asRef)(id.fieldType), type => this.visitType(type, q));
866
- return ident;
867
- });
868
- }
869
- visitSpace(space, q) {
870
- return __awaiter(this, void 0, void 0, function* () {
871
- yield q.getAndSendList(space, s => s.comments, c => {
872
- if (c.kind === tree_1.J.Kind.TextComment) {
873
- return c.text + c.suffix;
874
- }
875
- throw new Error(`Unexpected comment type ${c.kind}`);
876
- }, (c) => __awaiter(this, void 0, void 0, function* () {
877
- if (c.kind === tree_1.J.Kind.TextComment) {
878
- const tc = c;
879
- yield q.getAndSend(tc, c2 => c2.multiline);
880
- yield q.getAndSend(tc, c2 => c2.text);
881
- }
882
- else {
883
- throw new Error(`Unexpected comment type ${c.kind}`);
884
- }
885
- yield q.getAndSend(c, c2 => c2.suffix);
886
- yield q.getAndSend(c, c2 => c2.markers);
887
- }));
888
- yield q.getAndSend(space, s => s.whitespace);
889
- return space;
890
- });
891
- }
892
- visitLeftPadded(left, q) {
893
- return __awaiter(this, void 0, void 0, function* () {
894
- yield q.getAndSend(left, l => l.before, space => this.visitSpace(space, q));
895
- if ((0, tree_2.isTree)(left.element)) {
896
- yield q.getAndSend(left, l => l.element, elem => this.visit(elem, q));
897
- }
898
- else if ((0, tree_1.isSpace)(left.element)) {
899
- yield q.getAndSend(left, l => l.element, space => this.visitSpace(space, q));
900
- }
901
- else {
902
- yield q.getAndSend(left, l => l.element);
248
+ async preVisit(j, q) {
249
+ await q.getAndSend(j, j2 => j2.id);
250
+ await q.getAndSend(j, j2 => j2.prefix, space => this.visitSpace(space, q));
251
+ await q.getAndSend(j, j2 => j2.markers);
252
+ return j;
253
+ }
254
+ async visitAnnotatedType(annotatedType, q) {
255
+ await q.getAndSendList(annotatedType, a => a.annotations, annot => annot.id, annot => this.visit(annot, q));
256
+ await q.getAndSend(annotatedType, a => a.typeExpression, type => this.visit(type, q));
257
+ return annotatedType;
258
+ }
259
+ async visitAnnotation(annotation, q) {
260
+ await q.getAndSend(annotation, a => a.annotationType, type => this.visit(type, q));
261
+ await q.getAndSend(annotation, a => a.arguments, args => this.visitContainer(args, q));
262
+ return annotation;
263
+ }
264
+ async visitArrayAccess(arrayAccess, q) {
265
+ await q.getAndSend(arrayAccess, a => a.indexed, indexed => this.visit(indexed, q));
266
+ await q.getAndSend(arrayAccess, a => a.dimension, dim => this.visit(dim, q));
267
+ return arrayAccess;
268
+ }
269
+ async visitArrayDimension(dimension, q) {
270
+ await q.getAndSend(dimension, d => d.index, idx => this.visitRightPadded(idx, q));
271
+ return dimension;
272
+ }
273
+ async visitArrayType(arrayType, q) {
274
+ await q.getAndSend(arrayType, a => a.elementType, type => this.visit(type, q));
275
+ await q.getAndSendList(arrayType, a => a.annotations || [], annot => annot.id, annot => this.visit(annot, q));
276
+ await q.getAndSend(arrayType, a => a.dimension, d => this.visitLeftPadded(d, q));
277
+ await q.getAndSend(arrayType, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
278
+ return arrayType;
279
+ }
280
+ async visitAssert(assert, q) {
281
+ await q.getAndSend(assert, a => a.condition, cond => this.visit(cond, q));
282
+ await q.getAndSend(assert, a => a.detail, detail => this.visitLeftPadded(detail, q));
283
+ return assert;
284
+ }
285
+ async visitAssignment(assignment, q) {
286
+ await q.getAndSend(assignment, a => a.variable, variable => this.visit(variable, q));
287
+ await q.getAndSend(assignment, a => a.assignment, assign => this.visitLeftPadded(assign, q));
288
+ await q.getAndSend(assignment, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
289
+ return assignment;
290
+ }
291
+ async visitAssignmentOperation(assignOp, q) {
292
+ await q.getAndSend(assignOp, a => a.variable, variable => this.visit(variable, q));
293
+ await q.getAndSend(assignOp, a => a.operator, op => this.visitLeftPadded(op, q));
294
+ await q.getAndSend(assignOp, a => a.assignment, assign => this.visit(assign, q));
295
+ await q.getAndSend(assignOp, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
296
+ return assignOp;
297
+ }
298
+ async visitBinary(binary, q) {
299
+ await q.getAndSend(binary, b => b.left, left => this.visit(left, q));
300
+ await q.getAndSend(binary, b => b.operator, op => this.visitLeftPadded(op, q));
301
+ await q.getAndSend(binary, b => b.right, right => this.visit(right, q));
302
+ await q.getAndSend(binary, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
303
+ return binary;
304
+ }
305
+ async visitBreak(breakStmt, q) {
306
+ await q.getAndSend(breakStmt, b => b.label, label => this.visit(label, q));
307
+ return breakStmt;
308
+ }
309
+ async visitCase(caseStmt, q) {
310
+ await q.getAndSend(caseStmt, c => c.type);
311
+ await q.getAndSend(caseStmt, c => c.caseLabels, labels => this.visitContainer(labels, q));
312
+ await q.getAndSend(caseStmt, c => c.statements, stmts => this.visitContainer(stmts, q));
313
+ await q.getAndSend(caseStmt, c => c.body, body => this.visitRightPadded(body, q));
314
+ await q.getAndSend(caseStmt, c => c.guard, guard => this.visit(guard, q));
315
+ return caseStmt;
316
+ }
317
+ async visitContinue(continueStmt, q) {
318
+ await q.getAndSend(continueStmt, c => c.label, label => this.visit(label, q));
319
+ return continueStmt;
320
+ }
321
+ async visitControlParentheses(controlParens, q) {
322
+ await q.getAndSend(controlParens, c => c.tree, tree => this.visitRightPadded(tree, q));
323
+ return controlParens;
324
+ }
325
+ async visitDeconstructionPattern(pattern, q) {
326
+ await q.getAndSend(pattern, p => p.deconstructor, deconstructor => this.visit(deconstructor, q));
327
+ await q.getAndSend(pattern, p => p.nested, nested => this.visitContainer(nested, q));
328
+ await q.getAndSend(pattern, p => (0, rpc_1.asRef)(p.type), type => this.visitType(type, q));
329
+ return pattern;
330
+ }
331
+ async visitDoWhileLoop(doWhile, q) {
332
+ await q.getAndSend(doWhile, d => d.body, body => this.visitRightPadded(body, q));
333
+ await q.getAndSend(doWhile, d => d.whileCondition, cond => this.visitLeftPadded(cond, q));
334
+ return doWhile;
335
+ }
336
+ async visitEmpty(empty, _q) {
337
+ // No additional properties to send
338
+ return empty;
339
+ }
340
+ async visitEnumValueSet(enumValueSet, q) {
341
+ await q.getAndSendList(enumValueSet, e => e.enums, enumValue => enumValue.element.id, enumValue => this.visitRightPadded(enumValue, q));
342
+ await q.getAndSend(enumValueSet, e => e.terminatedWithSemicolon);
343
+ return enumValueSet;
344
+ }
345
+ async visitEnumValue(enumValue, q) {
346
+ await q.getAndSendList(enumValue, e => e.annotations, annot => annot.id, annot => this.visit(annot, q));
347
+ await q.getAndSend(enumValue, e => e.name, name => this.visit(name, q));
348
+ await q.getAndSend(enumValue, e => e.initializer, init => this.visit(init, q));
349
+ return enumValue;
350
+ }
351
+ async visitErroneous(erroneous, q) {
352
+ await q.getAndSend(erroneous, e => e.text);
353
+ return erroneous;
354
+ }
355
+ async visitFieldAccess(fieldAccess, q) {
356
+ await q.getAndSend(fieldAccess, f => f.target, target => this.visit(target, q));
357
+ await q.getAndSend(fieldAccess, f => f.name, name => this.visitLeftPadded(name, q));
358
+ await q.getAndSend(fieldAccess, a => (0, rpc_1.asRef)(a.type), type => this.visitType(type, q));
359
+ return fieldAccess;
360
+ }
361
+ async visitForEachLoop(forEach, q) {
362
+ await q.getAndSend(forEach, f => f.control, control => this.visit(control, q));
363
+ await q.getAndSend(forEach, f => f.body, body => this.visitRightPadded(body, q));
364
+ return forEach;
365
+ }
366
+ async visitForEachLoopControl(control, q) {
367
+ await q.getAndSend(control, c => c.variable, variable => this.visitRightPadded(variable, q));
368
+ await q.getAndSend(control, c => c.iterable, iterable => this.visitRightPadded(iterable, q));
369
+ return control;
370
+ }
371
+ async visitForLoop(forLoop, q) {
372
+ await q.getAndSend(forLoop, f => f.control, control => this.visit(control, q));
373
+ await q.getAndSend(forLoop, f => f.body, body => this.visitRightPadded(body, q));
374
+ return forLoop;
375
+ }
376
+ async visitForLoopControl(control, q) {
377
+ await q.getAndSendList(control, c => c.init, i => i.element.id, i => this.visitRightPadded(i, q));
378
+ await q.getAndSend(control, c => c.condition, c => this.visitRightPadded(c, q));
379
+ await q.getAndSendList(control, c => c.update, u => u.element.id, u => this.visitRightPadded(u, q));
380
+ return control;
381
+ }
382
+ async visitIf(ifStmt, q) {
383
+ await q.getAndSend(ifStmt, i => i.ifCondition, cond => this.visit(cond, q));
384
+ await q.getAndSend(ifStmt, i => i.thenPart, then => this.visitRightPadded(then, q));
385
+ await q.getAndSend(ifStmt, i => i.elsePart, elsePart => this.visit(elsePart, q));
386
+ return ifStmt;
387
+ }
388
+ async visitElse(ifElse, q) {
389
+ await q.getAndSend(ifElse, e => e.body, body => this.visitRightPadded(body, q));
390
+ return ifElse;
391
+ }
392
+ async visitImport(importStmt, q) {
393
+ await q.getAndSend(importStmt, i => i.static, static_ => this.visitLeftPadded(static_, q));
394
+ await q.getAndSend(importStmt, i => i.qualid, qualid => this.visit(qualid, q));
395
+ await q.getAndSend(importStmt, i => i.alias, alias => this.visitLeftPadded(alias, q));
396
+ return importStmt;
397
+ }
398
+ async visitInstanceOf(instanceOf, q) {
399
+ await q.getAndSend(instanceOf, i => i.expression, expr => this.visitRightPadded(expr, q));
400
+ await q.getAndSend(instanceOf, i => i.class, clazz => this.visit(clazz, q));
401
+ await q.getAndSend(instanceOf, i => i.pattern, pattern => this.visit(pattern, q));
402
+ await q.getAndSend(instanceOf, i => (0, rpc_1.asRef)(i.type), type => this.visitType(type, q));
403
+ await q.getAndSend(instanceOf, i => i.modifier, modifier => this.visit(modifier, q));
404
+ return instanceOf;
405
+ }
406
+ async visitIntersectionType(intersectionType, q) {
407
+ await q.getAndSend(intersectionType, i => i.bounds, bounds => this.visitContainer(bounds, q));
408
+ return intersectionType;
409
+ }
410
+ async visitLabel(label, q) {
411
+ await q.getAndSend(label, l => l.label, id => this.visitRightPadded(id, q));
412
+ await q.getAndSend(label, l => l.statement, stmt => this.visit(stmt, q));
413
+ return label;
414
+ }
415
+ async visitLambda(lambda, q) {
416
+ await q.getAndSend(lambda, l => l.parameters, params => this.visit(params, q));
417
+ await q.getAndSend(lambda, l => l.arrow, arrow => this.visitSpace(arrow, q));
418
+ await q.getAndSend(lambda, l => l.body, body => this.visit(body, q));
419
+ await q.getAndSend(lambda, l => (0, rpc_1.asRef)(l.type), type => this.visitType(type, q));
420
+ return lambda;
421
+ }
422
+ async visitLambdaParameters(params, q) {
423
+ await q.getAndSend(params, p => p.parenthesized);
424
+ await q.getAndSendList(params, p => p.parameters, param => param.element.id, param => this.visitRightPadded(param, q));
425
+ return params;
426
+ }
427
+ async visitLiteral(literal, q) {
428
+ await q.getAndSend(literal, l => l.value);
429
+ await q.getAndSend(literal, l => l.valueSource);
430
+ await q.getAndSendList(literal, l => l.unicodeEscapes, e => e.valueSourceIndex + e.codePoint);
431
+ await q.getAndSend(literal, l => (0, rpc_1.asRef)(l.type), type => this.visitType(type, q));
432
+ return literal;
433
+ }
434
+ async visitMemberReference(memberRef, q) {
435
+ await q.getAndSend(memberRef, m => m.containing, cont => this.visitRightPadded(cont, q));
436
+ await q.getAndSend(memberRef, m => m.typeParameters, params => this.visitContainer(params, q));
437
+ await q.getAndSend(memberRef, m => m.reference, ref => this.visitLeftPadded(ref, q));
438
+ await q.getAndSend(memberRef, m => (0, rpc_1.asRef)(m.type), type => this.visitType(type, q));
439
+ await q.getAndSend(memberRef, m => (0, rpc_1.asRef)(m.methodType), type => this.visitType(type, q));
440
+ await q.getAndSend(memberRef, m => (0, rpc_1.asRef)(m.variableType), type => this.visitType(type, q));
441
+ return memberRef;
442
+ }
443
+ async visitMethodInvocation(invocation, q) {
444
+ await q.getAndSend(invocation, m => m.select, select => this.visitRightPadded(select, q));
445
+ await q.getAndSend(invocation, m => m.typeParameters, params => this.visitContainer(params, q));
446
+ await q.getAndSend(invocation, m => m.name, name => this.visit(name, q));
447
+ await q.getAndSend(invocation, m => m.arguments, args => this.visitContainer(args, q));
448
+ await q.getAndSend(invocation, m => (0, rpc_1.asRef)(m.methodType), type => this.visitType(type, q));
449
+ return invocation;
450
+ }
451
+ async visitModifier(modifier, q) {
452
+ await q.getAndSend(modifier, m => m.keyword);
453
+ await q.getAndSend(modifier, m => m.type);
454
+ await q.getAndSendList(modifier, m => m.annotations, annot => annot.id, annot => this.visit(annot, q));
455
+ return modifier;
456
+ }
457
+ async visitMultiCatch(multiCatch, q) {
458
+ await q.getAndSendList(multiCatch, m => m.alternatives, alt => alt.element.id, alt => this.visitRightPadded(alt, q));
459
+ return multiCatch;
460
+ }
461
+ async visitNewArray(newArray, q) {
462
+ await q.getAndSend(newArray, n => n.typeExpression, type => this.visit(type, q));
463
+ await q.getAndSendList(newArray, n => n.dimensions, dim => dim.id, dim => this.visit(dim, q));
464
+ await q.getAndSend(newArray, n => n.initializer, init => this.visitContainer(init, q));
465
+ await q.getAndSend(newArray, n => (0, rpc_1.asRef)(n.type), type => this.visitType(type, q));
466
+ return newArray;
467
+ }
468
+ async visitNewClass(newClass, q) {
469
+ await q.getAndSend(newClass, n => n.enclosing, encl => this.visitRightPadded(encl, q));
470
+ await q.getAndSend(newClass, n => n.new, n => this.visitSpace(n, q));
471
+ await q.getAndSend(newClass, n => n.class, clazz => this.visit(clazz, q));
472
+ await q.getAndSend(newClass, n => n.arguments, args => this.visitContainer(args, q));
473
+ await q.getAndSend(newClass, n => n.body, body => this.visit(body, q));
474
+ await q.getAndSend(newClass, n => (0, rpc_1.asRef)(n.constructorType), type => this.visitType(type, q));
475
+ return newClass;
476
+ }
477
+ async visitNullableType(nullableType, q) {
478
+ await q.getAndSendList(nullableType, a => a.annotations, annot => annot.id, annot => this.visit(annot, q));
479
+ await q.getAndSend(nullableType, n => n.typeTree, type => this.visitRightPadded(type, q));
480
+ return nullableType;
481
+ }
482
+ async visitParameterizedType(paramType, q) {
483
+ await q.getAndSend(paramType, p => p.class, clazz => this.visit(clazz, q));
484
+ await q.getAndSend(paramType, p => p.typeParameters, params => this.visitContainer(params, q));
485
+ await q.getAndSend(paramType, p => (0, rpc_1.asRef)(p.type), type => this.visitType(type, q));
486
+ return paramType;
487
+ }
488
+ async visitParentheses(parentheses, q) {
489
+ await q.getAndSend(parentheses, p => p.tree, tree => this.visitRightPadded(tree, q));
490
+ return parentheses;
491
+ }
492
+ async visitParenthesizedTypeTree(parenthesizedType, q) {
493
+ await q.getAndSendList(parenthesizedType, a => a.annotations, annot => annot.id, annot => this.visit(annot, q));
494
+ await q.getAndSend(parenthesizedType, p => p.parenthesizedType, tree => this.visit(tree, q));
495
+ return parenthesizedType;
496
+ }
497
+ async visitPrimitive(primitive, q) {
498
+ await q.getAndSend(primitive, p => (0, rpc_1.asRef)(p.type), type => this.visitType(type, q));
499
+ return primitive;
500
+ }
501
+ async visitReturn(returnStmt, q) {
502
+ await q.getAndSend(returnStmt, r => r.expression, expr => this.visit(expr, q));
503
+ return returnStmt;
504
+ }
505
+ async visitSwitch(aSwitch, q) {
506
+ await q.getAndSend(aSwitch, s => s.selector, sel => this.visit(sel, q));
507
+ await q.getAndSend(aSwitch, s => s.cases, block => this.visit(block, q));
508
+ return aSwitch;
509
+ }
510
+ async visitSwitchExpression(switchExpr, q) {
511
+ await q.getAndSend(switchExpr, s => s.selector, sel => this.visit(sel, q));
512
+ await q.getAndSend(switchExpr, s => s.cases, block => this.visit(block, q));
513
+ await q.getAndSend(switchExpr, s => (0, rpc_1.asRef)(s.type), type => this.visitType(type, q));
514
+ return switchExpr;
515
+ }
516
+ async visitSynchronized(syncStmt, q) {
517
+ await q.getAndSend(syncStmt, s => s.lock, lock => this.visit(lock, q));
518
+ await q.getAndSend(syncStmt, s => s.body, body => this.visit(body, q));
519
+ return syncStmt;
520
+ }
521
+ async visitTernary(ternary, q) {
522
+ await q.getAndSend(ternary, t => t.condition, cond => this.visit(cond, q));
523
+ await q.getAndSend(ternary, t => t.truePart, truePart => this.visitLeftPadded(truePart, q));
524
+ await q.getAndSend(ternary, t => t.falsePart, falsePart => this.visitLeftPadded(falsePart, q));
525
+ await q.getAndSend(ternary, t => (0, rpc_1.asRef)(t.type), type => this.visitType(type, q));
526
+ return ternary;
527
+ }
528
+ async visitThrow(throwStmt, q) {
529
+ await q.getAndSend(throwStmt, t => t.exception, exc => this.visit(exc, q));
530
+ return throwStmt;
531
+ }
532
+ async visitTry(tryStmt, q) {
533
+ await q.getAndSend(tryStmt, t => t.resources, res => this.visitContainer(res, q));
534
+ await q.getAndSend(tryStmt, t => t.body, body => this.visit(body, q));
535
+ await q.getAndSendList(tryStmt, t => t.catches, catch_ => catch_.id, catch_ => this.visit(catch_, q));
536
+ await q.getAndSend(tryStmt, t => t.finally, fin => this.visitLeftPadded(fin, q));
537
+ return tryStmt;
538
+ }
539
+ async visitTryResource(resource, q) {
540
+ await q.getAndSend(resource, r => r.variableDeclarations, variable => this.visit(variable, q));
541
+ await q.getAndSend(resource, r => r.terminatedWithSemicolon);
542
+ return resource;
543
+ }
544
+ async visitTryCatch(aCatch, q) {
545
+ await q.getAndSend(aCatch, c => c.parameter, param => this.visit(param, q));
546
+ await q.getAndSend(aCatch, c => c.body, body => this.visit(body, q));
547
+ return aCatch;
548
+ }
549
+ async visitTypeCast(typeCast, q) {
550
+ await q.getAndSend(typeCast, t => t.class, clazz => this.visit(clazz, q));
551
+ await q.getAndSend(typeCast, t => t.expression, expr => this.visit(expr, q));
552
+ return typeCast;
553
+ }
554
+ async visitTypeParameter(typeParam, q) {
555
+ await q.getAndSendList(typeParam, t => t.annotations, annot => annot.id, annot => this.visit(annot, q));
556
+ await q.getAndSendList(typeParam, t => t.modifiers, mod => mod.id, mod => this.visit(mod, q));
557
+ await q.getAndSend(typeParam, t => t.name, name => this.visit(name, q));
558
+ await q.getAndSend(typeParam, t => t.bounds, bounds => this.visitContainer(bounds, q));
559
+ return typeParam;
560
+ }
561
+ async visitTypeParameters(typeParams, q) {
562
+ await q.getAndSendList(typeParams, a => a.annotations, annot => annot.id, annot => this.visit(annot, q));
563
+ await q.getAndSendList(typeParams, t => t.typeParameters, p => p.element.id, params => this.visitRightPadded(params, q));
564
+ return typeParams;
565
+ }
566
+ async visitUnary(unary, q) {
567
+ await q.getAndSend(unary, u => u.operator, op => this.visitLeftPadded(op, q));
568
+ await q.getAndSend(unary, u => u.expression, expr => this.visit(expr, q));
569
+ await q.getAndSend(unary, u => (0, rpc_1.asRef)(u.type), type => this.visitType(type, q));
570
+ return unary;
571
+ }
572
+ async visitVariable(variable, q) {
573
+ await q.getAndSend(variable, v => v.name, name => this.visit(name, q));
574
+ await q.getAndSendList(variable, v => v.dimensionsAfterName, d => JSON.stringify(d.element), dims => this.visitLeftPadded(dims, q));
575
+ await q.getAndSend(variable, v => v.initializer, init => this.visitLeftPadded(init, q));
576
+ await q.getAndSend(variable, v => (0, rpc_1.asRef)(v.variableType), type => this.visitType(type, q));
577
+ return variable;
578
+ }
579
+ async visitWhileLoop(whileLoop, q) {
580
+ await q.getAndSend(whileLoop, w => w.condition, cond => this.visit(cond, q));
581
+ await q.getAndSend(whileLoop, w => w.body, body => this.visitRightPadded(body, q));
582
+ return whileLoop;
583
+ }
584
+ async visitWildcard(wildcard, q) {
585
+ await q.getAndSend(wildcard, w => w.bound, b => this.visitLeftPadded(b, q));
586
+ await q.getAndSend(wildcard, w => w.boundedType, type => this.visit(type, q));
587
+ return wildcard;
588
+ }
589
+ async visitYield(yieldExpr, q) {
590
+ await q.getAndSend(yieldExpr, y => y.implicit);
591
+ await q.getAndSend(yieldExpr, y => y.value, value => this.visit(value, q));
592
+ return yieldExpr;
593
+ }
594
+ async visitUnknown(unknown, q) {
595
+ await q.getAndSend(unknown, u => u.source, source => this.visit(source, q));
596
+ return unknown;
597
+ }
598
+ async visitUnknownSource(source, q) {
599
+ await q.getAndSend(source, s => s.text);
600
+ return source;
601
+ }
602
+ async visitCompilationUnit(cu, q) {
603
+ await q.getAndSend(cu, c => c.sourcePath);
604
+ await q.getAndSend(cu, c => c.charsetName);
605
+ await q.getAndSend(cu, c => c.charsetBomMarked);
606
+ await q.getAndSend(cu, c => c.checksum);
607
+ await q.getAndSend(cu, c => c.fileAttributes);
608
+ await q.getAndSend(cu, c => c.packageDeclaration, pkg => this.visitRightPadded(pkg, q));
609
+ await q.getAndSendList(cu, c => c.imports, imp => imp.element.id, imp => this.visitRightPadded(imp, q));
610
+ await q.getAndSendList(cu, c => c.classes, cls => cls.id, cls => this.visit(cls, q));
611
+ await q.getAndSend(cu, c => c.eof, space => this.visitSpace(space, q));
612
+ return cu;
613
+ }
614
+ async visitPackage(pkg, q) {
615
+ await q.getAndSend(pkg, p => p.expression, expr => this.visit(expr, q));
616
+ await q.getAndSendList(pkg, p => p.annotations, annot => annot.id, annot => this.visit(annot, q));
617
+ return pkg;
618
+ }
619
+ async visitClassDeclaration(cls, q) {
620
+ await q.getAndSendList(cls, c => c.leadingAnnotations, annot => annot.id, annot => this.visit(annot, q));
621
+ await q.getAndSendList(cls, c => c.modifiers, mod => mod.id, mod => this.visit(mod, q));
622
+ await q.getAndSend(cls, c => c.classKind, kind => this.visit(kind, q));
623
+ await q.getAndSend(cls, c => c.name, name => this.visit(name, q));
624
+ await q.getAndSend(cls, c => c.typeParameters, params => this.visitContainer(params, q));
625
+ await q.getAndSend(cls, c => c.primaryConstructor, cons => this.visitContainer(cons, q));
626
+ await q.getAndSend(cls, c => c.extends, ext => this.visitLeftPadded(ext, q));
627
+ await q.getAndSend(cls, c => c.implements, impl => this.visitContainer(impl, q));
628
+ await q.getAndSend(cls, c => c.permitting, perm => this.visitContainer(perm, q));
629
+ await q.getAndSend(cls, c => c.body, body => this.visit(body, q));
630
+ return cls;
631
+ }
632
+ async visitClassDeclarationKind(kind, q) {
633
+ await q.getAndSendList(kind, k => k.annotations, annot => annot.id, annot => this.visit(annot, q));
634
+ await q.getAndSend(kind, k => k.type);
635
+ return kind;
636
+ }
637
+ async visitBlock(block, q) {
638
+ await q.getAndSend(block, b => b.static, s => this.visitRightPadded(s, q));
639
+ await q.getAndSendList(block, b => b.statements, stmt => stmt.element.id, stmt => this.visitRightPadded(stmt, q));
640
+ await q.getAndSend(block, b => b.end, space => this.visitSpace(space, q));
641
+ return block;
642
+ }
643
+ async visitMethodDeclaration(method, q) {
644
+ await q.getAndSendList(method, m => m.leadingAnnotations, annot => annot.id, annot => this.visit(annot, q));
645
+ await q.getAndSendList(method, m => m.modifiers, mod => mod.id, mod => this.visit(mod, q));
646
+ await q.getAndSend(method, m => m.typeParameters, params => this.visit(params, q));
647
+ await q.getAndSend(method, m => m.returnTypeExpression, type => this.visit(type, q));
648
+ await q.getAndSendList(method, m => m.nameAnnotations, a => a.id, name => this.visit(name, q));
649
+ await q.getAndSend(method, m => m.name, name => this.visit(name, q));
650
+ await q.getAndSend(method, m => m.parameters, params => this.visitContainer(params, q));
651
+ await q.getAndSend(method, m => m.throws, throws => this.visitContainer(throws, q));
652
+ await q.getAndSend(method, m => m.body, body => this.visit(body, q));
653
+ await q.getAndSend(method, m => m.defaultValue, def => this.visitLeftPadded(def, q));
654
+ await q.getAndSend(method, m => (0, rpc_1.asRef)(m.methodType), type => this.visitType(type, q));
655
+ return method;
656
+ }
657
+ async visitVariableDeclarations(varDecls, q) {
658
+ await q.getAndSendList(varDecls, v => v.leadingAnnotations, annot => annot.id, annot => this.visit(annot, q));
659
+ await q.getAndSendList(varDecls, v => v.modifiers, mod => mod.id, mod => this.visit(mod, q));
660
+ await q.getAndSend(varDecls, v => v.typeExpression, type => this.visit(type, q));
661
+ await q.getAndSend(varDecls, v => v.varargs, space => this.visitSpace(space, q));
662
+ await q.getAndSendList(varDecls, v => v.variables, variable => variable.element.id, variable => this.visitRightPadded(variable, q));
663
+ return varDecls;
664
+ }
665
+ async visitIdentifier(ident, q) {
666
+ await q.getAndSendList(ident, id => id.annotations, annot => annot.id, annot => this.visit(annot, q));
667
+ await q.getAndSend(ident, id => id.simpleName);
668
+ await q.getAndSend(ident, id => (0, rpc_1.asRef)(id.type), type => this.visitType(type, q));
669
+ await q.getAndSend(ident, id => (0, rpc_1.asRef)(id.fieldType), type => this.visitType(type, q));
670
+ return ident;
671
+ }
672
+ async visitSpace(space, q) {
673
+ await q.getAndSendList(space, s => s.comments, c => {
674
+ if (c.kind === tree_1.J.Kind.TextComment) {
675
+ return c.text + c.suffix;
903
676
  }
904
- yield q.getAndSend(left, l => l.markers);
905
- return left;
906
- });
907
- }
908
- visitRightPadded(right, q) {
909
- return __awaiter(this, void 0, void 0, function* () {
910
- if ((0, tree_2.isTree)(right.element)) {
911
- yield q.getAndSend(right, r => r.element, elem => this.visit(elem, q));
677
+ throw new Error(`Unexpected comment type ${c.kind}`);
678
+ }, async (c) => {
679
+ if (c.kind === tree_1.J.Kind.TextComment) {
680
+ const tc = c;
681
+ await q.getAndSend(tc, c2 => c2.multiline);
682
+ await q.getAndSend(tc, c2 => c2.text);
912
683
  }
913
684
  else {
914
- yield q.getAndSend(right, r => r.element);
685
+ throw new Error(`Unexpected comment type ${c.kind}`);
915
686
  }
916
- yield q.getAndSend(right, r => r.after, space => this.visitSpace(space, q));
917
- yield q.getAndSend(right, r => r.markers);
918
- return right;
687
+ await q.getAndSend(c, c2 => c2.suffix);
688
+ await q.getAndSend(c, c2 => c2.markers);
919
689
  });
690
+ await q.getAndSend(space, s => s.whitespace);
691
+ return space;
920
692
  }
921
- visitContainer(container, q) {
922
- return __awaiter(this, void 0, void 0, function* () {
923
- yield q.getAndSend(container, c => c.before, space => this.visitSpace(space, q));
924
- yield q.getAndSendList(container, c => c.elements, elem => elem.element.id, elem => this.visitRightPadded(elem, q));
925
- yield q.getAndSend(container, c => c.markers);
926
- return container;
927
- });
693
+ async visitLeftPadded(left, q) {
694
+ await q.getAndSend(left, l => l.before, space => this.visitSpace(space, q));
695
+ if ((0, tree_2.isTree)(left.element)) {
696
+ await q.getAndSend(left, l => l.element, elem => this.visit(elem, q));
697
+ }
698
+ else if ((0, tree_1.isSpace)(left.element)) {
699
+ await q.getAndSend(left, l => l.element, space => this.visitSpace(space, q));
700
+ }
701
+ else {
702
+ await q.getAndSend(left, l => l.element);
703
+ }
704
+ await q.getAndSend(left, l => l.markers);
705
+ return left;
928
706
  }
929
- visitType(javaType, q) {
930
- return __awaiter(this, void 0, void 0, function* () {
931
- if (!javaType) {
932
- return undefined;
933
- }
934
- return yield this.typeVisitor.visit(javaType, q);
935
- });
707
+ async visitRightPadded(right, q) {
708
+ if ((0, tree_2.isTree)(right.element)) {
709
+ await q.getAndSend(right, r => r.element, elem => this.visit(elem, q));
710
+ }
711
+ else {
712
+ await q.getAndSend(right, r => r.element);
713
+ }
714
+ await q.getAndSend(right, r => r.after, space => this.visitSpace(space, q));
715
+ await q.getAndSend(right, r => r.markers);
716
+ return right;
717
+ }
718
+ async visitContainer(container, q) {
719
+ await q.getAndSend(container, c => c.before, space => this.visitSpace(space, q));
720
+ await q.getAndSendList(container, c => c.elements, elem => elem.element.id, elem => this.visitRightPadded(elem, q));
721
+ await q.getAndSend(container, c => c.markers);
722
+ return container;
723
+ }
724
+ async visitType(javaType, q) {
725
+ if (!javaType) {
726
+ return undefined;
727
+ }
728
+ return await this.typeVisitor.visit(javaType, q);
936
729
  }
937
730
  }
938
731
  exports.JavaSender = JavaSender;
@@ -941,808 +734,654 @@ class JavaReceiver extends visitor_1.JavaVisitor {
941
734
  super(...arguments);
942
735
  this.typeVisitor = new TypeReceiver();
943
736
  }
944
- preVisit(j, q) {
945
- return __awaiter(this, void 0, void 0, function* () {
946
- try {
947
- const updates = {
948
- id: yield q.receive(j.id),
949
- prefix: yield q.receive(j.prefix, space => this.visitSpace(space, q)),
950
- markers: yield q.receive(j.markers)
951
- };
952
- return (0, util_1.updateIfChanged)(j, updates);
953
- }
954
- catch (e) {
955
- throw e;
956
- }
957
- });
958
- }
959
- visitAnnotatedType(annotatedType, q) {
960
- return __awaiter(this, void 0, void 0, function* () {
961
- const updates = {
962
- annotations: yield q.receiveListDefined(annotatedType.annotations, annot => this.visit(annot, q)),
963
- typeExpression: yield q.receive(annotatedType.typeExpression, type => this.visit(type, q))
964
- };
965
- return (0, util_1.updateIfChanged)(annotatedType, updates);
966
- });
967
- }
968
- visitAnnotation(annotation, q) {
969
- return __awaiter(this, void 0, void 0, function* () {
970
- const updates = {
971
- annotationType: yield q.receive(annotation.annotationType, type => this.visit(type, q)),
972
- arguments: yield q.receive(annotation.arguments, args => this.visitContainer(args, q))
973
- };
974
- return (0, util_1.updateIfChanged)(annotation, updates);
975
- });
976
- }
977
- visitArrayAccess(arrayAccess, q) {
978
- return __awaiter(this, void 0, void 0, function* () {
979
- const updates = {
980
- indexed: yield q.receive(arrayAccess.indexed, indexed => this.visit(indexed, q)),
981
- dimension: yield q.receive(arrayAccess.dimension, dim => this.visit(dim, q))
982
- };
983
- return (0, util_1.updateIfChanged)(arrayAccess, updates);
984
- });
985
- }
986
- visitArrayDimension(dimension, q) {
987
- return __awaiter(this, void 0, void 0, function* () {
988
- const updates = {
989
- index: yield q.receive(dimension.index, idx => this.visitRightPadded(idx, q))
990
- };
991
- return (0, util_1.updateIfChanged)(dimension, updates);
992
- });
993
- }
994
- visitArrayType(arrayType, q) {
995
- return __awaiter(this, void 0, void 0, function* () {
996
- const updates = {
997
- elementType: yield q.receive(arrayType.elementType, type => this.visit(type, q)),
998
- annotations: yield q.receiveListDefined(arrayType.annotations || [], annot => this.visit(annot, q)),
999
- dimension: yield q.receive(arrayType.dimension, d => this.visitLeftPadded(d, q)),
1000
- type: yield q.receive(arrayType.type, type => this.visitType(type, q))
1001
- };
1002
- return (0, util_1.updateIfChanged)(arrayType, updates);
1003
- });
1004
- }
1005
- visitAssert(assert, q) {
1006
- return __awaiter(this, void 0, void 0, function* () {
1007
- const updates = {
1008
- condition: yield q.receive(assert.condition, cond => this.visit(cond, q)),
1009
- detail: yield q.receive(assert.detail, detail => this.visitOptionalLeftPadded(detail, q))
1010
- };
1011
- return (0, util_1.updateIfChanged)(assert, updates);
1012
- });
1013
- }
1014
- visitAssignment(assignment, q) {
1015
- return __awaiter(this, void 0, void 0, function* () {
1016
- const updates = {
1017
- variable: yield q.receive(assignment.variable, variable => this.visit(variable, q)),
1018
- assignment: yield q.receive(assignment.assignment, assign => this.visitLeftPadded(assign, q)),
1019
- type: yield q.receive(assignment.type, type => this.visitType(type, q))
1020
- };
1021
- return (0, util_1.updateIfChanged)(assignment, updates);
1022
- });
1023
- }
1024
- visitAssignmentOperation(assignOp, q) {
1025
- return __awaiter(this, void 0, void 0, function* () {
1026
- const updates = {
1027
- variable: yield q.receive(assignOp.variable, variable => this.visit(variable, q)),
1028
- operator: yield q.receive(assignOp.operator, op => this.visitLeftPadded(op, q)),
1029
- assignment: yield q.receive(assignOp.assignment, assign => this.visit(assign, q)),
1030
- type: yield q.receive(assignOp.type, type => this.visitType(type, q))
1031
- };
1032
- return (0, util_1.updateIfChanged)(assignOp, updates);
1033
- });
1034
- }
1035
- visitBinary(binary, q) {
1036
- return __awaiter(this, void 0, void 0, function* () {
737
+ async preVisit(j, q) {
738
+ try {
1037
739
  const updates = {
1038
- left: yield q.receive(binary.left, left => this.visit(left, q)),
1039
- operator: yield q.receive(binary.operator, op => this.visitLeftPadded(op, q)),
1040
- right: yield q.receive(binary.right, right => this.visit(right, q)),
1041
- type: yield q.receive(binary.type, type => this.visitType(type, q))
740
+ id: await q.receive(j.id),
741
+ prefix: await q.receive(j.prefix, space => this.visitSpace(space, q)),
742
+ markers: await q.receive(j.markers)
1042
743
  };
1043
- return (0, util_1.updateIfChanged)(binary, updates);
1044
- });
744
+ return (0, util_1.updateIfChanged)(j, updates);
745
+ }
746
+ catch (e) {
747
+ throw e;
748
+ }
1045
749
  }
1046
- visitBreak(breakStmt, q) {
1047
- return __awaiter(this, void 0, void 0, function* () {
1048
- const updates = {
1049
- label: yield q.receive(breakStmt.label, label => this.visit(label, q))
1050
- };
1051
- return (0, util_1.updateIfChanged)(breakStmt, updates);
1052
- });
1053
- }
1054
- visitCase(caseStmt, q) {
1055
- return __awaiter(this, void 0, void 0, function* () {
1056
- const updates = {
1057
- type: yield q.receive(caseStmt.type),
1058
- caseLabels: yield q.receive(caseStmt.caseLabels, labels => this.visitContainer(labels, q)),
1059
- statements: yield q.receive(caseStmt.statements, stmts => this.visitContainer(stmts, q)),
1060
- body: yield q.receive(caseStmt.body, body => this.visitRightPadded(body, q)),
1061
- guard: yield q.receive(caseStmt.guard, guard => this.visit(guard, q))
1062
- };
1063
- return (0, util_1.updateIfChanged)(caseStmt, updates);
1064
- });
1065
- }
1066
- visitContinue(continueStmt, q) {
1067
- return __awaiter(this, void 0, void 0, function* () {
1068
- const updates = {
1069
- label: yield q.receive(continueStmt.label, label => this.visit(label, q))
1070
- };
1071
- return (0, util_1.updateIfChanged)(continueStmt, updates);
1072
- });
1073
- }
1074
- visitControlParentheses(controlParens, q) {
1075
- return __awaiter(this, void 0, void 0, function* () {
1076
- const updates = {
1077
- tree: yield q.receive(controlParens.tree, tree => this.visitRightPadded(tree, q))
1078
- };
1079
- return (0, util_1.updateIfChanged)(controlParens, updates);
1080
- });
1081
- }
1082
- visitDeconstructionPattern(pattern, q) {
1083
- return __awaiter(this, void 0, void 0, function* () {
1084
- const updates = {
1085
- deconstructor: yield q.receive(pattern.deconstructor, deconstructor => this.visit(deconstructor, q)),
1086
- nested: yield q.receive(pattern.nested, nested => this.visitContainer(nested, q)),
1087
- type: yield q.receive(pattern.type, type => this.visitType(type, q))
1088
- };
1089
- return (0, util_1.updateIfChanged)(pattern, updates);
1090
- });
1091
- }
1092
- visitDoWhileLoop(doWhile, q) {
1093
- return __awaiter(this, void 0, void 0, function* () {
1094
- const updates = {
1095
- body: yield q.receive(doWhile.body, body => this.visitOptionalRightPadded(body, q)),
1096
- whileCondition: yield q.receive(doWhile.whileCondition, cond => this.visitLeftPadded(cond, q))
1097
- };
1098
- return (0, util_1.updateIfChanged)(doWhile, updates);
1099
- });
1100
- }
1101
- visitEmpty(empty) {
1102
- return __awaiter(this, void 0, void 0, function* () {
1103
- // no additional properties to receive
1104
- return empty;
1105
- });
1106
- }
1107
- visitEnumValueSet(enumValueSet, q) {
1108
- return __awaiter(this, void 0, void 0, function* () {
1109
- const updates = {
1110
- enums: yield q.receiveListDefined(enumValueSet.enums, enumValue => this.visitRightPadded(enumValue, q)),
1111
- terminatedWithSemicolon: yield q.receive(enumValueSet.terminatedWithSemicolon)
1112
- };
1113
- return (0, util_1.updateIfChanged)(enumValueSet, updates);
1114
- });
1115
- }
1116
- visitEnumValue(enumValue, q) {
1117
- return __awaiter(this, void 0, void 0, function* () {
1118
- const updates = {
1119
- annotations: yield q.receiveListDefined(enumValue.annotations, annot => this.visit(annot, q)),
1120
- name: yield q.receive(enumValue.name, name => this.visit(name, q)),
1121
- initializer: yield q.receive(enumValue.initializer, init => this.visit(init, q))
1122
- };
1123
- return (0, util_1.updateIfChanged)(enumValue, updates);
1124
- });
1125
- }
1126
- visitErroneous(erroneous, q) {
1127
- return __awaiter(this, void 0, void 0, function* () {
1128
- const updates = {
1129
- text: yield q.receive(erroneous.text)
1130
- };
1131
- return (0, util_1.updateIfChanged)(erroneous, updates);
1132
- });
1133
- }
1134
- visitFieldAccess(fieldAccess, q) {
1135
- return __awaiter(this, void 0, void 0, function* () {
1136
- const updates = {
1137
- target: yield q.receive(fieldAccess.target, target => this.visit(target, q)),
1138
- name: yield q.receive(fieldAccess.name, name => this.visitLeftPadded(name, q)),
1139
- type: yield q.receive(fieldAccess.type, type => this.visitType(type, q))
1140
- };
1141
- return (0, util_1.updateIfChanged)(fieldAccess, updates);
1142
- });
1143
- }
1144
- visitForEachLoop(forEachLoop, q) {
1145
- return __awaiter(this, void 0, void 0, function* () {
1146
- const updates = {
1147
- control: yield q.receive(forEachLoop.control, c => this.visit(c, q)),
1148
- body: yield q.receive(forEachLoop.body, body => this.visitRightPadded(body, q))
1149
- };
1150
- return (0, util_1.updateIfChanged)(forEachLoop, updates);
1151
- });
1152
- }
1153
- visitForEachLoopControl(control, q) {
1154
- return __awaiter(this, void 0, void 0, function* () {
1155
- const updates = {
1156
- variable: yield q.receive(control.variable, variable => this.visitRightPadded(variable, q)),
1157
- iterable: yield q.receive(control.iterable, expr => this.visitRightPadded(expr, q))
1158
- };
1159
- return (0, util_1.updateIfChanged)(control, updates);
1160
- });
1161
- }
1162
- visitForLoop(forLoop, q) {
1163
- return __awaiter(this, void 0, void 0, function* () {
1164
- const updates = {
1165
- control: yield q.receive(forLoop.control, c => this.visit(c, q)),
1166
- body: yield q.receive(forLoop.body, body => this.visitRightPadded(body, q))
1167
- };
1168
- return (0, util_1.updateIfChanged)(forLoop, updates);
1169
- });
1170
- }
1171
- visitForLoopControl(control, q) {
1172
- return __awaiter(this, void 0, void 0, function* () {
1173
- const updates = {
1174
- init: yield q.receiveListDefined(control.init, init => this.visitRightPadded(init, q)),
1175
- condition: yield q.receive(control.condition, cond => this.visitRightPadded(cond, q)),
1176
- update: yield q.receiveListDefined(control.update, update => this.visitRightPadded(update, q))
1177
- };
1178
- return (0, util_1.updateIfChanged)(control, updates);
1179
- });
1180
- }
1181
- visitIf(ifStmt, q) {
1182
- return __awaiter(this, void 0, void 0, function* () {
1183
- const updates = {
1184
- ifCondition: yield q.receive(ifStmt.ifCondition, cond => this.visit(cond, q)),
1185
- thenPart: yield q.receive(ifStmt.thenPart, thenPart => this.visitRightPadded(thenPart, q)),
1186
- elsePart: yield q.receive(ifStmt.elsePart, elsePart => this.visit(elsePart, q))
1187
- };
1188
- return (0, util_1.updateIfChanged)(ifStmt, updates);
1189
- });
1190
- }
1191
- visitElse(ifElse, q) {
1192
- return __awaiter(this, void 0, void 0, function* () {
1193
- const updates = {
1194
- body: yield q.receive(ifElse.body, body => this.visitRightPadded(body, q))
1195
- };
1196
- return (0, util_1.updateIfChanged)(ifElse, updates);
1197
- });
1198
- }
1199
- visitImport(importStmt, q) {
1200
- return __awaiter(this, void 0, void 0, function* () {
1201
- const updates = {
1202
- static: yield q.receive(importStmt.static, s => this.visitLeftPadded(s, q)),
1203
- qualid: yield q.receive(importStmt.qualid, qualid => this.visit(qualid, q)),
1204
- alias: yield q.receive(importStmt.alias, alias => this.visitLeftPadded(alias, q))
1205
- };
1206
- return (0, util_1.updateIfChanged)(importStmt, updates);
1207
- });
1208
- }
1209
- visitInstanceOf(instanceOf, q) {
1210
- return __awaiter(this, void 0, void 0, function* () {
1211
- const updates = {
1212
- expression: yield q.receive(instanceOf.expression, expr => this.visitRightPadded(expr, q)),
1213
- class: yield q.receive(instanceOf.class, clazz => this.visit(clazz, q)),
1214
- pattern: yield q.receive(instanceOf.pattern, pattern => this.visit(pattern, q)),
1215
- type: yield q.receive(instanceOf.type, type => this.visitType(type, q)),
1216
- modifier: yield q.receive(instanceOf.modifier, mod => this.visit(mod, q))
1217
- };
1218
- return (0, util_1.updateIfChanged)(instanceOf, updates);
1219
- });
1220
- }
1221
- visitIntersectionType(intersectionType, q) {
1222
- return __awaiter(this, void 0, void 0, function* () {
1223
- const updates = {
1224
- bounds: yield q.receive(intersectionType.bounds, bounds => this.visitContainer(bounds, q))
1225
- };
1226
- return (0, util_1.updateIfChanged)(intersectionType, updates);
1227
- });
1228
- }
1229
- visitLabel(label, q) {
1230
- return __awaiter(this, void 0, void 0, function* () {
1231
- const updates = {
1232
- label: yield q.receive(label.label, lbl => this.visitRightPadded(lbl, q)),
1233
- statement: yield q.receive(label.statement, stmt => this.visit(stmt, q))
1234
- };
1235
- return (0, util_1.updateIfChanged)(label, updates);
1236
- });
1237
- }
1238
- visitLambda(lambda, q) {
1239
- return __awaiter(this, void 0, void 0, function* () {
1240
- const updates = {
1241
- parameters: yield q.receive(lambda.parameters, params => this.visit(params, q)),
1242
- arrow: yield q.receive(lambda.arrow, arrow => this.visitSpace(arrow, q)),
1243
- body: yield q.receive(lambda.body, body => this.visit(body, q)),
1244
- type: yield q.receive(lambda.type, type => this.visitType(type, q))
1245
- };
1246
- return (0, util_1.updateIfChanged)(lambda, updates);
1247
- });
1248
- }
1249
- visitLambdaParameters(params, q) {
1250
- return __awaiter(this, void 0, void 0, function* () {
1251
- const updates = {
1252
- parenthesized: yield q.receive(params.parenthesized),
1253
- parameters: yield q.receiveListDefined(params.parameters, param => this.visitRightPadded(param, q))
1254
- };
1255
- return (0, util_1.updateIfChanged)(params, updates);
1256
- });
1257
- }
1258
- visitLiteral(literal, q) {
1259
- return __awaiter(this, void 0, void 0, function* () {
1260
- const updates = {
1261
- value: yield q.receive(literal.value),
1262
- valueSource: yield q.receive(literal.valueSource),
1263
- unicodeEscapes: yield q.receiveList(literal.unicodeEscapes),
1264
- type: yield q.receive(literal.type, type => this.visitType(type, q))
1265
- };
1266
- return (0, util_1.updateIfChanged)(literal, updates);
1267
- });
1268
- }
1269
- visitMemberReference(memberRef, q) {
1270
- return __awaiter(this, void 0, void 0, function* () {
1271
- const updates = {
1272
- containing: yield q.receive(memberRef.containing, container => this.visitRightPadded(container, q)),
1273
- typeParameters: yield q.receive(memberRef.typeParameters, typeParams => this.visitContainer(typeParams, q)),
1274
- reference: yield q.receive(memberRef.reference, ref => this.visitLeftPadded(ref, q)),
1275
- type: yield q.receive(memberRef.type, type => this.visitType(type, q)),
1276
- methodType: yield q.receive(memberRef.methodType, type => this.visitType(type, q)),
1277
- variableType: yield q.receive(memberRef.variableType, type => this.visitType(type, q))
1278
- };
1279
- return (0, util_1.updateIfChanged)(memberRef, updates);
1280
- });
1281
- }
1282
- visitMethodInvocation(methodInvoc, q) {
1283
- return __awaiter(this, void 0, void 0, function* () {
1284
- const updates = {
1285
- select: yield q.receive(methodInvoc.select, select => this.visitRightPadded(select, q)),
1286
- typeParameters: yield q.receive(methodInvoc.typeParameters, typeParams => this.visitContainer(typeParams, q)),
1287
- name: yield q.receive(methodInvoc.name, name => this.visit(name, q)),
1288
- arguments: yield q.receive(methodInvoc.arguments, args => this.visitContainer(args, q)),
1289
- methodType: yield q.receive(methodInvoc.methodType, type => this.visitType(type, q))
1290
- };
1291
- return (0, util_1.updateIfChanged)(methodInvoc, updates);
1292
- });
1293
- }
1294
- visitModifier(modifier, q) {
1295
- return __awaiter(this, void 0, void 0, function* () {
1296
- const updates = {
1297
- keyword: yield q.receive(modifier.keyword),
1298
- type: yield q.receive(modifier.type),
1299
- annotations: yield q.receiveListDefined(modifier.annotations, annot => this.visit(annot, q))
1300
- };
1301
- return (0, util_1.updateIfChanged)(modifier, updates);
1302
- });
1303
- }
1304
- visitMultiCatch(multiCatch, q) {
1305
- return __awaiter(this, void 0, void 0, function* () {
1306
- const updates = {
1307
- alternatives: yield q.receiveListDefined(multiCatch.alternatives, alt => this.visitRightPadded(alt, q))
1308
- };
1309
- return (0, util_1.updateIfChanged)(multiCatch, updates);
1310
- });
1311
- }
1312
- visitNewArray(newArray, q) {
1313
- return __awaiter(this, void 0, void 0, function* () {
1314
- const updates = {
1315
- typeExpression: yield q.receive(newArray.typeExpression, type => this.visit(type, q)),
1316
- dimensions: yield q.receiveListDefined(newArray.dimensions, dim => this.visit(dim, q)),
1317
- initializer: yield q.receive(newArray.initializer, init => this.visitContainer(init, q)),
1318
- type: yield q.receive(newArray.type, type => this.visitType(type, q))
1319
- };
1320
- return (0, util_1.updateIfChanged)(newArray, updates);
1321
- });
1322
- }
1323
- visitNewClass(newClass, q) {
1324
- return __awaiter(this, void 0, void 0, function* () {
1325
- const updates = {
1326
- enclosing: yield q.receive(newClass.enclosing, encl => this.visitRightPadded(encl, q)),
1327
- new: yield q.receive(newClass.new, new_ => this.visitSpace(new_, q)),
1328
- class: yield q.receive(newClass.class, clazz => this.visit(clazz, q)),
1329
- arguments: yield q.receive(newClass.arguments, args => this.visitContainer(args, q)),
1330
- body: yield q.receive(newClass.body, body => this.visit(body, q)),
1331
- constructorType: yield q.receive(newClass.constructorType, type => this.visitType(type, q))
1332
- };
1333
- return (0, util_1.updateIfChanged)(newClass, updates);
1334
- });
1335
- }
1336
- visitNullableType(nullableType, q) {
1337
- return __awaiter(this, void 0, void 0, function* () {
1338
- const updates = {
1339
- annotations: yield q.receiveListDefined(nullableType.annotations, annot => this.visit(annot, q)),
1340
- typeTree: yield q.receive(nullableType.typeTree, type => this.visitRightPadded(type, q))
1341
- };
1342
- return (0, util_1.updateIfChanged)(nullableType, updates);
1343
- });
1344
- }
1345
- visitParameterizedType(paramType, q) {
1346
- return __awaiter(this, void 0, void 0, function* () {
1347
- const updates = {
1348
- class: yield q.receive(paramType.class, clazz => this.visit(clazz, q)),
1349
- typeParameters: yield q.receive(paramType.typeParameters, params => this.visitContainer(params, q)),
1350
- type: yield q.receive(paramType.type, type => this.visitType(type, q))
1351
- };
1352
- return (0, util_1.updateIfChanged)(paramType, updates);
1353
- });
1354
- }
1355
- visitParentheses(parentheses, q) {
1356
- return __awaiter(this, void 0, void 0, function* () {
1357
- const updates = {
1358
- tree: yield q.receive(parentheses.tree, tree => this.visitRightPadded(tree, q))
1359
- };
1360
- return (0, util_1.updateIfChanged)(parentheses, updates);
1361
- });
1362
- }
1363
- visitParenthesizedTypeTree(parenthesizedType, q) {
1364
- return __awaiter(this, void 0, void 0, function* () {
1365
- const updates = {
1366
- annotations: yield q.receiveListDefined(parenthesizedType.annotations, annot => this.visit(annot, q)),
1367
- parenthesizedType: yield q.receive(parenthesizedType.parenthesizedType, tree => this.visit(tree, q))
1368
- };
1369
- return (0, util_1.updateIfChanged)(parenthesizedType, updates);
1370
- });
1371
- }
1372
- visitPrimitive(primitive, q) {
1373
- return __awaiter(this, void 0, void 0, function* () {
1374
- const updates = {
1375
- type: yield q.receive(primitive.type, type => this.visitType(type, q))
1376
- };
1377
- return (0, util_1.updateIfChanged)(primitive, updates);
1378
- });
1379
- }
1380
- visitSwitch(switchStmt, q) {
1381
- return __awaiter(this, void 0, void 0, function* () {
1382
- const updates = {
1383
- selector: yield q.receive(switchStmt.selector, selector => this.visit(selector, q)),
1384
- cases: yield q.receive(switchStmt.cases, cases => this.visit(cases, q))
1385
- };
1386
- return (0, util_1.updateIfChanged)(switchStmt, updates);
1387
- });
1388
- }
1389
- visitSwitchExpression(switchExpr, q) {
1390
- return __awaiter(this, void 0, void 0, function* () {
1391
- const updates = {
1392
- selector: yield q.receive(switchExpr.selector, selector => this.visit(selector, q)),
1393
- cases: yield q.receive(switchExpr.cases, cases => this.visit(cases, q)),
1394
- type: yield q.receive(switchExpr.type, type => this.visitType(type, q))
1395
- };
1396
- return (0, util_1.updateIfChanged)(switchExpr, updates);
1397
- });
1398
- }
1399
- visitTernary(ternary, q) {
1400
- return __awaiter(this, void 0, void 0, function* () {
1401
- const updates = {
1402
- condition: yield q.receive(ternary.condition, cond => this.visit(cond, q)),
1403
- truePart: yield q.receive(ternary.truePart, truePart => this.visitLeftPadded(truePart, q)),
1404
- falsePart: yield q.receive(ternary.falsePart, falsePart => this.visitLeftPadded(falsePart, q)),
1405
- type: yield q.receive(ternary.type, type => this.visitType(type, q))
1406
- };
1407
- return (0, util_1.updateIfChanged)(ternary, updates);
1408
- });
1409
- }
1410
- visitThrow(throwStmt, q) {
1411
- return __awaiter(this, void 0, void 0, function* () {
1412
- const updates = {
1413
- exception: yield q.receive(throwStmt.exception, exception => this.visit(exception, q))
1414
- };
1415
- return (0, util_1.updateIfChanged)(throwStmt, updates);
1416
- });
1417
- }
1418
- visitTry(tryStmt, q) {
1419
- return __awaiter(this, void 0, void 0, function* () {
1420
- const updates = {
1421
- resources: yield q.receive(tryStmt.resources, resources => this.visitContainer(resources, q)),
1422
- body: yield q.receive(tryStmt.body, body => this.visit(body, q)),
1423
- catches: yield q.receiveListDefined(tryStmt.catches, catchBlock => this.visit(catchBlock, q)),
1424
- finally: yield q.receive(tryStmt.finally, finallyBlock => this.visitOptionalLeftPadded(finallyBlock, q))
1425
- };
1426
- return (0, util_1.updateIfChanged)(tryStmt, updates);
1427
- });
1428
- }
1429
- visitTryResource(resource, q) {
1430
- return __awaiter(this, void 0, void 0, function* () {
1431
- const updates = {
1432
- variableDeclarations: yield q.receive(resource.variableDeclarations, variables => this.visit(variables, q)),
1433
- terminatedWithSemicolon: yield q.receive(resource.terminatedWithSemicolon)
1434
- };
1435
- return (0, util_1.updateIfChanged)(resource, updates);
1436
- });
1437
- }
1438
- visitTryCatch(tryCatch, q) {
1439
- return __awaiter(this, void 0, void 0, function* () {
1440
- const updates = {
1441
- parameter: yield q.receive(tryCatch.parameter, param => this.visit(param, q)),
1442
- body: yield q.receive(tryCatch.body, body => this.visit(body, q))
1443
- };
1444
- return (0, util_1.updateIfChanged)(tryCatch, updates);
1445
- });
1446
- }
1447
- visitUnary(unary, q) {
1448
- return __awaiter(this, void 0, void 0, function* () {
1449
- const updates = {
1450
- operator: yield q.receive(unary.operator, op => this.visitLeftPadded(op, q)),
1451
- expression: yield q.receive(unary.expression, expr => this.visit(expr, q)),
1452
- type: yield q.receive(unary.type, type => this.visitType(type, q))
1453
- };
1454
- return (0, util_1.updateIfChanged)(unary, updates);
1455
- });
1456
- }
1457
- visitUnknown(unknown, q) {
1458
- return __awaiter(this, void 0, void 0, function* () {
1459
- const updates = {
1460
- source: yield q.receive(unknown.source, source => this.visit(source, q))
1461
- };
1462
- return (0, util_1.updateIfChanged)(unknown, updates);
1463
- });
1464
- }
1465
- visitUnknownSource(unknownSource, q) {
1466
- return __awaiter(this, void 0, void 0, function* () {
1467
- const updates = {
1468
- text: yield q.receive(unknownSource.text)
1469
- };
1470
- return (0, util_1.updateIfChanged)(unknownSource, updates);
1471
- });
1472
- }
1473
- visitVariable(variable, q) {
1474
- return __awaiter(this, void 0, void 0, function* () {
1475
- const updates = {
1476
- name: yield q.receive(variable.name, name => this.visit(name, q)),
1477
- dimensionsAfterName: yield q.receiveListDefined(variable.dimensionsAfterName, dim => this.visitLeftPadded(dim, q)),
1478
- initializer: yield q.receive(variable.initializer, init => this.visitOptionalLeftPadded(init, q)),
1479
- variableType: yield q.receive(variable.variableType, type => this.visitType(type, q))
1480
- };
1481
- return (0, util_1.updateIfChanged)(variable, updates);
1482
- });
1483
- }
1484
- visitYield(yieldStmt, q) {
1485
- return __awaiter(this, void 0, void 0, function* () {
1486
- const updates = {
1487
- implicit: yield q.receive(yieldStmt.implicit),
1488
- value: yield q.receive(yieldStmt.value, value => this.visit(value, q))
1489
- };
1490
- return (0, util_1.updateIfChanged)(yieldStmt, updates);
1491
- });
1492
- }
1493
- visitTypeParameters(typeParams, q) {
1494
- return __awaiter(this, void 0, void 0, function* () {
1495
- const updates = {
1496
- annotations: yield q.receiveListDefined(typeParams.annotations, annot => this.visit(annot, q)),
1497
- typeParameters: yield q.receiveListDefined(typeParams.typeParameters, param => this.visitRightPadded(param, q))
1498
- };
1499
- return (0, util_1.updateIfChanged)(typeParams, updates);
1500
- });
1501
- }
1502
- visitReturn(returnStmt, q) {
1503
- return __awaiter(this, void 0, void 0, function* () {
1504
- const updates = {
1505
- expression: yield q.receive(returnStmt.expression, expr => this.visit(expr, q))
1506
- };
1507
- return (0, util_1.updateIfChanged)(returnStmt, updates);
1508
- });
1509
- }
1510
- visitSynchronized(synchronizedStmt, q) {
1511
- return __awaiter(this, void 0, void 0, function* () {
1512
- const updates = {
1513
- lock: yield q.receive(synchronizedStmt.lock, lock => this.visit(lock, q)),
1514
- body: yield q.receive(synchronizedStmt.body, body => this.visit(body, q))
1515
- };
1516
- return (0, util_1.updateIfChanged)(synchronizedStmt, updates);
1517
- });
1518
- }
1519
- visitTypeCast(typeCast, q) {
1520
- return __awaiter(this, void 0, void 0, function* () {
1521
- const updates = {
1522
- class: yield q.receive(typeCast.class, typeExpr => this.visit(typeExpr, q)),
1523
- expression: yield q.receive(typeCast.expression, expr => this.visit(expr, q))
1524
- };
1525
- return (0, util_1.updateIfChanged)(typeCast, updates);
1526
- });
1527
- }
1528
- visitTypeParameter(typeParameter, q) {
1529
- return __awaiter(this, void 0, void 0, function* () {
1530
- const updates = {
1531
- annotations: yield q.receiveListDefined(typeParameter.annotations, annot => this.visit(annot, q)),
1532
- modifiers: yield q.receiveListDefined(typeParameter.modifiers, annot => this.visit(annot, q)),
1533
- name: yield q.receive(typeParameter.name, name => this.visit(name, q)),
1534
- bounds: yield q.receive(typeParameter.bounds, bounds => this.visitContainer(bounds, q))
1535
- };
1536
- return (0, util_1.updateIfChanged)(typeParameter, updates);
1537
- });
1538
- }
1539
- visitWhileLoop(whileLoop, q) {
1540
- return __awaiter(this, void 0, void 0, function* () {
1541
- const updates = {
1542
- condition: yield q.receive(whileLoop.condition, cond => this.visit(cond, q)),
1543
- body: yield q.receive(whileLoop.body, body => this.visitOptionalRightPadded(body, q))
1544
- };
1545
- return (0, util_1.updateIfChanged)(whileLoop, updates);
1546
- });
1547
- }
1548
- visitWildcard(wildcard, q) {
1549
- return __awaiter(this, void 0, void 0, function* () {
1550
- const updates = {
1551
- bound: yield q.receive(wildcard.bound, bound => this.visitLeftPadded(bound, q)),
1552
- boundedType: yield q.receive(wildcard.boundedType, type => this.visit(type, q))
1553
- };
1554
- return (0, util_1.updateIfChanged)(wildcard, updates);
1555
- });
1556
- }
1557
- visitCompilationUnit(cu, q) {
1558
- return __awaiter(this, void 0, void 0, function* () {
1559
- const updates = {
1560
- sourcePath: yield q.receive(cu.sourcePath),
1561
- charsetName: yield q.receive(cu.charsetName),
1562
- charsetBomMarked: yield q.receive(cu.charsetBomMarked),
1563
- checksum: yield q.receive(cu.checksum),
1564
- fileAttributes: yield q.receive(cu.fileAttributes),
1565
- packageDeclaration: yield q.receive(cu.packageDeclaration, pkg => this.visitRightPadded(pkg, q)),
1566
- imports: yield q.receiveListDefined(cu.imports, imp => this.visitRightPadded(imp, q)),
1567
- classes: yield q.receiveListDefined(cu.classes, cls => this.visit(cls, q)),
1568
- eof: yield q.receive(cu.eof, space => this.visitSpace(space, q))
1569
- };
1570
- return (0, util_1.updateIfChanged)(cu, updates);
1571
- });
1572
- }
1573
- visitPackage(pkg, q) {
1574
- return __awaiter(this, void 0, void 0, function* () {
1575
- const updates = {
1576
- expression: yield q.receive(pkg.expression, expr => this.visit(expr, q)),
1577
- annotations: yield q.receiveListDefined(pkg.annotations, annot => this.visit(annot, q))
1578
- };
1579
- return (0, util_1.updateIfChanged)(pkg, updates);
1580
- });
1581
- }
1582
- visitClassDeclaration(cls, q) {
1583
- return __awaiter(this, void 0, void 0, function* () {
1584
- const updates = {
1585
- leadingAnnotations: yield q.receiveListDefined(cls.leadingAnnotations, annot => this.visit(annot, q)),
1586
- modifiers: yield q.receiveListDefined(cls.modifiers, mod => this.visit(mod, q)),
1587
- classKind: yield q.receive(cls.classKind, kind => this.visit(kind, q)),
1588
- name: yield q.receive(cls.name, name => this.visit(name, q)),
1589
- typeParameters: yield q.receive(cls.typeParameters, params => this.visitContainer(params, q)),
1590
- primaryConstructor: yield q.receive(cls.primaryConstructor, cons => this.visitContainer(cons, q)),
1591
- extends: yield q.receive(cls.extends, ext => this.visitLeftPadded(ext, q)),
1592
- implements: yield q.receive(cls.implements, impl => this.visitContainer(impl, q)),
1593
- permitting: yield q.receive(cls.permitting, perm => this.visitContainer(perm, q)),
1594
- body: yield q.receive(cls.body, body => this.visit(body, q))
1595
- };
1596
- return (0, util_1.updateIfChanged)(cls, updates);
1597
- });
1598
- }
1599
- visitClassDeclarationKind(kind, q) {
1600
- return __awaiter(this, void 0, void 0, function* () {
1601
- const updates = {
1602
- annotations: yield q.receiveListDefined(kind.annotations, annot => this.visit(annot, q)),
1603
- type: yield q.receive(kind.type)
1604
- };
1605
- return (0, util_1.updateIfChanged)(kind, updates);
1606
- });
1607
- }
1608
- visitBlock(block, q) {
1609
- return __awaiter(this, void 0, void 0, function* () {
1610
- const updates = {
1611
- static: yield q.receive(block.static, s => this.visitRightPadded(s, q)),
1612
- statements: yield q.receiveListDefined(block.statements, stmt => this.visitRightPadded(stmt, q)),
1613
- end: yield q.receive(block.end, space => this.visitSpace(space, q))
1614
- };
1615
- return (0, util_1.updateIfChanged)(block, updates);
1616
- });
1617
- }
1618
- visitMethodDeclaration(method, q) {
1619
- return __awaiter(this, void 0, void 0, function* () {
1620
- const updates = {
1621
- leadingAnnotations: yield q.receiveListDefined(method.leadingAnnotations, annot => this.visit(annot, q)),
1622
- modifiers: yield q.receiveListDefined(method.modifiers, mod => this.visit(mod, q)),
1623
- typeParameters: yield q.receive(method.typeParameters, params => this.visit(params, q)),
1624
- returnTypeExpression: yield q.receive(method.returnTypeExpression, type => this.visit(type, q)),
1625
- nameAnnotations: (yield q.receiveList(method.nameAnnotations, name => this.visit(name, q))),
1626
- name: yield q.receive(method.name, name => this.visit(name, q)),
1627
- parameters: yield q.receive(method.parameters, params => this.visitContainer(params, q)),
1628
- throws: yield q.receive(method.throws, throws => this.visitContainer(throws, q)),
1629
- body: yield q.receive(method.body, body => this.visit(body, q)),
1630
- defaultValue: yield q.receive(method.defaultValue, def => this.visitLeftPadded(def, q)),
1631
- methodType: yield q.receive(method.methodType, type => this.visitType(type, q))
1632
- };
1633
- return (0, util_1.updateIfChanged)(method, updates);
1634
- });
1635
- }
1636
- visitVariableDeclarations(varDecls, q) {
1637
- return __awaiter(this, void 0, void 0, function* () {
1638
- const updates = {
1639
- leadingAnnotations: yield q.receiveListDefined(varDecls.leadingAnnotations, annot => this.visit(annot, q)),
1640
- modifiers: yield q.receiveListDefined(varDecls.modifiers, mod => this.visit(mod, q)),
1641
- typeExpression: yield q.receive(varDecls.typeExpression, type => this.visit(type, q)),
1642
- varargs: yield q.receive(varDecls.varargs, space => this.visitSpace(space, q)),
1643
- variables: yield q.receiveListDefined(varDecls.variables, variable => this.visitRightPadded(variable, q))
1644
- };
1645
- return (0, util_1.updateIfChanged)(varDecls, updates);
1646
- });
1647
- }
1648
- visitIdentifier(ident, q) {
1649
- return __awaiter(this, void 0, void 0, function* () {
1650
- const updates = {
1651
- annotations: yield q.receiveListDefined(ident.annotations, annot => this.visit(annot, q)),
1652
- simpleName: yield q.receive(ident.simpleName),
1653
- type: yield q.receive(ident.type, type => this.visitType(type, q)),
1654
- fieldType: yield q.receive(ident.fieldType, type => this.visitType(type, q))
1655
- };
1656
- return (0, util_1.updateIfChanged)(ident, updates);
1657
- });
1658
- }
1659
- visitSpace(space, q) {
1660
- return __awaiter(this, void 0, void 0, function* () {
1661
- const updates = {
1662
- comments: yield q.receiveListDefined(space.comments, (c) => __awaiter(this, void 0, void 0, function* () {
1663
- if (c.kind === tree_1.J.Kind.TextComment) {
1664
- const tc = c;
1665
- const commentUpdates = {
1666
- multiline: yield q.receive(tc.multiline),
1667
- text: yield q.receive(tc.text),
1668
- suffix: yield q.receive(c.suffix),
1669
- markers: yield q.receive(c.markers)
1670
- };
1671
- return (0, util_1.updateIfChanged)(tc, commentUpdates);
1672
- }
1673
- else {
1674
- throw new Error(`Unexpected comment type ${c.kind}`);
1675
- }
1676
- })),
1677
- whitespace: yield q.receive(space.whitespace)
1678
- };
1679
- return (0, util_1.updateIfChanged)(space, updates);
1680
- });
1681
- }
1682
- visitLeftPadded(left, q) {
1683
- return __awaiter(this, void 0, void 0, function* () {
1684
- if (!left) {
1685
- throw new Error("TreeDataReceiveQueue should have instantiated an empty left padding");
1686
- }
1687
- const updates = {
1688
- before: yield q.receive(left.before, space => this.visitSpace(space, q)),
1689
- element: yield q.receive(left.element, elem => {
1690
- if ((0, tree_1.isSpace)(elem)) {
1691
- return this.visitSpace(elem, q);
1692
- }
1693
- else if (typeof elem === 'object' && elem.kind) {
1694
- // FIXME find a better way to check if it is a `Tree`
1695
- return this.visit(elem, q);
1696
- }
1697
- return elem;
1698
- }),
1699
- markers: yield q.receive(left.markers)
1700
- };
1701
- return (0, util_1.updateIfChanged)(left, updates);
1702
- });
1703
- }
1704
- visitRightPadded(right, q) {
1705
- return __awaiter(this, void 0, void 0, function* () {
1706
- if (!right) {
1707
- throw new Error("TreeDataReceiveQueue should have instantiated an empty right padding");
1708
- }
1709
- const updates = {
1710
- element: yield q.receive(right.element, elem => {
1711
- if ((0, tree_1.isSpace)(elem)) {
1712
- return this.visitSpace(elem, q);
1713
- }
1714
- else if (typeof elem === 'object' && elem.kind) {
1715
- // FIXME find a better way to check if it is a `Tree`
1716
- return this.visit(elem, q);
1717
- }
1718
- return elem;
1719
- }),
1720
- after: yield q.receive(right.after, space => this.visitSpace(space, q)),
1721
- markers: yield q.receive(right.markers)
1722
- };
1723
- return (0, util_1.updateIfChanged)(right, updates);
1724
- });
1725
- }
1726
- visitContainer(container, q) {
1727
- return __awaiter(this, void 0, void 0, function* () {
1728
- const updates = {
1729
- before: yield q.receive(container.before, space => this.visitSpace(space, q)),
1730
- elements: yield q.receiveListDefined(container.elements, elem => this.visitRightPadded(elem, q)),
1731
- markers: yield q.receive(container.markers)
1732
- };
1733
- return (0, util_1.updateIfChanged)(container, updates);
1734
- });
1735
- }
1736
- visitType(javaType, q) {
1737
- return __awaiter(this, void 0, void 0, function* () {
1738
- if (!javaType) {
1739
- return undefined;
1740
- }
1741
- else if (javaType.kind === type_1.Type.Kind.Unknown) {
1742
- return type_1.Type.unknownType;
1743
- }
1744
- return yield this.typeVisitor.visit(javaType, q);
1745
- });
750
+ async visitAnnotatedType(annotatedType, q) {
751
+ const updates = {
752
+ annotations: await q.receiveListDefined(annotatedType.annotations, annot => this.visit(annot, q)),
753
+ typeExpression: await q.receive(annotatedType.typeExpression, type => this.visit(type, q))
754
+ };
755
+ return (0, util_1.updateIfChanged)(annotatedType, updates);
756
+ }
757
+ async visitAnnotation(annotation, q) {
758
+ const updates = {
759
+ annotationType: await q.receive(annotation.annotationType, type => this.visit(type, q)),
760
+ arguments: await q.receive(annotation.arguments, args => this.visitContainer(args, q))
761
+ };
762
+ return (0, util_1.updateIfChanged)(annotation, updates);
763
+ }
764
+ async visitArrayAccess(arrayAccess, q) {
765
+ const updates = {
766
+ indexed: await q.receive(arrayAccess.indexed, indexed => this.visit(indexed, q)),
767
+ dimension: await q.receive(arrayAccess.dimension, dim => this.visit(dim, q))
768
+ };
769
+ return (0, util_1.updateIfChanged)(arrayAccess, updates);
770
+ }
771
+ async visitArrayDimension(dimension, q) {
772
+ const updates = {
773
+ index: await q.receive(dimension.index, idx => this.visitRightPadded(idx, q))
774
+ };
775
+ return (0, util_1.updateIfChanged)(dimension, updates);
776
+ }
777
+ async visitArrayType(arrayType, q) {
778
+ const updates = {
779
+ elementType: await q.receive(arrayType.elementType, type => this.visit(type, q)),
780
+ annotations: await q.receiveListDefined(arrayType.annotations || [], annot => this.visit(annot, q)),
781
+ dimension: await q.receive(arrayType.dimension, d => this.visitLeftPadded(d, q)),
782
+ type: await q.receive(arrayType.type, type => this.visitType(type, q))
783
+ };
784
+ return (0, util_1.updateIfChanged)(arrayType, updates);
785
+ }
786
+ async visitAssert(assert, q) {
787
+ const updates = {
788
+ condition: await q.receive(assert.condition, cond => this.visit(cond, q)),
789
+ detail: await q.receive(assert.detail, detail => this.visitOptionalLeftPadded(detail, q))
790
+ };
791
+ return (0, util_1.updateIfChanged)(assert, updates);
792
+ }
793
+ async visitAssignment(assignment, q) {
794
+ const updates = {
795
+ variable: await q.receive(assignment.variable, variable => this.visit(variable, q)),
796
+ assignment: await q.receive(assignment.assignment, assign => this.visitLeftPadded(assign, q)),
797
+ type: await q.receive(assignment.type, type => this.visitType(type, q))
798
+ };
799
+ return (0, util_1.updateIfChanged)(assignment, updates);
800
+ }
801
+ async visitAssignmentOperation(assignOp, q) {
802
+ const updates = {
803
+ variable: await q.receive(assignOp.variable, variable => this.visit(variable, q)),
804
+ operator: await q.receive(assignOp.operator, op => this.visitLeftPadded(op, q)),
805
+ assignment: await q.receive(assignOp.assignment, assign => this.visit(assign, q)),
806
+ type: await q.receive(assignOp.type, type => this.visitType(type, q))
807
+ };
808
+ return (0, util_1.updateIfChanged)(assignOp, updates);
809
+ }
810
+ async visitBinary(binary, q) {
811
+ const updates = {
812
+ left: await q.receive(binary.left, left => this.visit(left, q)),
813
+ operator: await q.receive(binary.operator, op => this.visitLeftPadded(op, q)),
814
+ right: await q.receive(binary.right, right => this.visit(right, q)),
815
+ type: await q.receive(binary.type, type => this.visitType(type, q))
816
+ };
817
+ return (0, util_1.updateIfChanged)(binary, updates);
818
+ }
819
+ async visitBreak(breakStmt, q) {
820
+ const updates = {
821
+ label: await q.receive(breakStmt.label, label => this.visit(label, q))
822
+ };
823
+ return (0, util_1.updateIfChanged)(breakStmt, updates);
824
+ }
825
+ async visitCase(caseStmt, q) {
826
+ const updates = {
827
+ type: await q.receive(caseStmt.type),
828
+ caseLabels: await q.receive(caseStmt.caseLabels, labels => this.visitContainer(labels, q)),
829
+ statements: await q.receive(caseStmt.statements, stmts => this.visitContainer(stmts, q)),
830
+ body: await q.receive(caseStmt.body, body => this.visitRightPadded(body, q)),
831
+ guard: await q.receive(caseStmt.guard, guard => this.visit(guard, q))
832
+ };
833
+ return (0, util_1.updateIfChanged)(caseStmt, updates);
834
+ }
835
+ async visitContinue(continueStmt, q) {
836
+ const updates = {
837
+ label: await q.receive(continueStmt.label, label => this.visit(label, q))
838
+ };
839
+ return (0, util_1.updateIfChanged)(continueStmt, updates);
840
+ }
841
+ async visitControlParentheses(controlParens, q) {
842
+ const updates = {
843
+ tree: await q.receive(controlParens.tree, tree => this.visitRightPadded(tree, q))
844
+ };
845
+ return (0, util_1.updateIfChanged)(controlParens, updates);
846
+ }
847
+ async visitDeconstructionPattern(pattern, q) {
848
+ const updates = {
849
+ deconstructor: await q.receive(pattern.deconstructor, deconstructor => this.visit(deconstructor, q)),
850
+ nested: await q.receive(pattern.nested, nested => this.visitContainer(nested, q)),
851
+ type: await q.receive(pattern.type, type => this.visitType(type, q))
852
+ };
853
+ return (0, util_1.updateIfChanged)(pattern, updates);
854
+ }
855
+ async visitDoWhileLoop(doWhile, q) {
856
+ const updates = {
857
+ body: await q.receive(doWhile.body, body => this.visitOptionalRightPadded(body, q)),
858
+ whileCondition: await q.receive(doWhile.whileCondition, cond => this.visitLeftPadded(cond, q))
859
+ };
860
+ return (0, util_1.updateIfChanged)(doWhile, updates);
861
+ }
862
+ async visitEmpty(empty) {
863
+ // no additional properties to receive
864
+ return empty;
865
+ }
866
+ async visitEnumValueSet(enumValueSet, q) {
867
+ const updates = {
868
+ enums: await q.receiveListDefined(enumValueSet.enums, enumValue => this.visitRightPadded(enumValue, q)),
869
+ terminatedWithSemicolon: await q.receive(enumValueSet.terminatedWithSemicolon)
870
+ };
871
+ return (0, util_1.updateIfChanged)(enumValueSet, updates);
872
+ }
873
+ async visitEnumValue(enumValue, q) {
874
+ const updates = {
875
+ annotations: await q.receiveListDefined(enumValue.annotations, annot => this.visit(annot, q)),
876
+ name: await q.receive(enumValue.name, name => this.visit(name, q)),
877
+ initializer: await q.receive(enumValue.initializer, init => this.visit(init, q))
878
+ };
879
+ return (0, util_1.updateIfChanged)(enumValue, updates);
880
+ }
881
+ async visitErroneous(erroneous, q) {
882
+ const updates = {
883
+ text: await q.receive(erroneous.text)
884
+ };
885
+ return (0, util_1.updateIfChanged)(erroneous, updates);
886
+ }
887
+ async visitFieldAccess(fieldAccess, q) {
888
+ const updates = {
889
+ target: await q.receive(fieldAccess.target, target => this.visit(target, q)),
890
+ name: await q.receive(fieldAccess.name, name => this.visitLeftPadded(name, q)),
891
+ type: await q.receive(fieldAccess.type, type => this.visitType(type, q))
892
+ };
893
+ return (0, util_1.updateIfChanged)(fieldAccess, updates);
894
+ }
895
+ async visitForEachLoop(forEachLoop, q) {
896
+ const updates = {
897
+ control: await q.receive(forEachLoop.control, c => this.visit(c, q)),
898
+ body: await q.receive(forEachLoop.body, body => this.visitRightPadded(body, q))
899
+ };
900
+ return (0, util_1.updateIfChanged)(forEachLoop, updates);
901
+ }
902
+ async visitForEachLoopControl(control, q) {
903
+ const updates = {
904
+ variable: await q.receive(control.variable, variable => this.visitRightPadded(variable, q)),
905
+ iterable: await q.receive(control.iterable, expr => this.visitRightPadded(expr, q))
906
+ };
907
+ return (0, util_1.updateIfChanged)(control, updates);
908
+ }
909
+ async visitForLoop(forLoop, q) {
910
+ const updates = {
911
+ control: await q.receive(forLoop.control, c => this.visit(c, q)),
912
+ body: await q.receive(forLoop.body, body => this.visitRightPadded(body, q))
913
+ };
914
+ return (0, util_1.updateIfChanged)(forLoop, updates);
915
+ }
916
+ async visitForLoopControl(control, q) {
917
+ const updates = {
918
+ init: await q.receiveListDefined(control.init, init => this.visitRightPadded(init, q)),
919
+ condition: await q.receive(control.condition, cond => this.visitRightPadded(cond, q)),
920
+ update: await q.receiveListDefined(control.update, update => this.visitRightPadded(update, q))
921
+ };
922
+ return (0, util_1.updateIfChanged)(control, updates);
923
+ }
924
+ async visitIf(ifStmt, q) {
925
+ const updates = {
926
+ ifCondition: await q.receive(ifStmt.ifCondition, cond => this.visit(cond, q)),
927
+ thenPart: await q.receive(ifStmt.thenPart, thenPart => this.visitRightPadded(thenPart, q)),
928
+ elsePart: await q.receive(ifStmt.elsePart, elsePart => this.visit(elsePart, q))
929
+ };
930
+ return (0, util_1.updateIfChanged)(ifStmt, updates);
931
+ }
932
+ async visitElse(ifElse, q) {
933
+ const updates = {
934
+ body: await q.receive(ifElse.body, body => this.visitRightPadded(body, q))
935
+ };
936
+ return (0, util_1.updateIfChanged)(ifElse, updates);
937
+ }
938
+ async visitImport(importStmt, q) {
939
+ const updates = {
940
+ static: await q.receive(importStmt.static, s => this.visitLeftPadded(s, q)),
941
+ qualid: await q.receive(importStmt.qualid, qualid => this.visit(qualid, q)),
942
+ alias: await q.receive(importStmt.alias, alias => this.visitLeftPadded(alias, q))
943
+ };
944
+ return (0, util_1.updateIfChanged)(importStmt, updates);
945
+ }
946
+ async visitInstanceOf(instanceOf, q) {
947
+ const updates = {
948
+ expression: await q.receive(instanceOf.expression, expr => this.visitRightPadded(expr, q)),
949
+ class: await q.receive(instanceOf.class, clazz => this.visit(clazz, q)),
950
+ pattern: await q.receive(instanceOf.pattern, pattern => this.visit(pattern, q)),
951
+ type: await q.receive(instanceOf.type, type => this.visitType(type, q)),
952
+ modifier: await q.receive(instanceOf.modifier, mod => this.visit(mod, q))
953
+ };
954
+ return (0, util_1.updateIfChanged)(instanceOf, updates);
955
+ }
956
+ async visitIntersectionType(intersectionType, q) {
957
+ const updates = {
958
+ bounds: await q.receive(intersectionType.bounds, bounds => this.visitContainer(bounds, q))
959
+ };
960
+ return (0, util_1.updateIfChanged)(intersectionType, updates);
961
+ }
962
+ async visitLabel(label, q) {
963
+ const updates = {
964
+ label: await q.receive(label.label, lbl => this.visitRightPadded(lbl, q)),
965
+ statement: await q.receive(label.statement, stmt => this.visit(stmt, q))
966
+ };
967
+ return (0, util_1.updateIfChanged)(label, updates);
968
+ }
969
+ async visitLambda(lambda, q) {
970
+ const updates = {
971
+ parameters: await q.receive(lambda.parameters, params => this.visit(params, q)),
972
+ arrow: await q.receive(lambda.arrow, arrow => this.visitSpace(arrow, q)),
973
+ body: await q.receive(lambda.body, body => this.visit(body, q)),
974
+ type: await q.receive(lambda.type, type => this.visitType(type, q))
975
+ };
976
+ return (0, util_1.updateIfChanged)(lambda, updates);
977
+ }
978
+ async visitLambdaParameters(params, q) {
979
+ const updates = {
980
+ parenthesized: await q.receive(params.parenthesized),
981
+ parameters: await q.receiveListDefined(params.parameters, param => this.visitRightPadded(param, q))
982
+ };
983
+ return (0, util_1.updateIfChanged)(params, updates);
984
+ }
985
+ async visitLiteral(literal, q) {
986
+ const updates = {
987
+ value: await q.receive(literal.value),
988
+ valueSource: await q.receive(literal.valueSource),
989
+ unicodeEscapes: await q.receiveList(literal.unicodeEscapes),
990
+ type: await q.receive(literal.type, type => this.visitType(type, q))
991
+ };
992
+ return (0, util_1.updateIfChanged)(literal, updates);
993
+ }
994
+ async visitMemberReference(memberRef, q) {
995
+ const updates = {
996
+ containing: await q.receive(memberRef.containing, container => this.visitRightPadded(container, q)),
997
+ typeParameters: await q.receive(memberRef.typeParameters, typeParams => this.visitContainer(typeParams, q)),
998
+ reference: await q.receive(memberRef.reference, ref => this.visitLeftPadded(ref, q)),
999
+ type: await q.receive(memberRef.type, type => this.visitType(type, q)),
1000
+ methodType: await q.receive(memberRef.methodType, type => this.visitType(type, q)),
1001
+ variableType: await q.receive(memberRef.variableType, type => this.visitType(type, q))
1002
+ };
1003
+ return (0, util_1.updateIfChanged)(memberRef, updates);
1004
+ }
1005
+ async visitMethodInvocation(methodInvoc, q) {
1006
+ const updates = {
1007
+ select: await q.receive(methodInvoc.select, select => this.visitRightPadded(select, q)),
1008
+ typeParameters: await q.receive(methodInvoc.typeParameters, typeParams => this.visitContainer(typeParams, q)),
1009
+ name: await q.receive(methodInvoc.name, name => this.visit(name, q)),
1010
+ arguments: await q.receive(methodInvoc.arguments, args => this.visitContainer(args, q)),
1011
+ methodType: await q.receive(methodInvoc.methodType, type => this.visitType(type, q))
1012
+ };
1013
+ return (0, util_1.updateIfChanged)(methodInvoc, updates);
1014
+ }
1015
+ async visitModifier(modifier, q) {
1016
+ const updates = {
1017
+ keyword: await q.receive(modifier.keyword),
1018
+ type: await q.receive(modifier.type),
1019
+ annotations: await q.receiveListDefined(modifier.annotations, annot => this.visit(annot, q))
1020
+ };
1021
+ return (0, util_1.updateIfChanged)(modifier, updates);
1022
+ }
1023
+ async visitMultiCatch(multiCatch, q) {
1024
+ const updates = {
1025
+ alternatives: await q.receiveListDefined(multiCatch.alternatives, alt => this.visitRightPadded(alt, q))
1026
+ };
1027
+ return (0, util_1.updateIfChanged)(multiCatch, updates);
1028
+ }
1029
+ async visitNewArray(newArray, q) {
1030
+ const updates = {
1031
+ typeExpression: await q.receive(newArray.typeExpression, type => this.visit(type, q)),
1032
+ dimensions: await q.receiveListDefined(newArray.dimensions, dim => this.visit(dim, q)),
1033
+ initializer: await q.receive(newArray.initializer, init => this.visitContainer(init, q)),
1034
+ type: await q.receive(newArray.type, type => this.visitType(type, q))
1035
+ };
1036
+ return (0, util_1.updateIfChanged)(newArray, updates);
1037
+ }
1038
+ async visitNewClass(newClass, q) {
1039
+ const updates = {
1040
+ enclosing: await q.receive(newClass.enclosing, encl => this.visitRightPadded(encl, q)),
1041
+ new: await q.receive(newClass.new, new_ => this.visitSpace(new_, q)),
1042
+ class: await q.receive(newClass.class, clazz => this.visit(clazz, q)),
1043
+ arguments: await q.receive(newClass.arguments, args => this.visitContainer(args, q)),
1044
+ body: await q.receive(newClass.body, body => this.visit(body, q)),
1045
+ constructorType: await q.receive(newClass.constructorType, type => this.visitType(type, q))
1046
+ };
1047
+ return (0, util_1.updateIfChanged)(newClass, updates);
1048
+ }
1049
+ async visitNullableType(nullableType, q) {
1050
+ const updates = {
1051
+ annotations: await q.receiveListDefined(nullableType.annotations, annot => this.visit(annot, q)),
1052
+ typeTree: await q.receive(nullableType.typeTree, type => this.visitRightPadded(type, q))
1053
+ };
1054
+ return (0, util_1.updateIfChanged)(nullableType, updates);
1055
+ }
1056
+ async visitParameterizedType(paramType, q) {
1057
+ const updates = {
1058
+ class: await q.receive(paramType.class, clazz => this.visit(clazz, q)),
1059
+ typeParameters: await q.receive(paramType.typeParameters, params => this.visitContainer(params, q)),
1060
+ type: await q.receive(paramType.type, type => this.visitType(type, q))
1061
+ };
1062
+ return (0, util_1.updateIfChanged)(paramType, updates);
1063
+ }
1064
+ async visitParentheses(parentheses, q) {
1065
+ const updates = {
1066
+ tree: await q.receive(parentheses.tree, tree => this.visitRightPadded(tree, q))
1067
+ };
1068
+ return (0, util_1.updateIfChanged)(parentheses, updates);
1069
+ }
1070
+ async visitParenthesizedTypeTree(parenthesizedType, q) {
1071
+ const updates = {
1072
+ annotations: await q.receiveListDefined(parenthesizedType.annotations, annot => this.visit(annot, q)),
1073
+ parenthesizedType: await q.receive(parenthesizedType.parenthesizedType, tree => this.visit(tree, q))
1074
+ };
1075
+ return (0, util_1.updateIfChanged)(parenthesizedType, updates);
1076
+ }
1077
+ async visitPrimitive(primitive, q) {
1078
+ const updates = {
1079
+ type: await q.receive(primitive.type, type => this.visitType(type, q))
1080
+ };
1081
+ return (0, util_1.updateIfChanged)(primitive, updates);
1082
+ }
1083
+ async visitSwitch(switchStmt, q) {
1084
+ const updates = {
1085
+ selector: await q.receive(switchStmt.selector, selector => this.visit(selector, q)),
1086
+ cases: await q.receive(switchStmt.cases, cases => this.visit(cases, q))
1087
+ };
1088
+ return (0, util_1.updateIfChanged)(switchStmt, updates);
1089
+ }
1090
+ async visitSwitchExpression(switchExpr, q) {
1091
+ const updates = {
1092
+ selector: await q.receive(switchExpr.selector, selector => this.visit(selector, q)),
1093
+ cases: await q.receive(switchExpr.cases, cases => this.visit(cases, q)),
1094
+ type: await q.receive(switchExpr.type, type => this.visitType(type, q))
1095
+ };
1096
+ return (0, util_1.updateIfChanged)(switchExpr, updates);
1097
+ }
1098
+ async visitTernary(ternary, q) {
1099
+ const updates = {
1100
+ condition: await q.receive(ternary.condition, cond => this.visit(cond, q)),
1101
+ truePart: await q.receive(ternary.truePart, truePart => this.visitLeftPadded(truePart, q)),
1102
+ falsePart: await q.receive(ternary.falsePart, falsePart => this.visitLeftPadded(falsePart, q)),
1103
+ type: await q.receive(ternary.type, type => this.visitType(type, q))
1104
+ };
1105
+ return (0, util_1.updateIfChanged)(ternary, updates);
1106
+ }
1107
+ async visitThrow(throwStmt, q) {
1108
+ const updates = {
1109
+ exception: await q.receive(throwStmt.exception, exception => this.visit(exception, q))
1110
+ };
1111
+ return (0, util_1.updateIfChanged)(throwStmt, updates);
1112
+ }
1113
+ async visitTry(tryStmt, q) {
1114
+ const updates = {
1115
+ resources: await q.receive(tryStmt.resources, resources => this.visitContainer(resources, q)),
1116
+ body: await q.receive(tryStmt.body, body => this.visit(body, q)),
1117
+ catches: await q.receiveListDefined(tryStmt.catches, catchBlock => this.visit(catchBlock, q)),
1118
+ finally: await q.receive(tryStmt.finally, finallyBlock => this.visitOptionalLeftPadded(finallyBlock, q))
1119
+ };
1120
+ return (0, util_1.updateIfChanged)(tryStmt, updates);
1121
+ }
1122
+ async visitTryResource(resource, q) {
1123
+ const updates = {
1124
+ variableDeclarations: await q.receive(resource.variableDeclarations, variables => this.visit(variables, q)),
1125
+ terminatedWithSemicolon: await q.receive(resource.terminatedWithSemicolon)
1126
+ };
1127
+ return (0, util_1.updateIfChanged)(resource, updates);
1128
+ }
1129
+ async visitTryCatch(tryCatch, q) {
1130
+ const updates = {
1131
+ parameter: await q.receive(tryCatch.parameter, param => this.visit(param, q)),
1132
+ body: await q.receive(tryCatch.body, body => this.visit(body, q))
1133
+ };
1134
+ return (0, util_1.updateIfChanged)(tryCatch, updates);
1135
+ }
1136
+ async visitUnary(unary, q) {
1137
+ const updates = {
1138
+ operator: await q.receive(unary.operator, op => this.visitLeftPadded(op, q)),
1139
+ expression: await q.receive(unary.expression, expr => this.visit(expr, q)),
1140
+ type: await q.receive(unary.type, type => this.visitType(type, q))
1141
+ };
1142
+ return (0, util_1.updateIfChanged)(unary, updates);
1143
+ }
1144
+ async visitUnknown(unknown, q) {
1145
+ const updates = {
1146
+ source: await q.receive(unknown.source, source => this.visit(source, q))
1147
+ };
1148
+ return (0, util_1.updateIfChanged)(unknown, updates);
1149
+ }
1150
+ async visitUnknownSource(unknownSource, q) {
1151
+ const updates = {
1152
+ text: await q.receive(unknownSource.text)
1153
+ };
1154
+ return (0, util_1.updateIfChanged)(unknownSource, updates);
1155
+ }
1156
+ async visitVariable(variable, q) {
1157
+ const updates = {
1158
+ name: await q.receive(variable.name, name => this.visit(name, q)),
1159
+ dimensionsAfterName: await q.receiveListDefined(variable.dimensionsAfterName, dim => this.visitLeftPadded(dim, q)),
1160
+ initializer: await q.receive(variable.initializer, init => this.visitOptionalLeftPadded(init, q)),
1161
+ variableType: await q.receive(variable.variableType, type => this.visitType(type, q))
1162
+ };
1163
+ return (0, util_1.updateIfChanged)(variable, updates);
1164
+ }
1165
+ async visitYield(yieldStmt, q) {
1166
+ const updates = {
1167
+ implicit: await q.receive(yieldStmt.implicit),
1168
+ value: await q.receive(yieldStmt.value, value => this.visit(value, q))
1169
+ };
1170
+ return (0, util_1.updateIfChanged)(yieldStmt, updates);
1171
+ }
1172
+ async visitTypeParameters(typeParams, q) {
1173
+ const updates = {
1174
+ annotations: await q.receiveListDefined(typeParams.annotations, annot => this.visit(annot, q)),
1175
+ typeParameters: await q.receiveListDefined(typeParams.typeParameters, param => this.visitRightPadded(param, q))
1176
+ };
1177
+ return (0, util_1.updateIfChanged)(typeParams, updates);
1178
+ }
1179
+ async visitReturn(returnStmt, q) {
1180
+ const updates = {
1181
+ expression: await q.receive(returnStmt.expression, expr => this.visit(expr, q))
1182
+ };
1183
+ return (0, util_1.updateIfChanged)(returnStmt, updates);
1184
+ }
1185
+ async visitSynchronized(synchronizedStmt, q) {
1186
+ const updates = {
1187
+ lock: await q.receive(synchronizedStmt.lock, lock => this.visit(lock, q)),
1188
+ body: await q.receive(synchronizedStmt.body, body => this.visit(body, q))
1189
+ };
1190
+ return (0, util_1.updateIfChanged)(synchronizedStmt, updates);
1191
+ }
1192
+ async visitTypeCast(typeCast, q) {
1193
+ const updates = {
1194
+ class: await q.receive(typeCast.class, typeExpr => this.visit(typeExpr, q)),
1195
+ expression: await q.receive(typeCast.expression, expr => this.visit(expr, q))
1196
+ };
1197
+ return (0, util_1.updateIfChanged)(typeCast, updates);
1198
+ }
1199
+ async visitTypeParameter(typeParameter, q) {
1200
+ const updates = {
1201
+ annotations: await q.receiveListDefined(typeParameter.annotations, annot => this.visit(annot, q)),
1202
+ modifiers: await q.receiveListDefined(typeParameter.modifiers, annot => this.visit(annot, q)),
1203
+ name: await q.receive(typeParameter.name, name => this.visit(name, q)),
1204
+ bounds: await q.receive(typeParameter.bounds, bounds => this.visitContainer(bounds, q))
1205
+ };
1206
+ return (0, util_1.updateIfChanged)(typeParameter, updates);
1207
+ }
1208
+ async visitWhileLoop(whileLoop, q) {
1209
+ const updates = {
1210
+ condition: await q.receive(whileLoop.condition, cond => this.visit(cond, q)),
1211
+ body: await q.receive(whileLoop.body, body => this.visitOptionalRightPadded(body, q))
1212
+ };
1213
+ return (0, util_1.updateIfChanged)(whileLoop, updates);
1214
+ }
1215
+ async visitWildcard(wildcard, q) {
1216
+ const updates = {
1217
+ bound: await q.receive(wildcard.bound, bound => this.visitLeftPadded(bound, q)),
1218
+ boundedType: await q.receive(wildcard.boundedType, type => this.visit(type, q))
1219
+ };
1220
+ return (0, util_1.updateIfChanged)(wildcard, updates);
1221
+ }
1222
+ async visitCompilationUnit(cu, q) {
1223
+ const updates = {
1224
+ sourcePath: await q.receive(cu.sourcePath),
1225
+ charsetName: await q.receive(cu.charsetName),
1226
+ charsetBomMarked: await q.receive(cu.charsetBomMarked),
1227
+ checksum: await q.receive(cu.checksum),
1228
+ fileAttributes: await q.receive(cu.fileAttributes),
1229
+ packageDeclaration: await q.receive(cu.packageDeclaration, pkg => this.visitRightPadded(pkg, q)),
1230
+ imports: await q.receiveListDefined(cu.imports, imp => this.visitRightPadded(imp, q)),
1231
+ classes: await q.receiveListDefined(cu.classes, cls => this.visit(cls, q)),
1232
+ eof: await q.receive(cu.eof, space => this.visitSpace(space, q))
1233
+ };
1234
+ return (0, util_1.updateIfChanged)(cu, updates);
1235
+ }
1236
+ async visitPackage(pkg, q) {
1237
+ const updates = {
1238
+ expression: await q.receive(pkg.expression, expr => this.visit(expr, q)),
1239
+ annotations: await q.receiveListDefined(pkg.annotations, annot => this.visit(annot, q))
1240
+ };
1241
+ return (0, util_1.updateIfChanged)(pkg, updates);
1242
+ }
1243
+ async visitClassDeclaration(cls, q) {
1244
+ const updates = {
1245
+ leadingAnnotations: await q.receiveListDefined(cls.leadingAnnotations, annot => this.visit(annot, q)),
1246
+ modifiers: await q.receiveListDefined(cls.modifiers, mod => this.visit(mod, q)),
1247
+ classKind: await q.receive(cls.classKind, kind => this.visit(kind, q)),
1248
+ name: await q.receive(cls.name, name => this.visit(name, q)),
1249
+ typeParameters: await q.receive(cls.typeParameters, params => this.visitContainer(params, q)),
1250
+ primaryConstructor: await q.receive(cls.primaryConstructor, cons => this.visitContainer(cons, q)),
1251
+ extends: await q.receive(cls.extends, ext => this.visitLeftPadded(ext, q)),
1252
+ implements: await q.receive(cls.implements, impl => this.visitContainer(impl, q)),
1253
+ permitting: await q.receive(cls.permitting, perm => this.visitContainer(perm, q)),
1254
+ body: await q.receive(cls.body, body => this.visit(body, q))
1255
+ };
1256
+ return (0, util_1.updateIfChanged)(cls, updates);
1257
+ }
1258
+ async visitClassDeclarationKind(kind, q) {
1259
+ const updates = {
1260
+ annotations: await q.receiveListDefined(kind.annotations, annot => this.visit(annot, q)),
1261
+ type: await q.receive(kind.type)
1262
+ };
1263
+ return (0, util_1.updateIfChanged)(kind, updates);
1264
+ }
1265
+ async visitBlock(block, q) {
1266
+ const updates = {
1267
+ static: await q.receive(block.static, s => this.visitRightPadded(s, q)),
1268
+ statements: await q.receiveListDefined(block.statements, stmt => this.visitRightPadded(stmt, q)),
1269
+ end: await q.receive(block.end, space => this.visitSpace(space, q))
1270
+ };
1271
+ return (0, util_1.updateIfChanged)(block, updates);
1272
+ }
1273
+ async visitMethodDeclaration(method, q) {
1274
+ const updates = {
1275
+ leadingAnnotations: await q.receiveListDefined(method.leadingAnnotations, annot => this.visit(annot, q)),
1276
+ modifiers: await q.receiveListDefined(method.modifiers, mod => this.visit(mod, q)),
1277
+ typeParameters: await q.receive(method.typeParameters, params => this.visit(params, q)),
1278
+ returnTypeExpression: await q.receive(method.returnTypeExpression, type => this.visit(type, q)),
1279
+ nameAnnotations: (await q.receiveList(method.nameAnnotations, name => this.visit(name, q))),
1280
+ name: await q.receive(method.name, name => this.visit(name, q)),
1281
+ parameters: await q.receive(method.parameters, params => this.visitContainer(params, q)),
1282
+ throws: await q.receive(method.throws, throws => this.visitContainer(throws, q)),
1283
+ body: await q.receive(method.body, body => this.visit(body, q)),
1284
+ defaultValue: await q.receive(method.defaultValue, def => this.visitLeftPadded(def, q)),
1285
+ methodType: await q.receive(method.methodType, type => this.visitType(type, q))
1286
+ };
1287
+ return (0, util_1.updateIfChanged)(method, updates);
1288
+ }
1289
+ async visitVariableDeclarations(varDecls, q) {
1290
+ const updates = {
1291
+ leadingAnnotations: await q.receiveListDefined(varDecls.leadingAnnotations, annot => this.visit(annot, q)),
1292
+ modifiers: await q.receiveListDefined(varDecls.modifiers, mod => this.visit(mod, q)),
1293
+ typeExpression: await q.receive(varDecls.typeExpression, type => this.visit(type, q)),
1294
+ varargs: await q.receive(varDecls.varargs, space => this.visitSpace(space, q)),
1295
+ variables: await q.receiveListDefined(varDecls.variables, variable => this.visitRightPadded(variable, q))
1296
+ };
1297
+ return (0, util_1.updateIfChanged)(varDecls, updates);
1298
+ }
1299
+ async visitIdentifier(ident, q) {
1300
+ const updates = {
1301
+ annotations: await q.receiveListDefined(ident.annotations, annot => this.visit(annot, q)),
1302
+ simpleName: await q.receive(ident.simpleName),
1303
+ type: await q.receive(ident.type, type => this.visitType(type, q)),
1304
+ fieldType: await q.receive(ident.fieldType, type => this.visitType(type, q))
1305
+ };
1306
+ return (0, util_1.updateIfChanged)(ident, updates);
1307
+ }
1308
+ async visitSpace(space, q) {
1309
+ const updates = {
1310
+ comments: await q.receiveListDefined(space.comments, async (c) => {
1311
+ if (c.kind === tree_1.J.Kind.TextComment) {
1312
+ const tc = c;
1313
+ const commentUpdates = {
1314
+ multiline: await q.receive(tc.multiline),
1315
+ text: await q.receive(tc.text),
1316
+ suffix: await q.receive(c.suffix),
1317
+ markers: await q.receive(c.markers)
1318
+ };
1319
+ return (0, util_1.updateIfChanged)(tc, commentUpdates);
1320
+ }
1321
+ else {
1322
+ throw new Error(`Unexpected comment type ${c.kind}`);
1323
+ }
1324
+ }),
1325
+ whitespace: await q.receive(space.whitespace)
1326
+ };
1327
+ return (0, util_1.updateIfChanged)(space, updates);
1328
+ }
1329
+ async visitLeftPadded(left, q) {
1330
+ if (!left) {
1331
+ throw new Error("TreeDataReceiveQueue should have instantiated an empty left padding");
1332
+ }
1333
+ const updates = {
1334
+ before: await q.receive(left.before, space => this.visitSpace(space, q)),
1335
+ element: await q.receive(left.element, elem => {
1336
+ if ((0, tree_1.isSpace)(elem)) {
1337
+ return this.visitSpace(elem, q);
1338
+ }
1339
+ else if (typeof elem === 'object' && elem.kind) {
1340
+ // FIXME find a better way to check if it is a `Tree`
1341
+ return this.visit(elem, q);
1342
+ }
1343
+ return elem;
1344
+ }),
1345
+ markers: await q.receive(left.markers)
1346
+ };
1347
+ return (0, util_1.updateIfChanged)(left, updates);
1348
+ }
1349
+ async visitRightPadded(right, q) {
1350
+ if (!right) {
1351
+ throw new Error("TreeDataReceiveQueue should have instantiated an empty right padding");
1352
+ }
1353
+ const updates = {
1354
+ element: await q.receive(right.element, elem => {
1355
+ if ((0, tree_1.isSpace)(elem)) {
1356
+ return this.visitSpace(elem, q);
1357
+ }
1358
+ else if (typeof elem === 'object' && elem.kind) {
1359
+ // FIXME find a better way to check if it is a `Tree`
1360
+ return this.visit(elem, q);
1361
+ }
1362
+ return elem;
1363
+ }),
1364
+ after: await q.receive(right.after, space => this.visitSpace(space, q)),
1365
+ markers: await q.receive(right.markers)
1366
+ };
1367
+ return (0, util_1.updateIfChanged)(right, updates);
1368
+ }
1369
+ async visitContainer(container, q) {
1370
+ const updates = {
1371
+ before: await q.receive(container.before, space => this.visitSpace(space, q)),
1372
+ elements: await q.receiveListDefined(container.elements, elem => this.visitRightPadded(elem, q)),
1373
+ markers: await q.receive(container.markers)
1374
+ };
1375
+ return (0, util_1.updateIfChanged)(container, updates);
1376
+ }
1377
+ async visitType(javaType, q) {
1378
+ if (!javaType) {
1379
+ return undefined;
1380
+ }
1381
+ else if (javaType.kind === type_1.Type.Kind.Unknown) {
1382
+ return type_1.Type.unknownType;
1383
+ }
1384
+ return await this.typeVisitor.visit(javaType, q);
1746
1385
  }
1747
1386
  }
1748
1387
  exports.JavaReceiver = JavaReceiver;
@@ -1755,71 +1394,51 @@ function registerJLanguageCodecs(sourceFileType, receiver, sender, extendedKinds
1755
1394
  for (const kind of kinds) {
1756
1395
  if (kind === tree_1.J.Kind.Space) {
1757
1396
  rpc_1.RpcCodecs.registerCodec(kind, {
1758
- rpcReceive(before, q) {
1759
- return __awaiter(this, void 0, void 0, function* () {
1760
- return (yield receiver.visitSpace(before, q));
1761
- });
1397
+ async rpcReceive(before, q) {
1398
+ return (await receiver.visitSpace(before, q));
1762
1399
  },
1763
- rpcSend(after, q) {
1764
- return __awaiter(this, void 0, void 0, function* () {
1765
- yield sender.visitSpace(after, q);
1766
- });
1400
+ async rpcSend(after, q) {
1401
+ await sender.visitSpace(after, q);
1767
1402
  }
1768
1403
  }, sourceFileType);
1769
1404
  }
1770
1405
  else if (kind === tree_1.J.Kind.RightPadded) {
1771
1406
  rpc_1.RpcCodecs.registerCodec(kind, {
1772
- rpcReceive(before, q) {
1773
- return __awaiter(this, void 0, void 0, function* () {
1774
- return (yield receiver.visitRightPadded(before, q));
1775
- });
1407
+ async rpcReceive(before, q) {
1408
+ return (await receiver.visitRightPadded(before, q));
1776
1409
  },
1777
- rpcSend(after, q) {
1778
- return __awaiter(this, void 0, void 0, function* () {
1779
- yield sender.visitRightPadded(after, q);
1780
- });
1410
+ async rpcSend(after, q) {
1411
+ await sender.visitRightPadded(after, q);
1781
1412
  }
1782
1413
  }, sourceFileType);
1783
1414
  }
1784
1415
  else if (kind === tree_1.J.Kind.LeftPadded) {
1785
1416
  rpc_1.RpcCodecs.registerCodec(kind, {
1786
- rpcReceive(before, q) {
1787
- return __awaiter(this, void 0, void 0, function* () {
1788
- return (yield receiver.visitLeftPadded(before, q));
1789
- });
1417
+ async rpcReceive(before, q) {
1418
+ return (await receiver.visitLeftPadded(before, q));
1790
1419
  },
1791
- rpcSend(after, q) {
1792
- return __awaiter(this, void 0, void 0, function* () {
1793
- yield sender.visitLeftPadded(after, q);
1794
- });
1420
+ async rpcSend(after, q) {
1421
+ await sender.visitLeftPadded(after, q);
1795
1422
  }
1796
1423
  }, sourceFileType);
1797
1424
  }
1798
1425
  else if (kind === tree_1.J.Kind.Container) {
1799
1426
  rpc_1.RpcCodecs.registerCodec(kind, {
1800
- rpcReceive(before, q) {
1801
- return __awaiter(this, void 0, void 0, function* () {
1802
- return (yield receiver.visitContainer(before, q));
1803
- });
1427
+ async rpcReceive(before, q) {
1428
+ return (await receiver.visitContainer(before, q));
1804
1429
  },
1805
- rpcSend(after, q) {
1806
- return __awaiter(this, void 0, void 0, function* () {
1807
- yield sender.visitContainer(after, q);
1808
- });
1430
+ async rpcSend(after, q) {
1431
+ await sender.visitContainer(after, q);
1809
1432
  }
1810
1433
  }, sourceFileType);
1811
1434
  }
1812
1435
  else {
1813
1436
  rpc_1.RpcCodecs.registerCodec(kind, {
1814
- rpcReceive(before, q) {
1815
- return __awaiter(this, void 0, void 0, function* () {
1816
- return (yield receiver.visit(before, q));
1817
- });
1437
+ async rpcReceive(before, q) {
1438
+ return (await receiver.visit(before, q));
1818
1439
  },
1819
- rpcSend(after, q) {
1820
- return __awaiter(this, void 0, void 0, function* () {
1821
- yield sender.visit(after, q);
1822
- });
1440
+ async rpcSend(after, q) {
1441
+ await sender.visit(after, q);
1823
1442
  }
1824
1443
  }, sourceFileType);
1825
1444
  }