@openrewrite/rewrite 0.22.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,6 +91,15 @@ class Visitor extends __1.JavaScriptVisitor {
91
91
  await = await.withType(ctx.receiveValue(await.type, 5));
92
92
  return await;
93
93
  }
94
+ visitConditionalType(conditionalType, ctx) {
95
+ conditionalType = conditionalType.withId(ctx.receiveValue(conditionalType.id, 0));
96
+ conditionalType = conditionalType.withPrefix(ctx.receiveNode(conditionalType.prefix, receiveSpace));
97
+ conditionalType = conditionalType.withMarkers(ctx.receiveNode(conditionalType.markers, ctx.receiveMarkers));
98
+ conditionalType = conditionalType.withCheckType(ctx.receiveNode(conditionalType.checkType, ctx.receiveTree));
99
+ conditionalType = conditionalType.padding.withCondition(ctx.receiveNode(conditionalType.padding.condition, receiveContainer));
100
+ conditionalType = conditionalType.withType(ctx.receiveValue(conditionalType.type, 5));
101
+ return conditionalType;
102
+ }
94
103
  visitDefaultType(defaultType, ctx) {
95
104
  defaultType = defaultType.withId(ctx.receiveValue(defaultType.id, 0));
96
105
  defaultType = defaultType.withPrefix(ctx.receiveNode(defaultType.prefix, receiveSpace));
@@ -124,6 +133,15 @@ class Visitor extends __1.JavaScriptVisitor {
124
133
  expressionStatement = expressionStatement.withExpression(ctx.receiveNode(expressionStatement.expression, ctx.receiveTree));
125
134
  return expressionStatement;
126
135
  }
136
+ visitExpressionWithTypeArguments(expressionWithTypeArguments, ctx) {
137
+ expressionWithTypeArguments = expressionWithTypeArguments.withId(ctx.receiveValue(expressionWithTypeArguments.id, 0));
138
+ expressionWithTypeArguments = expressionWithTypeArguments.withPrefix(ctx.receiveNode(expressionWithTypeArguments.prefix, receiveSpace));
139
+ expressionWithTypeArguments = expressionWithTypeArguments.withMarkers(ctx.receiveNode(expressionWithTypeArguments.markers, ctx.receiveMarkers));
140
+ expressionWithTypeArguments = expressionWithTypeArguments.withClazz(ctx.receiveNode(expressionWithTypeArguments.clazz, ctx.receiveTree));
141
+ expressionWithTypeArguments = expressionWithTypeArguments.padding.withTypeArguments(ctx.receiveNode(expressionWithTypeArguments.padding.typeArguments, receiveContainer));
142
+ expressionWithTypeArguments = expressionWithTypeArguments.withType(ctx.receiveValue(expressionWithTypeArguments.type, 5));
143
+ return expressionWithTypeArguments;
144
+ }
127
145
  visitFunctionType(functionType, ctx) {
128
146
  functionType = functionType.withId(ctx.receiveValue(functionType.id, 0));
129
147
  functionType = functionType.withPrefix(ctx.receiveNode(functionType.prefix, receiveSpace));
@@ -199,24 +217,32 @@ class Visitor extends __1.JavaScriptVisitor {
199
217
  statementExpression = statementExpression.withStatement(ctx.receiveNode(statementExpression.statement, ctx.receiveTree));
200
218
  return statementExpression;
201
219
  }
220
+ visitTaggedTemplateExpression(taggedTemplateExpression, ctx) {
221
+ taggedTemplateExpression = taggedTemplateExpression.withId(ctx.receiveValue(taggedTemplateExpression.id, 0));
222
+ taggedTemplateExpression = taggedTemplateExpression.withPrefix(ctx.receiveNode(taggedTemplateExpression.prefix, receiveSpace));
223
+ taggedTemplateExpression = taggedTemplateExpression.withMarkers(ctx.receiveNode(taggedTemplateExpression.markers, ctx.receiveMarkers));
224
+ taggedTemplateExpression = taggedTemplateExpression.padding.withTag(ctx.receiveNode(taggedTemplateExpression.padding.tag, receiveRightPaddedTree));
225
+ taggedTemplateExpression = taggedTemplateExpression.padding.withTypeArguments(ctx.receiveNode(taggedTemplateExpression.padding.typeArguments, receiveContainer));
226
+ taggedTemplateExpression = taggedTemplateExpression.withTemplateExpression(ctx.receiveNode(taggedTemplateExpression.templateExpression, ctx.receiveTree));
227
+ taggedTemplateExpression = taggedTemplateExpression.withType(ctx.receiveValue(taggedTemplateExpression.type, 5));
228
+ return taggedTemplateExpression;
229
+ }
202
230
  visitTemplateExpression(templateExpression, ctx) {
203
231
  templateExpression = templateExpression.withId(ctx.receiveValue(templateExpression.id, 0));
204
232
  templateExpression = templateExpression.withPrefix(ctx.receiveNode(templateExpression.prefix, receiveSpace));
205
233
  templateExpression = templateExpression.withMarkers(ctx.receiveNode(templateExpression.markers, ctx.receiveMarkers));
206
- templateExpression = templateExpression.withDelimiter(ctx.receiveValue(templateExpression.delimiter, 1));
207
- templateExpression = templateExpression.padding.withTag(ctx.receiveNode(templateExpression.padding.tag, receiveRightPaddedTree));
208
- templateExpression = templateExpression.withStrings(ctx.receiveNodes(templateExpression.strings, ctx.receiveTree));
234
+ templateExpression = templateExpression.withHead(ctx.receiveNode(templateExpression.head, ctx.receiveTree));
235
+ templateExpression = templateExpression.padding.withTemplateSpans(ctx.receiveNodes(templateExpression.padding.templateSpans, receiveRightPaddedTree));
209
236
  templateExpression = templateExpression.withType(ctx.receiveValue(templateExpression.type, 5));
210
237
  return templateExpression;
211
238
  }
212
- visitTemplateExpressionValue(value, ctx) {
213
- value = value.withId(ctx.receiveValue(value.id, 0));
214
- value = value.withPrefix(ctx.receiveNode(value.prefix, receiveSpace));
215
- value = value.withMarkers(ctx.receiveNode(value.markers, ctx.receiveMarkers));
216
- value = value.withTree(ctx.receiveNode(value.tree, ctx.receiveTree));
217
- value = value.withAfter(ctx.receiveNode(value.after, receiveSpace));
218
- value = value.withEnclosedInBraces(ctx.receiveValue(value.enclosedInBraces, 1));
219
- return value;
239
+ visitTemplateExpressionTemplateSpan(templateSpan, ctx) {
240
+ templateSpan = templateSpan.withId(ctx.receiveValue(templateSpan.id, 0));
241
+ templateSpan = templateSpan.withPrefix(ctx.receiveNode(templateSpan.prefix, receiveSpace));
242
+ templateSpan = templateSpan.withMarkers(ctx.receiveNode(templateSpan.markers, ctx.receiveMarkers));
243
+ templateSpan = templateSpan.withExpression(ctx.receiveNode(templateSpan.expression, ctx.receiveTree));
244
+ templateSpan = templateSpan.withTail(ctx.receiveNode(templateSpan.tail, ctx.receiveTree));
245
+ return templateSpan;
220
246
  }
221
247
  visitTuple(tuple, ctx) {
222
248
  tuple = tuple.withId(ctx.receiveValue(tuple.id, 0));
@@ -231,7 +257,7 @@ class Visitor extends __1.JavaScriptVisitor {
231
257
  typeDeclaration = typeDeclaration.withPrefix(ctx.receiveNode(typeDeclaration.prefix, receiveSpace));
232
258
  typeDeclaration = typeDeclaration.withMarkers(ctx.receiveNode(typeDeclaration.markers, ctx.receiveMarkers));
233
259
  typeDeclaration = typeDeclaration.withModifiers(ctx.receiveNodes(typeDeclaration.modifiers, ctx.receiveTree));
234
- typeDeclaration = typeDeclaration.withName(ctx.receiveNode(typeDeclaration.name, ctx.receiveTree));
260
+ typeDeclaration = typeDeclaration.padding.withName(ctx.receiveNode(typeDeclaration.padding.name, receiveLeftPaddedTree));
235
261
  typeDeclaration = typeDeclaration.withTypeParameters(ctx.receiveNode(typeDeclaration.typeParameters, ctx.receiveTree));
236
262
  typeDeclaration = typeDeclaration.padding.withInitializer(ctx.receiveNode(typeDeclaration.padding.initializer, receiveLeftPaddedTree));
237
263
  typeDeclaration = typeDeclaration.withType(ctx.receiveValue(typeDeclaration.type, 5));
@@ -346,17 +372,6 @@ class Visitor extends __1.JavaScriptVisitor {
346
372
  jSMethodDeclaration = jSMethodDeclaration.withMethodType(ctx.receiveValue(jSMethodDeclaration.methodType, 5));
347
373
  return jSMethodDeclaration;
348
374
  }
349
- visitJSMethodInvocation(jSMethodInvocation, ctx) {
350
- jSMethodInvocation = jSMethodInvocation.withId(ctx.receiveValue(jSMethodInvocation.id, 0));
351
- jSMethodInvocation = jSMethodInvocation.withPrefix(ctx.receiveNode(jSMethodInvocation.prefix, receiveSpace));
352
- jSMethodInvocation = jSMethodInvocation.withMarkers(ctx.receiveNode(jSMethodInvocation.markers, ctx.receiveMarkers));
353
- jSMethodInvocation = jSMethodInvocation.padding.withSelect(ctx.receiveNode(jSMethodInvocation.padding.select, receiveRightPaddedTree));
354
- jSMethodInvocation = jSMethodInvocation.padding.withTypeParameters(ctx.receiveNode(jSMethodInvocation.padding.typeParameters, receiveContainer));
355
- jSMethodInvocation = jSMethodInvocation.withName(ctx.receiveNode(jSMethodInvocation.name, ctx.receiveTree));
356
- jSMethodInvocation = jSMethodInvocation.padding.withArguments(ctx.receiveNode(jSMethodInvocation.padding.arguments, receiveContainer));
357
- jSMethodInvocation = jSMethodInvocation.withMethodType(ctx.receiveValue(jSMethodInvocation.methodType, 5));
358
- return jSMethodInvocation;
359
- }
360
375
  visitJSForOfLoop(jSForOfLoop, ctx) {
361
376
  jSForOfLoop = jSForOfLoop.withId(ctx.receiveValue(jSForOfLoop.id, 0));
362
377
  jSForOfLoop = jSForOfLoop.withPrefix(ctx.receiveNode(jSForOfLoop.prefix, receiveSpace));
@@ -1054,6 +1069,9 @@ class Factory {
1054
1069
  if (type === "org.openrewrite.javascript.tree.JS$Await") {
1055
1070
  return new tree_1.Await(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveValue(null, 5));
1056
1071
  }
1072
+ if (type === "org.openrewrite.javascript.tree.JS$ConditionalType") {
1073
+ return new tree_1.ConditionalType(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveContainer), ctx.receiveValue(null, 5));
1074
+ }
1057
1075
  if (type === "org.openrewrite.javascript.tree.JS$DefaultType") {
1058
1076
  return new tree_1.DefaultType(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveValue(null, 5));
1059
1077
  }
@@ -1066,6 +1084,9 @@ class Factory {
1066
1084
  if (type === "org.openrewrite.javascript.tree.JS$ExpressionStatement") {
1067
1085
  return new tree_1.ExpressionStatement(ctx.receiveValue(null, 0), ctx.receiveNode(null, ctx.receiveTree));
1068
1086
  }
1087
+ if (type === "org.openrewrite.javascript.tree.JS$ExpressionWithTypeArguments") {
1088
+ return new tree_1.ExpressionWithTypeArguments(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveContainer), ctx.receiveValue(null, 5));
1089
+ }
1069
1090
  if (type === "org.openrewrite.javascript.tree.JS$FunctionType") {
1070
1091
  return new tree_1.FunctionType(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, rightPaddedValueReceiver(1)), ctx.receiveNode(null, receiveContainer), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveValue(null, 5));
1071
1092
  }
@@ -1090,17 +1111,20 @@ class Factory {
1090
1111
  if (type === "org.openrewrite.javascript.tree.JS$StatementExpression") {
1091
1112
  return new tree_1.StatementExpression(ctx.receiveValue(null, 0), ctx.receiveNode(null, ctx.receiveTree));
1092
1113
  }
1114
+ if (type === "org.openrewrite.javascript.tree.JS$TaggedTemplateExpression") {
1115
+ return new tree_1.TaggedTemplateExpression(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, receiveRightPaddedTree), ctx.receiveNode(null, receiveContainer), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveValue(null, 5));
1116
+ }
1093
1117
  if (type === "org.openrewrite.javascript.tree.JS$TemplateExpression") {
1094
- return new tree_1.TemplateExpression(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveValue(null, 1), ctx.receiveNode(null, receiveRightPaddedTree), ctx.receiveNodes(null, ctx.receiveTree), ctx.receiveValue(null, 5));
1118
+ return new tree_1.TemplateExpression(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNodes(null, receiveRightPaddedTree), ctx.receiveValue(null, 5));
1095
1119
  }
1096
- if (type === "org.openrewrite.javascript.tree.JS$TemplateExpression$Value") {
1097
- return new tree_1.TemplateExpression.Value(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveSpace), ctx.receiveValue(null, 1));
1120
+ if (type === "org.openrewrite.javascript.tree.JS$TemplateExpression$TemplateSpan") {
1121
+ return new tree_1.TemplateExpression.TemplateSpan(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, ctx.receiveTree));
1098
1122
  }
1099
1123
  if (type === "org.openrewrite.javascript.tree.JS$Tuple") {
1100
1124
  return new tree_1.Tuple(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, receiveContainer), ctx.receiveValue(null, 5));
1101
1125
  }
1102
1126
  if (type === "org.openrewrite.javascript.tree.JS$TypeDeclaration") {
1103
- return new tree_1.TypeDeclaration(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNodes(null, ctx.receiveTree), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveLeftPaddedTree), ctx.receiveValue(null, 5));
1127
+ return new tree_1.TypeDeclaration(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNodes(null, ctx.receiveTree), ctx.receiveNode(null, receiveLeftPaddedTree), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveLeftPaddedTree), ctx.receiveValue(null, 5));
1104
1128
  }
1105
1129
  if (type === "org.openrewrite.javascript.tree.JS$TypeOf") {
1106
1130
  return new tree_1.TypeOf(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveValue(null, 5));
@@ -1138,9 +1162,6 @@ class Factory {
1138
1162
  if (type === "org.openrewrite.javascript.tree.JS$JSMethodDeclaration") {
1139
1163
  return new tree_1.JSMethodDeclaration(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNodes(null, ctx.receiveTree), ctx.receiveNodes(null, ctx.receiveTree), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveContainer), ctx.receiveNode(null, receiveContainer), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveLeftPaddedTree), ctx.receiveValue(null, 5));
1140
1164
  }
1141
- if (type === "org.openrewrite.javascript.tree.JS$JSMethodInvocation") {
1142
- return new tree_1.JSMethodInvocation(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, receiveRightPaddedTree), ctx.receiveNode(null, receiveContainer), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveContainer), ctx.receiveValue(null, 5));
1143
- }
1144
1165
  if (type === "org.openrewrite.javascript.tree.JS$JSForOfLoop") {
1145
1166
  return new tree_1.JSForOfLoop(ctx.receiveValue(null, 0), ctx.receiveNode(null, receiveSpace), ctx.receiveNode(null, ctx.receiveMarkers), ctx.receiveNode(null, leftPaddedValueReceiver(1)), ctx.receiveNode(null, ctx.receiveTree), ctx.receiveNode(null, receiveRightPaddedTree));
1146
1167
  }