@openrewrite/rewrite 8.66.0-SNAPSHOT → 8.67.0-20251103-160333
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/javascript/comparator.d.ts +24 -1
- package/dist/javascript/comparator.d.ts.map +1 -1
- package/dist/javascript/comparator.js +532 -673
- package/dist/javascript/comparator.js.map +1 -1
- package/dist/javascript/parser.d.ts.map +1 -1
- package/dist/javascript/parser.js +4 -5
- package/dist/javascript/parser.js.map +1 -1
- package/dist/javascript/print.d.ts +2 -2
- package/dist/javascript/print.d.ts.map +1 -1
- package/dist/javascript/print.js +4 -4
- package/dist/javascript/print.js.map +1 -1
- package/dist/javascript/templating.d.ts.map +1 -1
- package/dist/javascript/templating.js +111 -153
- package/dist/javascript/templating.js.map +1 -1
- package/dist/test/rewrite-test.d.ts.map +1 -1
- package/dist/test/rewrite-test.js +65 -9
- package/dist/test/rewrite-test.js.map +1 -1
- package/dist/version.txt +1 -1
- package/package.json +1 -2
- package/src/javascript/comparator.ts +553 -670
- package/src/javascript/parser.ts +4 -5
- package/src/javascript/print.ts +6 -6
- package/src/javascript/templating.ts +110 -161
- package/src/test/rewrite-test.ts +65 -1
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.JavaScriptComparatorVisitor = void 0;
|
|
12
|
+
exports.JavaScriptSemanticComparatorVisitor = exports.JavaScriptComparatorVisitor = void 0;
|
|
13
13
|
/*
|
|
14
14
|
* Copyright 2025 the original author or authors.
|
|
15
15
|
* <p>
|
|
@@ -71,8 +71,9 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
71
71
|
/**
|
|
72
72
|
* Aborts the visit operation by setting the match flag to false.
|
|
73
73
|
*/
|
|
74
|
-
abort() {
|
|
74
|
+
abort(t) {
|
|
75
75
|
this.match = false;
|
|
76
|
+
return t;
|
|
76
77
|
}
|
|
77
78
|
visit(j, p, parent) {
|
|
78
79
|
const _super = Object.create(null, {
|
|
@@ -85,8 +86,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
85
86
|
}
|
|
86
87
|
// Check if the nodes have the same kind
|
|
87
88
|
if (!this.hasSameKind(j, p)) {
|
|
88
|
-
this.abort();
|
|
89
|
-
return j;
|
|
89
|
+
return this.abort(j);
|
|
90
90
|
}
|
|
91
91
|
// Continue with normal visitation, passing the other node as context
|
|
92
92
|
return _super.visit.call(this, j, p);
|
|
@@ -102,18 +102,16 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
102
102
|
visitBinary(binary, other) {
|
|
103
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
104
|
if (!this.match || other.kind !== java_1.J.Kind.Binary) {
|
|
105
|
-
this.abort();
|
|
106
|
-
return binary;
|
|
105
|
+
return this.abort(binary);
|
|
107
106
|
}
|
|
108
107
|
const otherBinary = other;
|
|
109
108
|
if (binary.operator.element !== otherBinary.operator.element) {
|
|
110
|
-
this.abort();
|
|
111
|
-
return binary;
|
|
109
|
+
return this.abort(binary);
|
|
112
110
|
}
|
|
113
111
|
// Visit left and right operands in lock step
|
|
114
112
|
yield this.visit(binary.left, otherBinary.left);
|
|
115
113
|
if (!this.match)
|
|
116
|
-
return binary;
|
|
114
|
+
return this.abort(binary);
|
|
117
115
|
yield this.visit(binary.right, otherBinary.right);
|
|
118
116
|
return binary;
|
|
119
117
|
});
|
|
@@ -128,12 +126,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
128
126
|
visitIdentifier(identifier, other) {
|
|
129
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
128
|
if (!this.match || other.kind !== java_1.J.Kind.Identifier) {
|
|
131
|
-
this.abort();
|
|
132
|
-
return identifier;
|
|
129
|
+
return this.abort(identifier);
|
|
133
130
|
}
|
|
134
131
|
const otherIdentifier = other;
|
|
135
132
|
if (identifier.simpleName !== otherIdentifier.simpleName) {
|
|
136
|
-
this.abort();
|
|
133
|
+
return this.abort(identifier);
|
|
137
134
|
}
|
|
138
135
|
return identifier;
|
|
139
136
|
});
|
|
@@ -148,12 +145,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
148
145
|
visitLiteral(literal, other) {
|
|
149
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
147
|
if (!this.match || other.kind !== java_1.J.Kind.Literal) {
|
|
151
|
-
this.abort();
|
|
152
|
-
return literal;
|
|
148
|
+
return this.abort(literal);
|
|
153
149
|
}
|
|
154
150
|
const otherLiteral = other;
|
|
155
151
|
if (literal.valueSource !== otherLiteral.valueSource) {
|
|
156
|
-
this.abort();
|
|
152
|
+
return this.abort(literal);
|
|
157
153
|
}
|
|
158
154
|
return literal;
|
|
159
155
|
});
|
|
@@ -168,19 +164,18 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
168
164
|
visitBlock(block, other) {
|
|
169
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
170
166
|
if (!this.match || other.kind !== java_1.J.Kind.Block) {
|
|
171
|
-
this.abort();
|
|
172
|
-
return block;
|
|
167
|
+
return this.abort(block);
|
|
173
168
|
}
|
|
174
169
|
const otherBlock = other;
|
|
175
170
|
if (block.statements.length !== otherBlock.statements.length) {
|
|
176
|
-
this.abort();
|
|
177
|
-
return block;
|
|
171
|
+
return this.abort(block);
|
|
178
172
|
}
|
|
179
173
|
// Visit each statement in lock step
|
|
180
174
|
for (let i = 0; i < block.statements.length; i++) {
|
|
181
175
|
yield this.visit(block.statements[i].element, otherBlock.statements[i].element);
|
|
182
|
-
if (!this.match)
|
|
183
|
-
|
|
176
|
+
if (!this.match) {
|
|
177
|
+
return this.abort(block);
|
|
178
|
+
}
|
|
184
179
|
}
|
|
185
180
|
return block;
|
|
186
181
|
});
|
|
@@ -195,19 +190,18 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
195
190
|
visitJsCompilationUnit(compilationUnit, other) {
|
|
196
191
|
return __awaiter(this, void 0, void 0, function* () {
|
|
197
192
|
if (!this.match || other.kind !== tree_1.JS.Kind.CompilationUnit) {
|
|
198
|
-
this.abort();
|
|
199
|
-
return compilationUnit;
|
|
193
|
+
return this.abort(compilationUnit);
|
|
200
194
|
}
|
|
201
195
|
const otherCompilationUnit = other;
|
|
202
196
|
if (compilationUnit.statements.length !== otherCompilationUnit.statements.length) {
|
|
203
|
-
this.abort();
|
|
204
|
-
return compilationUnit;
|
|
197
|
+
return this.abort(compilationUnit);
|
|
205
198
|
}
|
|
206
199
|
// Visit each statement in lock step
|
|
207
200
|
for (let i = 0; i < compilationUnit.statements.length; i++) {
|
|
208
201
|
yield this.visit(compilationUnit.statements[i].element, otherCompilationUnit.statements[i].element);
|
|
209
|
-
if (!this.match)
|
|
210
|
-
|
|
202
|
+
if (!this.match) {
|
|
203
|
+
return this.abort(compilationUnit);
|
|
204
|
+
}
|
|
211
205
|
}
|
|
212
206
|
return compilationUnit;
|
|
213
207
|
});
|
|
@@ -222,14 +216,14 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
222
216
|
visitAlias(alias, other) {
|
|
223
217
|
return __awaiter(this, void 0, void 0, function* () {
|
|
224
218
|
if (!this.match || other.kind !== tree_1.JS.Kind.Alias) {
|
|
225
|
-
this.abort();
|
|
226
|
-
return alias;
|
|
219
|
+
return this.abort(alias);
|
|
227
220
|
}
|
|
228
221
|
const otherAlias = other;
|
|
229
222
|
// Visit property name and alias in lock step
|
|
230
223
|
yield this.visit(alias.propertyName.element, otherAlias.propertyName.element);
|
|
231
|
-
if (!this.match)
|
|
232
|
-
return alias;
|
|
224
|
+
if (!this.match) {
|
|
225
|
+
return this.abort(alias);
|
|
226
|
+
}
|
|
233
227
|
yield this.visit(alias.alias, otherAlias.alias);
|
|
234
228
|
return alias;
|
|
235
229
|
});
|
|
@@ -244,14 +238,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
244
238
|
visitArrowFunction(arrowFunction, other) {
|
|
245
239
|
return __awaiter(this, void 0, void 0, function* () {
|
|
246
240
|
if (!this.match || other.kind !== tree_1.JS.Kind.ArrowFunction) {
|
|
247
|
-
this.abort();
|
|
248
|
-
return arrowFunction;
|
|
241
|
+
return this.abort(arrowFunction);
|
|
249
242
|
}
|
|
250
243
|
const otherArrowFunction = other;
|
|
251
244
|
// Compare modifiers
|
|
252
245
|
if (arrowFunction.modifiers.length !== otherArrowFunction.modifiers.length) {
|
|
253
|
-
this.abort();
|
|
254
|
-
return arrowFunction;
|
|
246
|
+
return this.abort(arrowFunction);
|
|
255
247
|
}
|
|
256
248
|
// Visit modifiers in lock step
|
|
257
249
|
for (let i = 0; i < arrowFunction.modifiers.length; i++) {
|
|
@@ -261,8 +253,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
261
253
|
}
|
|
262
254
|
// Visit type parameters if present
|
|
263
255
|
if (!!arrowFunction.typeParameters !== !!otherArrowFunction.typeParameters) {
|
|
264
|
-
this.abort();
|
|
265
|
-
return arrowFunction;
|
|
256
|
+
return this.abort(arrowFunction);
|
|
266
257
|
}
|
|
267
258
|
if (arrowFunction.typeParameters) {
|
|
268
259
|
yield this.visit(arrowFunction.typeParameters, otherArrowFunction.typeParameters);
|
|
@@ -275,8 +266,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
275
266
|
return arrowFunction;
|
|
276
267
|
// Visit return type expression if present
|
|
277
268
|
if (!!arrowFunction.returnTypeExpression !== !!otherArrowFunction.returnTypeExpression) {
|
|
278
|
-
this.abort();
|
|
279
|
-
return arrowFunction;
|
|
269
|
+
return this.abort(arrowFunction);
|
|
280
270
|
}
|
|
281
271
|
if (arrowFunction.returnTypeExpression) {
|
|
282
272
|
yield this.visit(arrowFunction.returnTypeExpression, otherArrowFunction.returnTypeExpression);
|
|
@@ -294,8 +284,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
294
284
|
visitAwait(await_, other) {
|
|
295
285
|
return __awaiter(this, void 0, void 0, function* () {
|
|
296
286
|
if (!this.match || other.kind !== tree_1.JS.Kind.Await) {
|
|
297
|
-
this.abort();
|
|
298
|
-
return await_;
|
|
287
|
+
return this.abort(await_);
|
|
299
288
|
}
|
|
300
289
|
const otherAwait = other;
|
|
301
290
|
// Visit expression
|
|
@@ -313,8 +302,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
313
302
|
visitJsxTag(element, other) {
|
|
314
303
|
return __awaiter(this, void 0, void 0, function* () {
|
|
315
304
|
if (!this.match || other.kind !== tree_1.JS.Kind.JsxTag) {
|
|
316
|
-
this.abort();
|
|
317
|
-
return element;
|
|
305
|
+
return this.abort(element);
|
|
318
306
|
}
|
|
319
307
|
const otherElement = other;
|
|
320
308
|
// Visit open name
|
|
@@ -323,8 +311,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
323
311
|
return element;
|
|
324
312
|
// Compare attributes
|
|
325
313
|
if (element.attributes.length !== otherElement.attributes.length) {
|
|
326
|
-
this.abort();
|
|
327
|
-
return element;
|
|
314
|
+
return this.abort(element);
|
|
328
315
|
}
|
|
329
316
|
// Visit attributes in lock step
|
|
330
317
|
for (let i = 0; i < element.attributes.length; i++) {
|
|
@@ -334,18 +321,15 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
334
321
|
}
|
|
335
322
|
// Compare self-closing
|
|
336
323
|
if (!!element.selfClosing !== !!otherElement.selfClosing) {
|
|
337
|
-
this.abort();
|
|
338
|
-
return element;
|
|
324
|
+
return this.abort(element);
|
|
339
325
|
}
|
|
340
326
|
// Compare children
|
|
341
327
|
if (!!element.children !== !!otherElement.children) {
|
|
342
|
-
this.abort();
|
|
343
|
-
return element;
|
|
328
|
+
return this.abort(element);
|
|
344
329
|
}
|
|
345
330
|
if (element.children) {
|
|
346
331
|
if (element.children.length !== otherElement.children.length) {
|
|
347
|
-
this.abort();
|
|
348
|
-
return element;
|
|
332
|
+
return this.abort(element);
|
|
349
333
|
}
|
|
350
334
|
// Visit children in lock step
|
|
351
335
|
for (let i = 0; i < element.children.length; i++) {
|
|
@@ -356,8 +340,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
356
340
|
}
|
|
357
341
|
// Compare closing name
|
|
358
342
|
if (!!element.closingName !== !!otherElement.closingName) {
|
|
359
|
-
this.abort();
|
|
360
|
-
return element;
|
|
343
|
+
return this.abort(element);
|
|
361
344
|
}
|
|
362
345
|
if (element.closingName) {
|
|
363
346
|
yield this.visit(element.closingName.element, otherElement.closingName.element);
|
|
@@ -375,8 +358,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
375
358
|
visitJsxAttribute(attribute, other) {
|
|
376
359
|
return __awaiter(this, void 0, void 0, function* () {
|
|
377
360
|
if (!this.match || other.kind !== tree_1.JS.Kind.JsxAttribute) {
|
|
378
|
-
this.abort();
|
|
379
|
-
return attribute;
|
|
361
|
+
return this.abort(attribute);
|
|
380
362
|
}
|
|
381
363
|
const otherAttribute = other;
|
|
382
364
|
// Visit key
|
|
@@ -385,8 +367,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
385
367
|
return attribute;
|
|
386
368
|
// Compare value
|
|
387
369
|
if (!!attribute.value !== !!otherAttribute.value) {
|
|
388
|
-
this.abort();
|
|
389
|
-
return attribute;
|
|
370
|
+
return this.abort(attribute);
|
|
390
371
|
}
|
|
391
372
|
if (attribute.value) {
|
|
392
373
|
yield this.visit(attribute.value.element, otherAttribute.value.element);
|
|
@@ -404,8 +385,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
404
385
|
visitJsxSpreadAttribute(spread, other) {
|
|
405
386
|
return __awaiter(this, void 0, void 0, function* () {
|
|
406
387
|
if (!this.match || other.kind !== tree_1.JS.Kind.JsxSpreadAttribute) {
|
|
407
|
-
this.abort();
|
|
408
|
-
return spread;
|
|
388
|
+
return this.abort(spread);
|
|
409
389
|
}
|
|
410
390
|
const otherSpread = other;
|
|
411
391
|
// Visit expression
|
|
@@ -423,8 +403,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
423
403
|
visitJsxEmbeddedExpression(expr, other) {
|
|
424
404
|
return __awaiter(this, void 0, void 0, function* () {
|
|
425
405
|
if (!this.match || other.kind !== tree_1.JS.Kind.JsxEmbeddedExpression) {
|
|
426
|
-
this.abort();
|
|
427
|
-
return expr;
|
|
406
|
+
return this.abort(expr);
|
|
428
407
|
}
|
|
429
408
|
const otherExpr = other;
|
|
430
409
|
// Visit expression
|
|
@@ -442,8 +421,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
442
421
|
visitJsxNamespacedName(ns, other) {
|
|
443
422
|
return __awaiter(this, void 0, void 0, function* () {
|
|
444
423
|
if (!this.match || other.kind !== tree_1.JS.Kind.JsxNamespacedName) {
|
|
445
|
-
this.abort();
|
|
446
|
-
return ns;
|
|
424
|
+
return this.abort(ns);
|
|
447
425
|
}
|
|
448
426
|
const otherNs = other;
|
|
449
427
|
// Visit namespace
|
|
@@ -465,8 +443,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
465
443
|
visitConditionalType(conditionalType, other) {
|
|
466
444
|
return __awaiter(this, void 0, void 0, function* () {
|
|
467
445
|
if (!this.match || other.kind !== tree_1.JS.Kind.ConditionalType) {
|
|
468
|
-
this.abort();
|
|
469
|
-
return conditionalType;
|
|
446
|
+
return this.abort(conditionalType);
|
|
470
447
|
}
|
|
471
448
|
const otherConditionalType = other;
|
|
472
449
|
// Visit check type
|
|
@@ -488,8 +465,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
488
465
|
visitDelete(delete_, other) {
|
|
489
466
|
return __awaiter(this, void 0, void 0, function* () {
|
|
490
467
|
if (!this.match || other.kind !== tree_1.JS.Kind.Delete) {
|
|
491
|
-
this.abort();
|
|
492
|
-
return delete_;
|
|
468
|
+
return this.abort(delete_);
|
|
493
469
|
}
|
|
494
470
|
const otherDelete = other;
|
|
495
471
|
// Visit expression
|
|
@@ -507,8 +483,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
507
483
|
visitExpressionStatement(expressionStatement, other) {
|
|
508
484
|
return __awaiter(this, void 0, void 0, function* () {
|
|
509
485
|
if (!this.match || other.kind !== tree_1.JS.Kind.ExpressionStatement) {
|
|
510
|
-
this.abort();
|
|
511
|
-
return expressionStatement;
|
|
486
|
+
return this.abort(expressionStatement);
|
|
512
487
|
}
|
|
513
488
|
const otherExpressionStatement = other;
|
|
514
489
|
// Visit expression
|
|
@@ -526,8 +501,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
526
501
|
visitExpressionWithTypeArguments(expressionWithTypeArguments, other) {
|
|
527
502
|
return __awaiter(this, void 0, void 0, function* () {
|
|
528
503
|
if (!this.match || other.kind !== tree_1.JS.Kind.ExpressionWithTypeArguments) {
|
|
529
|
-
this.abort();
|
|
530
|
-
return expressionWithTypeArguments;
|
|
504
|
+
return this.abort(expressionWithTypeArguments);
|
|
531
505
|
}
|
|
532
506
|
const otherExpressionWithTypeArguments = other;
|
|
533
507
|
// Visit class
|
|
@@ -536,13 +510,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
536
510
|
return expressionWithTypeArguments;
|
|
537
511
|
// Compare type arguments
|
|
538
512
|
if (!!expressionWithTypeArguments.typeArguments !== !!otherExpressionWithTypeArguments.typeArguments) {
|
|
539
|
-
this.abort();
|
|
540
|
-
return expressionWithTypeArguments;
|
|
513
|
+
return this.abort(expressionWithTypeArguments);
|
|
541
514
|
}
|
|
542
515
|
if (expressionWithTypeArguments.typeArguments) {
|
|
543
516
|
if (expressionWithTypeArguments.typeArguments.elements.length !== otherExpressionWithTypeArguments.typeArguments.elements.length) {
|
|
544
|
-
this.abort();
|
|
545
|
-
return expressionWithTypeArguments;
|
|
517
|
+
return this.abort(expressionWithTypeArguments);
|
|
546
518
|
}
|
|
547
519
|
// Visit type arguments in lock step
|
|
548
520
|
for (let i = 0; i < expressionWithTypeArguments.typeArguments.elements.length; i++) {
|
|
@@ -564,14 +536,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
564
536
|
visitFunctionCall(functionCall, other) {
|
|
565
537
|
return __awaiter(this, void 0, void 0, function* () {
|
|
566
538
|
if (!this.match || other.kind !== tree_1.JS.Kind.FunctionCall) {
|
|
567
|
-
this.abort();
|
|
568
|
-
return functionCall;
|
|
539
|
+
return this.abort(functionCall);
|
|
569
540
|
}
|
|
570
541
|
const otherFunctionCall = other;
|
|
571
542
|
// Compare function
|
|
572
543
|
if ((functionCall.function === undefined) !== (otherFunctionCall.function === undefined)) {
|
|
573
|
-
this.abort();
|
|
574
|
-
return functionCall;
|
|
544
|
+
return this.abort(functionCall);
|
|
575
545
|
}
|
|
576
546
|
// Visit function if present
|
|
577
547
|
if (functionCall.function && otherFunctionCall.function) {
|
|
@@ -581,14 +551,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
581
551
|
}
|
|
582
552
|
// Compare typeParameters
|
|
583
553
|
if ((functionCall.typeParameters === undefined) !== (otherFunctionCall.typeParameters === undefined)) {
|
|
584
|
-
this.abort();
|
|
585
|
-
return functionCall;
|
|
554
|
+
return this.abort(functionCall);
|
|
586
555
|
}
|
|
587
556
|
// Visit typeParameters if present
|
|
588
557
|
if (functionCall.typeParameters && otherFunctionCall.typeParameters) {
|
|
589
558
|
if (functionCall.typeParameters.elements.length !== otherFunctionCall.typeParameters.elements.length) {
|
|
590
|
-
this.abort();
|
|
591
|
-
return functionCall;
|
|
559
|
+
return this.abort(functionCall);
|
|
592
560
|
}
|
|
593
561
|
// Visit each type parameter in lock step
|
|
594
562
|
for (let i = 0; i < functionCall.typeParameters.elements.length; i++) {
|
|
@@ -599,8 +567,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
599
567
|
}
|
|
600
568
|
// Compare arguments
|
|
601
569
|
if (functionCall.arguments.elements.length !== otherFunctionCall.arguments.elements.length) {
|
|
602
|
-
this.abort();
|
|
603
|
-
return functionCall;
|
|
570
|
+
return this.abort(functionCall);
|
|
604
571
|
}
|
|
605
572
|
// Visit each argument in lock step
|
|
606
573
|
for (let i = 0; i < functionCall.arguments.elements.length; i++) {
|
|
@@ -621,25 +588,21 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
621
588
|
visitFunctionType(functionType, other) {
|
|
622
589
|
return __awaiter(this, void 0, void 0, function* () {
|
|
623
590
|
if (!this.match || other.kind !== tree_1.JS.Kind.FunctionType) {
|
|
624
|
-
this.abort();
|
|
625
|
-
return functionType;
|
|
591
|
+
return this.abort(functionType);
|
|
626
592
|
}
|
|
627
593
|
const otherFunctionType = other;
|
|
628
594
|
// Compare constructor type
|
|
629
595
|
if (!!functionType.constructorType.element !== !!otherFunctionType.constructorType.element) {
|
|
630
|
-
this.abort();
|
|
631
|
-
return functionType;
|
|
596
|
+
return this.abort(functionType);
|
|
632
597
|
}
|
|
633
598
|
if (functionType.constructorType.element) {
|
|
634
599
|
if (functionType.constructorType.element !== otherFunctionType.constructorType.element) {
|
|
635
|
-
this.abort();
|
|
636
|
-
return functionType;
|
|
600
|
+
return this.abort(functionType);
|
|
637
601
|
}
|
|
638
602
|
}
|
|
639
603
|
// Compare type parameters
|
|
640
604
|
if (!!functionType.typeParameters !== !!otherFunctionType.typeParameters) {
|
|
641
|
-
this.abort();
|
|
642
|
-
return functionType;
|
|
605
|
+
return this.abort(functionType);
|
|
643
606
|
}
|
|
644
607
|
if (functionType.typeParameters) {
|
|
645
608
|
yield this.visit(functionType.typeParameters, otherFunctionType.typeParameters);
|
|
@@ -648,8 +611,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
648
611
|
}
|
|
649
612
|
// Compare parameters
|
|
650
613
|
if (functionType.parameters.elements.length !== otherFunctionType.parameters.elements.length) {
|
|
651
|
-
this.abort();
|
|
652
|
-
return functionType;
|
|
614
|
+
return this.abort(functionType);
|
|
653
615
|
}
|
|
654
616
|
// Visit parameters in lock step
|
|
655
617
|
for (let i = 0; i < functionType.parameters.elements.length; i++) {
|
|
@@ -672,8 +634,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
672
634
|
visitInferType(inferType, other) {
|
|
673
635
|
return __awaiter(this, void 0, void 0, function* () {
|
|
674
636
|
if (!this.match || other.kind !== tree_1.JS.Kind.InferType) {
|
|
675
|
-
this.abort();
|
|
676
|
-
return inferType;
|
|
637
|
+
return this.abort(inferType);
|
|
677
638
|
}
|
|
678
639
|
const otherInferType = other;
|
|
679
640
|
// Visit type parameter
|
|
@@ -691,19 +652,16 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
691
652
|
visitImportType(importType, other) {
|
|
692
653
|
return __awaiter(this, void 0, void 0, function* () {
|
|
693
654
|
if (!this.match || other.kind !== tree_1.JS.Kind.ImportType) {
|
|
694
|
-
this.abort();
|
|
695
|
-
return importType;
|
|
655
|
+
return this.abort(importType);
|
|
696
656
|
}
|
|
697
657
|
const otherImportType = other;
|
|
698
658
|
// Compare has typeof
|
|
699
659
|
if (importType.hasTypeof.element !== otherImportType.hasTypeof.element) {
|
|
700
|
-
this.abort();
|
|
701
|
-
return importType;
|
|
660
|
+
return this.abort(importType);
|
|
702
661
|
}
|
|
703
662
|
// Compare argument and attributes
|
|
704
663
|
if (importType.argumentAndAttributes.elements.length !== otherImportType.argumentAndAttributes.elements.length) {
|
|
705
|
-
this.abort();
|
|
706
|
-
return importType;
|
|
664
|
+
return this.abort(importType);
|
|
707
665
|
}
|
|
708
666
|
// Visit argument and attributes in lock step
|
|
709
667
|
for (let i = 0; i < importType.argumentAndAttributes.elements.length; i++) {
|
|
@@ -713,8 +671,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
713
671
|
}
|
|
714
672
|
// Compare qualifier
|
|
715
673
|
if (!!importType.qualifier !== !!otherImportType.qualifier) {
|
|
716
|
-
this.abort();
|
|
717
|
-
return importType;
|
|
674
|
+
return this.abort(importType);
|
|
718
675
|
}
|
|
719
676
|
if (importType.qualifier) {
|
|
720
677
|
yield this.visit(importType.qualifier.element, otherImportType.qualifier.element);
|
|
@@ -723,13 +680,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
723
680
|
}
|
|
724
681
|
// Compare type arguments
|
|
725
682
|
if (!!importType.typeArguments !== !!otherImportType.typeArguments) {
|
|
726
|
-
this.abort();
|
|
727
|
-
return importType;
|
|
683
|
+
return this.abort(importType);
|
|
728
684
|
}
|
|
729
685
|
if (importType.typeArguments) {
|
|
730
686
|
if (importType.typeArguments.elements.length !== otherImportType.typeArguments.elements.length) {
|
|
731
|
-
this.abort();
|
|
732
|
-
return importType;
|
|
687
|
+
return this.abort(importType);
|
|
733
688
|
}
|
|
734
689
|
// Visit type arguments in lock step
|
|
735
690
|
for (let i = 0; i < importType.typeArguments.elements.length; i++) {
|
|
@@ -751,14 +706,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
751
706
|
visitImportDeclaration(jsImport, other) {
|
|
752
707
|
return __awaiter(this, void 0, void 0, function* () {
|
|
753
708
|
if (!this.match || other.kind !== tree_1.JS.Kind.Import) {
|
|
754
|
-
this.abort();
|
|
755
|
-
return jsImport;
|
|
709
|
+
return this.abort(jsImport);
|
|
756
710
|
}
|
|
757
711
|
const otherImport = other;
|
|
758
712
|
// Compare modifiers
|
|
759
713
|
if (jsImport.modifiers.length !== otherImport.modifiers.length) {
|
|
760
|
-
this.abort();
|
|
761
|
-
return jsImport;
|
|
714
|
+
return this.abort(jsImport);
|
|
762
715
|
}
|
|
763
716
|
// Visit each modifier in lock step
|
|
764
717
|
for (let i = 0; i < jsImport.modifiers.length; i++) {
|
|
@@ -768,8 +721,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
768
721
|
}
|
|
769
722
|
// Compare import clause
|
|
770
723
|
if (!!jsImport.importClause !== !!otherImport.importClause) {
|
|
771
|
-
this.abort();
|
|
772
|
-
return jsImport;
|
|
724
|
+
return this.abort(jsImport);
|
|
773
725
|
}
|
|
774
726
|
if (jsImport.importClause) {
|
|
775
727
|
yield this.visit(jsImport.importClause, otherImport.importClause);
|
|
@@ -784,8 +736,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
784
736
|
}
|
|
785
737
|
// Compare attributes
|
|
786
738
|
if (!!jsImport.attributes !== !!otherImport.attributes) {
|
|
787
|
-
this.abort();
|
|
788
|
-
return jsImport;
|
|
739
|
+
return this.abort(jsImport);
|
|
789
740
|
}
|
|
790
741
|
if (jsImport.attributes) {
|
|
791
742
|
yield this.visit(jsImport.attributes, otherImport.attributes);
|
|
@@ -809,14 +760,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
809
760
|
visitImportClause(importClause, other) {
|
|
810
761
|
return __awaiter(this, void 0, void 0, function* () {
|
|
811
762
|
if (!this.match || other.kind !== tree_1.JS.Kind.ImportClause) {
|
|
812
|
-
this.abort();
|
|
813
|
-
return importClause;
|
|
763
|
+
return this.abort(importClause);
|
|
814
764
|
}
|
|
815
765
|
const otherImportClause = other;
|
|
816
766
|
// Compare name
|
|
817
767
|
if (!!importClause.name !== !!otherImportClause.name) {
|
|
818
|
-
this.abort();
|
|
819
|
-
return importClause;
|
|
768
|
+
return this.abort(importClause);
|
|
820
769
|
}
|
|
821
770
|
if (importClause.name) {
|
|
822
771
|
yield this.visit(importClause.name.element, otherImportClause.name.element);
|
|
@@ -825,8 +774,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
825
774
|
}
|
|
826
775
|
// Compare named bindings
|
|
827
776
|
if (!!importClause.namedBindings !== !!otherImportClause.namedBindings) {
|
|
828
|
-
this.abort();
|
|
829
|
-
return importClause;
|
|
777
|
+
return this.abort(importClause);
|
|
830
778
|
}
|
|
831
779
|
if (importClause.namedBindings) {
|
|
832
780
|
yield this.visit(importClause.namedBindings, otherImportClause.namedBindings);
|
|
@@ -844,14 +792,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
844
792
|
visitNamedImports(namedImports, other) {
|
|
845
793
|
return __awaiter(this, void 0, void 0, function* () {
|
|
846
794
|
if (!this.match || other.kind !== tree_1.JS.Kind.NamedImports) {
|
|
847
|
-
this.abort();
|
|
848
|
-
return namedImports;
|
|
795
|
+
return this.abort(namedImports);
|
|
849
796
|
}
|
|
850
797
|
const otherNamedImports = other;
|
|
851
798
|
// Compare elements
|
|
852
799
|
if (namedImports.elements.elements.length !== otherNamedImports.elements.elements.length) {
|
|
853
|
-
this.abort();
|
|
854
|
-
return namedImports;
|
|
800
|
+
return this.abort(namedImports);
|
|
855
801
|
}
|
|
856
802
|
// Visit elements in lock step
|
|
857
803
|
for (let i = 0; i < namedImports.elements.elements.length; i++) {
|
|
@@ -872,19 +818,16 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
872
818
|
visitImportSpecifier(importSpecifier, other) {
|
|
873
819
|
return __awaiter(this, void 0, void 0, function* () {
|
|
874
820
|
if (!this.match || other.kind !== tree_1.JS.Kind.ImportSpecifier) {
|
|
875
|
-
this.abort();
|
|
876
|
-
return importSpecifier;
|
|
821
|
+
return this.abort(importSpecifier);
|
|
877
822
|
}
|
|
878
823
|
const otherImportSpecifier = other;
|
|
879
824
|
// Compare import type
|
|
880
825
|
if (!!importSpecifier.importType.element !== !!otherImportSpecifier.importType.element) {
|
|
881
|
-
this.abort();
|
|
882
|
-
return importSpecifier;
|
|
826
|
+
return this.abort(importSpecifier);
|
|
883
827
|
}
|
|
884
828
|
if (importSpecifier.importType.element) {
|
|
885
829
|
if (importSpecifier.importType.element !== otherImportSpecifier.importType.element) {
|
|
886
|
-
this.abort();
|
|
887
|
-
return importSpecifier;
|
|
830
|
+
return this.abort(importSpecifier);
|
|
888
831
|
}
|
|
889
832
|
}
|
|
890
833
|
// Visit specifier
|
|
@@ -902,14 +845,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
902
845
|
visitImportAttributes(importAttributes, other) {
|
|
903
846
|
return __awaiter(this, void 0, void 0, function* () {
|
|
904
847
|
if (!this.match || other.kind !== tree_1.JS.Kind.ImportAttributes) {
|
|
905
|
-
this.abort();
|
|
906
|
-
return importAttributes;
|
|
848
|
+
return this.abort(importAttributes);
|
|
907
849
|
}
|
|
908
850
|
const otherImportAttributes = other;
|
|
909
851
|
// Compare elements
|
|
910
852
|
if (importAttributes.elements.elements.length !== otherImportAttributes.elements.elements.length) {
|
|
911
|
-
this.abort();
|
|
912
|
-
return importAttributes;
|
|
853
|
+
return this.abort(importAttributes);
|
|
913
854
|
}
|
|
914
855
|
// Visit elements in lock step
|
|
915
856
|
for (let i = 0; i < importAttributes.elements.elements.length; i++) {
|
|
@@ -930,8 +871,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
930
871
|
visitImportTypeAttributes(importTypeAttributes, other) {
|
|
931
872
|
return __awaiter(this, void 0, void 0, function* () {
|
|
932
873
|
if (!this.match || other.kind !== tree_1.JS.Kind.ImportTypeAttributes) {
|
|
933
|
-
this.abort();
|
|
934
|
-
return importTypeAttributes;
|
|
874
|
+
return this.abort(importTypeAttributes);
|
|
935
875
|
}
|
|
936
876
|
const otherImportTypeAttributes = other;
|
|
937
877
|
// Compare token
|
|
@@ -940,8 +880,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
940
880
|
return importTypeAttributes;
|
|
941
881
|
// Compare elements
|
|
942
882
|
if (importTypeAttributes.elements.elements.length !== otherImportTypeAttributes.elements.elements.length) {
|
|
943
|
-
this.abort();
|
|
944
|
-
return importTypeAttributes;
|
|
883
|
+
return this.abort(importTypeAttributes);
|
|
945
884
|
}
|
|
946
885
|
// Visit elements in lock step
|
|
947
886
|
for (let i = 0; i < importTypeAttributes.elements.elements.length; i++) {
|
|
@@ -962,8 +901,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
962
901
|
visitImportAttribute(importAttribute, other) {
|
|
963
902
|
return __awaiter(this, void 0, void 0, function* () {
|
|
964
903
|
if (!this.match || other.kind !== tree_1.JS.Kind.ImportAttribute) {
|
|
965
|
-
this.abort();
|
|
966
|
-
return importAttribute;
|
|
904
|
+
return this.abort(importAttribute);
|
|
967
905
|
}
|
|
968
906
|
const otherImportAttribute = other;
|
|
969
907
|
// Visit name
|
|
@@ -985,8 +923,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
985
923
|
visitBinaryExtensions(jsBinary, other) {
|
|
986
924
|
return __awaiter(this, void 0, void 0, function* () {
|
|
987
925
|
if (!this.match || other.kind !== tree_1.JS.Kind.Binary) {
|
|
988
|
-
this.abort();
|
|
989
|
-
return jsBinary;
|
|
926
|
+
return this.abort(jsBinary);
|
|
990
927
|
}
|
|
991
928
|
const otherBinary = other;
|
|
992
929
|
// Visit left operand
|
|
@@ -995,8 +932,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
995
932
|
return jsBinary;
|
|
996
933
|
// Compare operator
|
|
997
934
|
if (jsBinary.operator.element !== otherBinary.operator.element) {
|
|
998
|
-
this.abort();
|
|
999
|
-
return jsBinary;
|
|
935
|
+
return this.abort(jsBinary);
|
|
1000
936
|
}
|
|
1001
937
|
// Visit right operand
|
|
1002
938
|
yield this.visit(jsBinary.right, otherBinary.right);
|
|
@@ -1013,8 +949,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1013
949
|
visitLiteralType(literalType, other) {
|
|
1014
950
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1015
951
|
if (!this.match || other.kind !== tree_1.JS.Kind.LiteralType) {
|
|
1016
|
-
this.abort();
|
|
1017
|
-
return literalType;
|
|
952
|
+
return this.abort(literalType);
|
|
1018
953
|
}
|
|
1019
954
|
const otherLiteralType = other;
|
|
1020
955
|
// Visit literal
|
|
@@ -1032,14 +967,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1032
967
|
visitMappedType(mappedType, other) {
|
|
1033
968
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1034
969
|
if (!this.match || other.kind !== tree_1.JS.Kind.MappedType) {
|
|
1035
|
-
this.abort();
|
|
1036
|
-
return mappedType;
|
|
970
|
+
return this.abort(mappedType);
|
|
1037
971
|
}
|
|
1038
972
|
const otherMappedType = other;
|
|
1039
973
|
// Compare prefix token
|
|
1040
974
|
if (!!mappedType.prefixToken !== !!otherMappedType.prefixToken) {
|
|
1041
|
-
this.abort();
|
|
1042
|
-
return mappedType;
|
|
975
|
+
return this.abort(mappedType);
|
|
1043
976
|
}
|
|
1044
977
|
if (mappedType.prefixToken) {
|
|
1045
978
|
yield this.visit(mappedType.prefixToken.element, otherMappedType.prefixToken.element);
|
|
@@ -1048,8 +981,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1048
981
|
}
|
|
1049
982
|
// Compare has readonly
|
|
1050
983
|
if (mappedType.hasReadonly.element !== otherMappedType.hasReadonly.element) {
|
|
1051
|
-
this.abort();
|
|
1052
|
-
return mappedType;
|
|
984
|
+
return this.abort(mappedType);
|
|
1053
985
|
}
|
|
1054
986
|
// Visit keys remapping
|
|
1055
987
|
yield this.visit(mappedType.keysRemapping, otherMappedType.keysRemapping);
|
|
@@ -1057,8 +989,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1057
989
|
return mappedType;
|
|
1058
990
|
// Compare suffix token
|
|
1059
991
|
if (!!mappedType.suffixToken !== !!otherMappedType.suffixToken) {
|
|
1060
|
-
this.abort();
|
|
1061
|
-
return mappedType;
|
|
992
|
+
return this.abort(mappedType);
|
|
1062
993
|
}
|
|
1063
994
|
if (mappedType.suffixToken) {
|
|
1064
995
|
yield this.visit(mappedType.suffixToken.element, otherMappedType.suffixToken.element);
|
|
@@ -1067,13 +998,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1067
998
|
}
|
|
1068
999
|
// Compare has question token
|
|
1069
1000
|
if (mappedType.hasQuestionToken.element !== otherMappedType.hasQuestionToken.element) {
|
|
1070
|
-
this.abort();
|
|
1071
|
-
return mappedType;
|
|
1001
|
+
return this.abort(mappedType);
|
|
1072
1002
|
}
|
|
1073
1003
|
// Compare value type
|
|
1074
1004
|
if (mappedType.valueType.elements.length !== otherMappedType.valueType.elements.length) {
|
|
1075
|
-
this.abort();
|
|
1076
|
-
return mappedType;
|
|
1005
|
+
return this.abort(mappedType);
|
|
1077
1006
|
}
|
|
1078
1007
|
// Visit value type elements in lock step
|
|
1079
1008
|
for (let i = 0; i < mappedType.valueType.elements.length; i++) {
|
|
@@ -1094,8 +1023,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1094
1023
|
visitMappedTypeKeysRemapping(keysRemapping, other) {
|
|
1095
1024
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1096
1025
|
if (!this.match || other.kind !== tree_1.JS.Kind.MappedTypeKeysRemapping) {
|
|
1097
|
-
this.abort();
|
|
1098
|
-
return keysRemapping;
|
|
1026
|
+
return this.abort(keysRemapping);
|
|
1099
1027
|
}
|
|
1100
1028
|
const otherKeysRemapping = other;
|
|
1101
1029
|
// Visit type parameter
|
|
@@ -1104,8 +1032,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1104
1032
|
return keysRemapping;
|
|
1105
1033
|
// Compare name type
|
|
1106
1034
|
if (!!keysRemapping.nameType !== !!otherKeysRemapping.nameType) {
|
|
1107
|
-
this.abort();
|
|
1108
|
-
return keysRemapping;
|
|
1035
|
+
return this.abort(keysRemapping);
|
|
1109
1036
|
}
|
|
1110
1037
|
if (keysRemapping.nameType) {
|
|
1111
1038
|
yield this.visit(keysRemapping.nameType.element, otherKeysRemapping.nameType.element);
|
|
@@ -1123,8 +1050,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1123
1050
|
visitMappedTypeParameter(mappedTypeParameter, other) {
|
|
1124
1051
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1125
1052
|
if (!this.match || other.kind !== tree_1.JS.Kind.MappedTypeParameter) {
|
|
1126
|
-
this.abort();
|
|
1127
|
-
return mappedTypeParameter;
|
|
1053
|
+
return this.abort(mappedTypeParameter);
|
|
1128
1054
|
}
|
|
1129
1055
|
const otherMappedTypeParameter = other;
|
|
1130
1056
|
// Visit name
|
|
@@ -1146,14 +1072,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1146
1072
|
visitObjectBindingPattern(objectBindingPattern, other) {
|
|
1147
1073
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1148
1074
|
if (!this.match || other.kind !== tree_1.JS.Kind.ObjectBindingPattern) {
|
|
1149
|
-
this.abort();
|
|
1150
|
-
return objectBindingPattern;
|
|
1075
|
+
return this.abort(objectBindingPattern);
|
|
1151
1076
|
}
|
|
1152
1077
|
const otherObjectBindingPattern = other;
|
|
1153
1078
|
// Compare leading annotations
|
|
1154
1079
|
if (objectBindingPattern.leadingAnnotations.length !== otherObjectBindingPattern.leadingAnnotations.length) {
|
|
1155
|
-
this.abort();
|
|
1156
|
-
return objectBindingPattern;
|
|
1080
|
+
return this.abort(objectBindingPattern);
|
|
1157
1081
|
}
|
|
1158
1082
|
// Visit leading annotations in lock step
|
|
1159
1083
|
for (let i = 0; i < objectBindingPattern.leadingAnnotations.length; i++) {
|
|
@@ -1163,8 +1087,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1163
1087
|
}
|
|
1164
1088
|
// Compare modifiers
|
|
1165
1089
|
if (objectBindingPattern.modifiers.length !== otherObjectBindingPattern.modifiers.length) {
|
|
1166
|
-
this.abort();
|
|
1167
|
-
return objectBindingPattern;
|
|
1090
|
+
return this.abort(objectBindingPattern);
|
|
1168
1091
|
}
|
|
1169
1092
|
// Visit modifiers in lock step
|
|
1170
1093
|
for (let i = 0; i < objectBindingPattern.modifiers.length; i++) {
|
|
@@ -1174,8 +1097,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1174
1097
|
}
|
|
1175
1098
|
// Compare type expression
|
|
1176
1099
|
if (!!objectBindingPattern.typeExpression !== !!otherObjectBindingPattern.typeExpression) {
|
|
1177
|
-
this.abort();
|
|
1178
|
-
return objectBindingPattern;
|
|
1100
|
+
return this.abort(objectBindingPattern);
|
|
1179
1101
|
}
|
|
1180
1102
|
if (objectBindingPattern.typeExpression) {
|
|
1181
1103
|
yield this.visit(objectBindingPattern.typeExpression, otherObjectBindingPattern.typeExpression);
|
|
@@ -1184,8 +1106,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1184
1106
|
}
|
|
1185
1107
|
// Compare bindings
|
|
1186
1108
|
if (objectBindingPattern.bindings.elements.length !== otherObjectBindingPattern.bindings.elements.length) {
|
|
1187
|
-
this.abort();
|
|
1188
|
-
return objectBindingPattern;
|
|
1109
|
+
return this.abort(objectBindingPattern);
|
|
1189
1110
|
}
|
|
1190
1111
|
// Visit bindings in lock step
|
|
1191
1112
|
for (let i = 0; i < objectBindingPattern.bindings.elements.length; i++) {
|
|
@@ -1195,8 +1116,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1195
1116
|
}
|
|
1196
1117
|
// Compare initializer
|
|
1197
1118
|
if (!!objectBindingPattern.initializer !== !!otherObjectBindingPattern.initializer) {
|
|
1198
|
-
this.abort();
|
|
1199
|
-
return objectBindingPattern;
|
|
1119
|
+
return this.abort(objectBindingPattern);
|
|
1200
1120
|
}
|
|
1201
1121
|
if (objectBindingPattern.initializer) {
|
|
1202
1122
|
yield this.visit(objectBindingPattern.initializer.element, otherObjectBindingPattern.initializer.element);
|
|
@@ -1214,8 +1134,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1214
1134
|
visitPropertyAssignment(propertyAssignment, other) {
|
|
1215
1135
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1216
1136
|
if (!this.match || other.kind !== tree_1.JS.Kind.PropertyAssignment) {
|
|
1217
|
-
this.abort();
|
|
1218
|
-
return propertyAssignment;
|
|
1137
|
+
return this.abort(propertyAssignment);
|
|
1219
1138
|
}
|
|
1220
1139
|
const otherPropertyAssignment = other;
|
|
1221
1140
|
// Visit name
|
|
@@ -1224,8 +1143,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1224
1143
|
return propertyAssignment;
|
|
1225
1144
|
// Compare initializer
|
|
1226
1145
|
if (!!propertyAssignment.initializer !== !!otherPropertyAssignment.initializer) {
|
|
1227
|
-
this.abort();
|
|
1228
|
-
return propertyAssignment;
|
|
1146
|
+
return this.abort(propertyAssignment);
|
|
1229
1147
|
}
|
|
1230
1148
|
if (propertyAssignment.initializer) {
|
|
1231
1149
|
yield this.visit(propertyAssignment.initializer, otherPropertyAssignment.initializer);
|
|
@@ -1243,8 +1161,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1243
1161
|
visitSatisfiesExpression(satisfiesExpression, other) {
|
|
1244
1162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1245
1163
|
if (!this.match || other.kind !== tree_1.JS.Kind.SatisfiesExpression) {
|
|
1246
|
-
this.abort();
|
|
1247
|
-
return satisfiesExpression;
|
|
1164
|
+
return this.abort(satisfiesExpression);
|
|
1248
1165
|
}
|
|
1249
1166
|
const otherSatisfiesExpression = other;
|
|
1250
1167
|
// Visit expression
|
|
@@ -1266,14 +1183,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1266
1183
|
visitScopedVariableDeclarations(scopedVariableDeclarations, other) {
|
|
1267
1184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1268
1185
|
if (!this.match || other.kind !== tree_1.JS.Kind.ScopedVariableDeclarations) {
|
|
1269
|
-
this.abort();
|
|
1270
|
-
return scopedVariableDeclarations;
|
|
1186
|
+
return this.abort(scopedVariableDeclarations);
|
|
1271
1187
|
}
|
|
1272
1188
|
const otherScopedVariableDeclarations = other;
|
|
1273
1189
|
// Compare modifiers
|
|
1274
1190
|
if (scopedVariableDeclarations.modifiers.length !== otherScopedVariableDeclarations.modifiers.length) {
|
|
1275
|
-
this.abort();
|
|
1276
|
-
return scopedVariableDeclarations;
|
|
1191
|
+
return this.abort(scopedVariableDeclarations);
|
|
1277
1192
|
}
|
|
1278
1193
|
// Visit modifiers in lock step
|
|
1279
1194
|
for (let i = 0; i < scopedVariableDeclarations.modifiers.length; i++) {
|
|
@@ -1283,8 +1198,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1283
1198
|
}
|
|
1284
1199
|
// Compare variables
|
|
1285
1200
|
if (scopedVariableDeclarations.variables.length !== otherScopedVariableDeclarations.variables.length) {
|
|
1286
|
-
this.abort();
|
|
1287
|
-
return scopedVariableDeclarations;
|
|
1201
|
+
return this.abort(scopedVariableDeclarations);
|
|
1288
1202
|
}
|
|
1289
1203
|
// Visit variables in lock step
|
|
1290
1204
|
for (let i = 0; i < scopedVariableDeclarations.variables.length; i++) {
|
|
@@ -1305,8 +1219,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1305
1219
|
visitStatementExpression(statementExpression, other) {
|
|
1306
1220
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1307
1221
|
if (!this.match || other.kind !== tree_1.JS.Kind.StatementExpression) {
|
|
1308
|
-
this.abort();
|
|
1309
|
-
return statementExpression;
|
|
1222
|
+
return this.abort(statementExpression);
|
|
1310
1223
|
}
|
|
1311
1224
|
const otherStatementExpression = other;
|
|
1312
1225
|
// Visit statement
|
|
@@ -1324,14 +1237,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1324
1237
|
visitTaggedTemplateExpression(taggedTemplateExpression, other) {
|
|
1325
1238
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1326
1239
|
if (!this.match || other.kind !== tree_1.JS.Kind.TaggedTemplateExpression) {
|
|
1327
|
-
this.abort();
|
|
1328
|
-
return taggedTemplateExpression;
|
|
1240
|
+
return this.abort(taggedTemplateExpression);
|
|
1329
1241
|
}
|
|
1330
1242
|
const otherTaggedTemplateExpression = other;
|
|
1331
1243
|
// Compare tag
|
|
1332
1244
|
if (!!taggedTemplateExpression.tag !== !!otherTaggedTemplateExpression.tag) {
|
|
1333
|
-
this.abort();
|
|
1334
|
-
return taggedTemplateExpression;
|
|
1245
|
+
return this.abort(taggedTemplateExpression);
|
|
1335
1246
|
}
|
|
1336
1247
|
if (taggedTemplateExpression.tag) {
|
|
1337
1248
|
yield this.visit(taggedTemplateExpression.tag.element, otherTaggedTemplateExpression.tag.element);
|
|
@@ -1340,13 +1251,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1340
1251
|
}
|
|
1341
1252
|
// Compare type arguments
|
|
1342
1253
|
if (!!taggedTemplateExpression.typeArguments !== !!otherTaggedTemplateExpression.typeArguments) {
|
|
1343
|
-
this.abort();
|
|
1344
|
-
return taggedTemplateExpression;
|
|
1254
|
+
return this.abort(taggedTemplateExpression);
|
|
1345
1255
|
}
|
|
1346
1256
|
if (taggedTemplateExpression.typeArguments) {
|
|
1347
1257
|
if (taggedTemplateExpression.typeArguments.elements.length !== otherTaggedTemplateExpression.typeArguments.elements.length) {
|
|
1348
|
-
this.abort();
|
|
1349
|
-
return taggedTemplateExpression;
|
|
1258
|
+
return this.abort(taggedTemplateExpression);
|
|
1350
1259
|
}
|
|
1351
1260
|
// Visit type arguments in lock step
|
|
1352
1261
|
for (let i = 0; i < taggedTemplateExpression.typeArguments.elements.length; i++) {
|
|
@@ -1370,8 +1279,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1370
1279
|
visitTemplateExpression(templateExpression, other) {
|
|
1371
1280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1372
1281
|
if (!this.match || other.kind !== tree_1.JS.Kind.TemplateExpression) {
|
|
1373
|
-
this.abort();
|
|
1374
|
-
return templateExpression;
|
|
1282
|
+
return this.abort(templateExpression);
|
|
1375
1283
|
}
|
|
1376
1284
|
const otherTemplateExpression = other;
|
|
1377
1285
|
// Visit head
|
|
@@ -1380,8 +1288,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1380
1288
|
return templateExpression;
|
|
1381
1289
|
// Compare spans
|
|
1382
1290
|
if (templateExpression.spans.length !== otherTemplateExpression.spans.length) {
|
|
1383
|
-
this.abort();
|
|
1384
|
-
return templateExpression;
|
|
1291
|
+
return this.abort(templateExpression);
|
|
1385
1292
|
}
|
|
1386
1293
|
// Visit spans in lock step
|
|
1387
1294
|
for (let i = 0; i < templateExpression.spans.length; i++) {
|
|
@@ -1402,8 +1309,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1402
1309
|
visitTemplateExpressionSpan(span, other) {
|
|
1403
1310
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1404
1311
|
if (!this.match || other.kind !== tree_1.JS.Kind.TemplateExpressionSpan) {
|
|
1405
|
-
this.abort();
|
|
1406
|
-
return span;
|
|
1312
|
+
return this.abort(span);
|
|
1407
1313
|
}
|
|
1408
1314
|
const otherSpan = other;
|
|
1409
1315
|
// Visit expression
|
|
@@ -1425,14 +1331,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1425
1331
|
visitTuple(tuple, other) {
|
|
1426
1332
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1427
1333
|
if (!this.match || other.kind !== tree_1.JS.Kind.Tuple) {
|
|
1428
|
-
this.abort();
|
|
1429
|
-
return tuple;
|
|
1334
|
+
return this.abort(tuple);
|
|
1430
1335
|
}
|
|
1431
1336
|
const otherTuple = other;
|
|
1432
1337
|
// Compare elements
|
|
1433
1338
|
if (tuple.elements.elements.length !== otherTuple.elements.elements.length) {
|
|
1434
|
-
this.abort();
|
|
1435
|
-
return tuple;
|
|
1339
|
+
return this.abort(tuple);
|
|
1436
1340
|
}
|
|
1437
1341
|
// Visit elements in lock step
|
|
1438
1342
|
for (let i = 0; i < tuple.elements.elements.length; i++) {
|
|
@@ -1453,14 +1357,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1453
1357
|
visitTypeDeclaration(typeDeclaration, other) {
|
|
1454
1358
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1455
1359
|
if (!this.match || other.kind !== tree_1.JS.Kind.TypeDeclaration) {
|
|
1456
|
-
this.abort();
|
|
1457
|
-
return typeDeclaration;
|
|
1360
|
+
return this.abort(typeDeclaration);
|
|
1458
1361
|
}
|
|
1459
1362
|
const otherTypeDeclaration = other;
|
|
1460
1363
|
// Compare modifiers
|
|
1461
1364
|
if (typeDeclaration.modifiers.length !== otherTypeDeclaration.modifiers.length) {
|
|
1462
|
-
this.abort();
|
|
1463
|
-
return typeDeclaration;
|
|
1365
|
+
return this.abort(typeDeclaration);
|
|
1464
1366
|
}
|
|
1465
1367
|
// Visit modifiers in lock step
|
|
1466
1368
|
for (let i = 0; i < typeDeclaration.modifiers.length; i++) {
|
|
@@ -1474,8 +1376,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1474
1376
|
return typeDeclaration;
|
|
1475
1377
|
// Compare type parameters
|
|
1476
1378
|
if (!!typeDeclaration.typeParameters !== !!otherTypeDeclaration.typeParameters) {
|
|
1477
|
-
this.abort();
|
|
1478
|
-
return typeDeclaration;
|
|
1379
|
+
return this.abort(typeDeclaration);
|
|
1479
1380
|
}
|
|
1480
1381
|
if (typeDeclaration.typeParameters) {
|
|
1481
1382
|
yield this.visit(typeDeclaration.typeParameters, otherTypeDeclaration.typeParameters);
|
|
@@ -1497,8 +1398,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1497
1398
|
visitTypeOf(typeOf, other) {
|
|
1498
1399
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1499
1400
|
if (!this.match || other.kind !== tree_1.JS.Kind.TypeOf) {
|
|
1500
|
-
this.abort();
|
|
1501
|
-
return typeOf;
|
|
1401
|
+
return this.abort(typeOf);
|
|
1502
1402
|
}
|
|
1503
1403
|
const otherTypeOf = other;
|
|
1504
1404
|
// Visit expression
|
|
@@ -1516,8 +1416,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1516
1416
|
visitTypeTreeExpression(typeTreeExpression, other) {
|
|
1517
1417
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1518
1418
|
if (!this.match || other.kind !== tree_1.JS.Kind.TypeTreeExpression) {
|
|
1519
|
-
this.abort();
|
|
1520
|
-
return typeTreeExpression;
|
|
1419
|
+
return this.abort(typeTreeExpression);
|
|
1521
1420
|
}
|
|
1522
1421
|
const otherTypeTreeExpression = other;
|
|
1523
1422
|
// Visit expression
|
|
@@ -1535,8 +1434,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1535
1434
|
visitAs(as_, other) {
|
|
1536
1435
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1537
1436
|
if (!this.match || other.kind !== tree_1.JS.Kind.As) {
|
|
1538
|
-
this.abort();
|
|
1539
|
-
return as_;
|
|
1437
|
+
return this.abort(as_);
|
|
1540
1438
|
}
|
|
1541
1439
|
const otherAs = other;
|
|
1542
1440
|
// Visit left and right operands in lock step
|
|
@@ -1557,8 +1455,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1557
1455
|
visitAssignmentOperationExtensions(assignmentOperation, other) {
|
|
1558
1456
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1559
1457
|
if (!this.match || other.kind !== tree_1.JS.Kind.AssignmentOperation) {
|
|
1560
|
-
this.abort();
|
|
1561
|
-
return assignmentOperation;
|
|
1458
|
+
return this.abort(assignmentOperation);
|
|
1562
1459
|
}
|
|
1563
1460
|
const otherAssignmentOperation = other;
|
|
1564
1461
|
// Visit variable
|
|
@@ -1567,8 +1464,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1567
1464
|
return assignmentOperation;
|
|
1568
1465
|
// Compare operator
|
|
1569
1466
|
if (assignmentOperation.operator.element !== otherAssignmentOperation.operator.element) {
|
|
1570
|
-
this.abort();
|
|
1571
|
-
return assignmentOperation;
|
|
1467
|
+
return this.abort(assignmentOperation);
|
|
1572
1468
|
}
|
|
1573
1469
|
// Visit assignment
|
|
1574
1470
|
yield this.visit(assignmentOperation.assignment, otherAssignmentOperation.assignment);
|
|
@@ -1585,8 +1481,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1585
1481
|
visitIndexedAccessType(indexedAccessType, other) {
|
|
1586
1482
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1587
1483
|
if (!this.match || other.kind !== tree_1.JS.Kind.IndexedAccessType) {
|
|
1588
|
-
this.abort();
|
|
1589
|
-
return indexedAccessType;
|
|
1484
|
+
return this.abort(indexedAccessType);
|
|
1590
1485
|
}
|
|
1591
1486
|
const otherIndexedAccessType = other;
|
|
1592
1487
|
// Visit object type
|
|
@@ -1608,8 +1503,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1608
1503
|
visitIndexedAccessTypeIndexType(indexType, other) {
|
|
1609
1504
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1610
1505
|
if (!this.match || other.kind !== tree_1.JS.Kind.IndexType) {
|
|
1611
|
-
this.abort();
|
|
1612
|
-
return indexType;
|
|
1506
|
+
return this.abort(indexType);
|
|
1613
1507
|
}
|
|
1614
1508
|
const otherIndexType = other;
|
|
1615
1509
|
// Visit element
|
|
@@ -1627,8 +1521,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1627
1521
|
visitTypeQuery(typeQuery, other) {
|
|
1628
1522
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1629
1523
|
if (!this.match || other.kind !== tree_1.JS.Kind.TypeQuery) {
|
|
1630
|
-
this.abort();
|
|
1631
|
-
return typeQuery;
|
|
1524
|
+
return this.abort(typeQuery);
|
|
1632
1525
|
}
|
|
1633
1526
|
const otherTypeQuery = other;
|
|
1634
1527
|
// Visit type expression
|
|
@@ -1637,13 +1530,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1637
1530
|
return typeQuery;
|
|
1638
1531
|
// Compare type arguments
|
|
1639
1532
|
if (!!typeQuery.typeArguments !== !!otherTypeQuery.typeArguments) {
|
|
1640
|
-
this.abort();
|
|
1641
|
-
return typeQuery;
|
|
1533
|
+
return this.abort(typeQuery);
|
|
1642
1534
|
}
|
|
1643
1535
|
if (typeQuery.typeArguments) {
|
|
1644
1536
|
if (typeQuery.typeArguments.elements.length !== otherTypeQuery.typeArguments.elements.length) {
|
|
1645
|
-
this.abort();
|
|
1646
|
-
return typeQuery;
|
|
1537
|
+
return this.abort(typeQuery);
|
|
1647
1538
|
}
|
|
1648
1539
|
// Visit type arguments in lock step
|
|
1649
1540
|
for (let i = 0; i < typeQuery.typeArguments.elements.length; i++) {
|
|
@@ -1665,8 +1556,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1665
1556
|
visitTypeInfo(typeInfo, other) {
|
|
1666
1557
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1667
1558
|
if (!this.match || other.kind !== tree_1.JS.Kind.TypeInfo) {
|
|
1668
|
-
this.abort();
|
|
1669
|
-
return typeInfo;
|
|
1559
|
+
return this.abort(typeInfo);
|
|
1670
1560
|
}
|
|
1671
1561
|
const otherTypeInfo = other;
|
|
1672
1562
|
// Visit type identifier
|
|
@@ -1684,8 +1574,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1684
1574
|
visitComputedPropertyName(computedPropertyName, other) {
|
|
1685
1575
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1686
1576
|
if (!this.match || other.kind !== tree_1.JS.Kind.ComputedPropertyName) {
|
|
1687
|
-
this.abort();
|
|
1688
|
-
return computedPropertyName;
|
|
1577
|
+
return this.abort(computedPropertyName);
|
|
1689
1578
|
}
|
|
1690
1579
|
const otherComputedPropertyName = other;
|
|
1691
1580
|
// Visit expression
|
|
@@ -1703,8 +1592,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1703
1592
|
visitTypeOperator(typeOperator, other) {
|
|
1704
1593
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1705
1594
|
if (!this.match || other.kind !== tree_1.JS.Kind.TypeOperator) {
|
|
1706
|
-
this.abort();
|
|
1707
|
-
return typeOperator;
|
|
1595
|
+
return this.abort(typeOperator);
|
|
1708
1596
|
}
|
|
1709
1597
|
const otherTypeOperator = other;
|
|
1710
1598
|
// Visit expression
|
|
@@ -1722,14 +1610,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1722
1610
|
visitTypePredicate(typePredicate, other) {
|
|
1723
1611
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1724
1612
|
if (!this.match || other.kind !== tree_1.JS.Kind.TypePredicate) {
|
|
1725
|
-
this.abort();
|
|
1726
|
-
return typePredicate;
|
|
1613
|
+
return this.abort(typePredicate);
|
|
1727
1614
|
}
|
|
1728
1615
|
const otherTypePredicate = other;
|
|
1729
1616
|
// Compare asserts
|
|
1730
1617
|
if (typePredicate.asserts.element !== otherTypePredicate.asserts.element) {
|
|
1731
|
-
this.abort();
|
|
1732
|
-
return typePredicate;
|
|
1618
|
+
return this.abort(typePredicate);
|
|
1733
1619
|
}
|
|
1734
1620
|
// Visit parameter name
|
|
1735
1621
|
yield this.visit(typePredicate.parameterName, otherTypePredicate.parameterName);
|
|
@@ -1737,8 +1623,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1737
1623
|
return typePredicate;
|
|
1738
1624
|
// Compare expression
|
|
1739
1625
|
if (!!typePredicate.expression !== !!otherTypePredicate.expression) {
|
|
1740
|
-
this.abort();
|
|
1741
|
-
return typePredicate;
|
|
1626
|
+
return this.abort(typePredicate);
|
|
1742
1627
|
}
|
|
1743
1628
|
if (typePredicate.expression) {
|
|
1744
1629
|
yield this.visit(typePredicate.expression.element, otherTypePredicate.expression.element);
|
|
@@ -1756,14 +1641,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1756
1641
|
visitUnion(union, other) {
|
|
1757
1642
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1758
1643
|
if (!this.match || other.kind !== tree_1.JS.Kind.Union) {
|
|
1759
|
-
this.abort();
|
|
1760
|
-
return union;
|
|
1644
|
+
return this.abort(union);
|
|
1761
1645
|
}
|
|
1762
1646
|
const otherUnion = other;
|
|
1763
1647
|
// Compare types
|
|
1764
1648
|
if (union.types.length !== otherUnion.types.length) {
|
|
1765
|
-
this.abort();
|
|
1766
|
-
return union;
|
|
1649
|
+
return this.abort(union);
|
|
1767
1650
|
}
|
|
1768
1651
|
// Visit types in lock step
|
|
1769
1652
|
for (let i = 0; i < union.types.length; i++) {
|
|
@@ -1784,14 +1667,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1784
1667
|
visitIntersection(intersection, other) {
|
|
1785
1668
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1786
1669
|
if (!this.match || other.kind !== tree_1.JS.Kind.Intersection) {
|
|
1787
|
-
this.abort();
|
|
1788
|
-
return intersection;
|
|
1670
|
+
return this.abort(intersection);
|
|
1789
1671
|
}
|
|
1790
1672
|
const otherIntersection = other;
|
|
1791
1673
|
// Compare types
|
|
1792
1674
|
if (intersection.types.length !== otherIntersection.types.length) {
|
|
1793
|
-
this.abort();
|
|
1794
|
-
return intersection;
|
|
1675
|
+
return this.abort(intersection);
|
|
1795
1676
|
}
|
|
1796
1677
|
// Visit types in lock step
|
|
1797
1678
|
for (let i = 0; i < intersection.types.length; i++) {
|
|
@@ -1812,14 +1693,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1812
1693
|
visitAnnotatedType(annotatedType, other) {
|
|
1813
1694
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1814
1695
|
if (!this.match || other.kind !== java_1.J.Kind.AnnotatedType) {
|
|
1815
|
-
this.abort();
|
|
1816
|
-
return annotatedType;
|
|
1696
|
+
return this.abort(annotatedType);
|
|
1817
1697
|
}
|
|
1818
1698
|
const otherAnnotatedType = other;
|
|
1819
1699
|
// Compare annotations
|
|
1820
1700
|
if (annotatedType.annotations.length !== otherAnnotatedType.annotations.length) {
|
|
1821
|
-
this.abort();
|
|
1822
|
-
return annotatedType;
|
|
1701
|
+
return this.abort(annotatedType);
|
|
1823
1702
|
}
|
|
1824
1703
|
// Visit each annotation in lock step
|
|
1825
1704
|
for (let i = 0; i < annotatedType.annotations.length; i++) {
|
|
@@ -1842,8 +1721,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1842
1721
|
visitAnnotation(annotation, other) {
|
|
1843
1722
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1844
1723
|
if (!this.match || other.kind !== java_1.J.Kind.Annotation) {
|
|
1845
|
-
this.abort();
|
|
1846
|
-
return annotation;
|
|
1724
|
+
return this.abort(annotation);
|
|
1847
1725
|
}
|
|
1848
1726
|
const otherAnnotation = other;
|
|
1849
1727
|
// Visit annotation type
|
|
@@ -1852,14 +1730,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1852
1730
|
return annotation;
|
|
1853
1731
|
// Compare arguments
|
|
1854
1732
|
if ((annotation.arguments === undefined) !== (otherAnnotation.arguments === undefined)) {
|
|
1855
|
-
this.abort();
|
|
1856
|
-
return annotation;
|
|
1733
|
+
return this.abort(annotation);
|
|
1857
1734
|
}
|
|
1858
1735
|
// If both have arguments, visit them
|
|
1859
1736
|
if (annotation.arguments && otherAnnotation.arguments) {
|
|
1860
1737
|
if (annotation.arguments.elements.length !== otherAnnotation.arguments.elements.length) {
|
|
1861
|
-
this.abort();
|
|
1862
|
-
return annotation;
|
|
1738
|
+
return this.abort(annotation);
|
|
1863
1739
|
}
|
|
1864
1740
|
// Visit each argument in lock step
|
|
1865
1741
|
for (let i = 0; i < annotation.arguments.elements.length; i++) {
|
|
@@ -1881,8 +1757,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1881
1757
|
visitArrayAccess(arrayAccess, other) {
|
|
1882
1758
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1883
1759
|
if (!this.match || other.kind !== java_1.J.Kind.ArrayAccess) {
|
|
1884
|
-
this.abort();
|
|
1885
|
-
return arrayAccess;
|
|
1760
|
+
return this.abort(arrayAccess);
|
|
1886
1761
|
}
|
|
1887
1762
|
const otherArrayAccess = other;
|
|
1888
1763
|
// Visit indexed expression
|
|
@@ -1904,8 +1779,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1904
1779
|
visitArrayDimension(arrayDimension, other) {
|
|
1905
1780
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1906
1781
|
if (!this.match || other.kind !== java_1.J.Kind.ArrayDimension) {
|
|
1907
|
-
this.abort();
|
|
1908
|
-
return arrayDimension;
|
|
1782
|
+
return this.abort(arrayDimension);
|
|
1909
1783
|
}
|
|
1910
1784
|
const otherArrayDimension = other;
|
|
1911
1785
|
// Visit index
|
|
@@ -1914,7 +1788,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1914
1788
|
}
|
|
1915
1789
|
else if (arrayDimension.index !== otherArrayDimension.index) {
|
|
1916
1790
|
// One has an index and the other doesn't
|
|
1917
|
-
this.abort();
|
|
1791
|
+
return this.abort(arrayDimension);
|
|
1918
1792
|
}
|
|
1919
1793
|
return arrayDimension;
|
|
1920
1794
|
});
|
|
@@ -1930,8 +1804,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1930
1804
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1931
1805
|
var _a, _b;
|
|
1932
1806
|
if (!this.match || other.kind !== java_1.J.Kind.ArrayType) {
|
|
1933
|
-
this.abort();
|
|
1934
|
-
return arrayType;
|
|
1807
|
+
return this.abort(arrayType);
|
|
1935
1808
|
}
|
|
1936
1809
|
const otherArrayType = other;
|
|
1937
1810
|
// Visit element type
|
|
@@ -1940,8 +1813,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1940
1813
|
return arrayType;
|
|
1941
1814
|
// Compare annotations
|
|
1942
1815
|
if ((((_a = arrayType.annotations) === null || _a === void 0 ? void 0 : _a.length) || 0) !== (((_b = otherArrayType.annotations) === null || _b === void 0 ? void 0 : _b.length) || 0)) {
|
|
1943
|
-
this.abort();
|
|
1944
|
-
return arrayType;
|
|
1816
|
+
return this.abort(arrayType);
|
|
1945
1817
|
}
|
|
1946
1818
|
// Visit annotations if they exist
|
|
1947
1819
|
if (arrayType.annotations && otherArrayType.annotations) {
|
|
@@ -1964,8 +1836,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1964
1836
|
visitAssert(anAssert, other) {
|
|
1965
1837
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1966
1838
|
if (!this.match || other.kind !== java_1.J.Kind.Assert) {
|
|
1967
|
-
this.abort();
|
|
1968
|
-
return anAssert;
|
|
1839
|
+
return this.abort(anAssert);
|
|
1969
1840
|
}
|
|
1970
1841
|
const otherAssert = other;
|
|
1971
1842
|
// Visit condition
|
|
@@ -1974,8 +1845,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1974
1845
|
return anAssert;
|
|
1975
1846
|
// Compare detail
|
|
1976
1847
|
if ((anAssert.detail !== undefined) !== (otherAssert.detail !== undefined)) {
|
|
1977
|
-
this.abort();
|
|
1978
|
-
return anAssert;
|
|
1848
|
+
return this.abort(anAssert);
|
|
1979
1849
|
}
|
|
1980
1850
|
// Visit detail if it exists
|
|
1981
1851
|
if (anAssert.detail && otherAssert.detail) {
|
|
@@ -1994,8 +1864,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
1994
1864
|
visitAssignment(assignment, other) {
|
|
1995
1865
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1996
1866
|
if (!this.match || other.kind !== java_1.J.Kind.Assignment) {
|
|
1997
|
-
this.abort();
|
|
1998
|
-
return assignment;
|
|
1867
|
+
return this.abort(assignment);
|
|
1999
1868
|
}
|
|
2000
1869
|
const otherAssignment = other;
|
|
2001
1870
|
// Visit variable
|
|
@@ -2008,7 +1877,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2008
1877
|
}
|
|
2009
1878
|
else if (assignment.assignment !== otherAssignment.assignment) {
|
|
2010
1879
|
// One has an assignment and the other doesn't
|
|
2011
|
-
this.abort();
|
|
1880
|
+
return this.abort(assignment);
|
|
2012
1881
|
}
|
|
2013
1882
|
return assignment;
|
|
2014
1883
|
});
|
|
@@ -2023,8 +1892,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2023
1892
|
visitAssignmentOperation(assignOp, other) {
|
|
2024
1893
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2025
1894
|
if (!this.match || other.kind !== java_1.J.Kind.AssignmentOperation) {
|
|
2026
|
-
this.abort();
|
|
2027
|
-
return assignOp;
|
|
1895
|
+
return this.abort(assignOp);
|
|
2028
1896
|
}
|
|
2029
1897
|
const otherAssignOp = other;
|
|
2030
1898
|
// Visit variable
|
|
@@ -2033,8 +1901,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2033
1901
|
return assignOp;
|
|
2034
1902
|
// Compare operator
|
|
2035
1903
|
if (assignOp.operator.element !== otherAssignOp.operator.element) {
|
|
2036
|
-
this.abort();
|
|
2037
|
-
return assignOp;
|
|
1904
|
+
return this.abort(assignOp);
|
|
2038
1905
|
}
|
|
2039
1906
|
// Visit assignment
|
|
2040
1907
|
yield this.visit(assignOp.assignment, otherAssignOp.assignment);
|
|
@@ -2051,14 +1918,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2051
1918
|
visitBreak(breakStatement, other) {
|
|
2052
1919
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2053
1920
|
if (!this.match || other.kind !== java_1.J.Kind.Break) {
|
|
2054
|
-
this.abort();
|
|
2055
|
-
return breakStatement;
|
|
1921
|
+
return this.abort(breakStatement);
|
|
2056
1922
|
}
|
|
2057
1923
|
const otherBreak = other;
|
|
2058
1924
|
// Compare label presence
|
|
2059
1925
|
if ((breakStatement.label !== undefined) !== (otherBreak.label !== undefined)) {
|
|
2060
|
-
this.abort();
|
|
2061
|
-
return breakStatement;
|
|
1926
|
+
return this.abort(breakStatement);
|
|
2062
1927
|
}
|
|
2063
1928
|
// Visit label if it exists
|
|
2064
1929
|
if (breakStatement.label && otherBreak.label) {
|
|
@@ -2077,14 +1942,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2077
1942
|
visitCase(aCase, other) {
|
|
2078
1943
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2079
1944
|
if (!this.match || other.kind !== java_1.J.Kind.Case) {
|
|
2080
|
-
this.abort();
|
|
2081
|
-
return aCase;
|
|
1945
|
+
return this.abort(aCase);
|
|
2082
1946
|
}
|
|
2083
1947
|
const otherCase = other;
|
|
2084
1948
|
// Compare case labels
|
|
2085
1949
|
if (aCase.caseLabels.elements.length !== otherCase.caseLabels.elements.length) {
|
|
2086
|
-
this.abort();
|
|
2087
|
-
return aCase;
|
|
1950
|
+
return this.abort(aCase);
|
|
2088
1951
|
}
|
|
2089
1952
|
// Visit each case label in lock step
|
|
2090
1953
|
for (let i = 0; i < aCase.caseLabels.elements.length; i++) {
|
|
@@ -2094,8 +1957,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2094
1957
|
}
|
|
2095
1958
|
// Compare statements
|
|
2096
1959
|
if (aCase.statements.elements.length !== otherCase.statements.elements.length) {
|
|
2097
|
-
this.abort();
|
|
2098
|
-
return aCase;
|
|
1960
|
+
return this.abort(aCase);
|
|
2099
1961
|
}
|
|
2100
1962
|
// Visit each statement in lock step
|
|
2101
1963
|
for (let i = 0; i < aCase.statements.elements.length; i++) {
|
|
@@ -2105,8 +1967,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2105
1967
|
}
|
|
2106
1968
|
// Compare body presence
|
|
2107
1969
|
if ((aCase.body !== undefined) !== (otherCase.body !== undefined)) {
|
|
2108
|
-
this.abort();
|
|
2109
|
-
return aCase;
|
|
1970
|
+
return this.abort(aCase);
|
|
2110
1971
|
}
|
|
2111
1972
|
// Visit body if it exists
|
|
2112
1973
|
if (aCase.body && otherCase.body) {
|
|
@@ -2116,8 +1977,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2116
1977
|
}
|
|
2117
1978
|
// Compare guard presence
|
|
2118
1979
|
if ((aCase.guard !== undefined) !== (otherCase.guard !== undefined)) {
|
|
2119
|
-
this.abort();
|
|
2120
|
-
return aCase;
|
|
1980
|
+
return this.abort(aCase);
|
|
2121
1981
|
}
|
|
2122
1982
|
// Visit guard if it exists
|
|
2123
1983
|
if (aCase.guard && otherCase.guard) {
|
|
@@ -2136,14 +1996,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2136
1996
|
visitClassDeclaration(classDecl, other) {
|
|
2137
1997
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2138
1998
|
if (!this.match || other.kind !== java_1.J.Kind.ClassDeclaration) {
|
|
2139
|
-
this.abort();
|
|
2140
|
-
return classDecl;
|
|
1999
|
+
return this.abort(classDecl);
|
|
2141
2000
|
}
|
|
2142
2001
|
const otherClassDecl = other;
|
|
2143
2002
|
// Compare leading annotations
|
|
2144
2003
|
if (classDecl.leadingAnnotations.length !== otherClassDecl.leadingAnnotations.length) {
|
|
2145
|
-
this.abort();
|
|
2146
|
-
return classDecl;
|
|
2004
|
+
return this.abort(classDecl);
|
|
2147
2005
|
}
|
|
2148
2006
|
// Visit each leading annotation in lock step
|
|
2149
2007
|
for (let i = 0; i < classDecl.leadingAnnotations.length; i++) {
|
|
@@ -2153,8 +2011,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2153
2011
|
}
|
|
2154
2012
|
// Compare modifiers
|
|
2155
2013
|
if (classDecl.modifiers.length !== otherClassDecl.modifiers.length) {
|
|
2156
|
-
this.abort();
|
|
2157
|
-
return classDecl;
|
|
2014
|
+
return this.abort(classDecl);
|
|
2158
2015
|
}
|
|
2159
2016
|
// Visit each modifier in lock step
|
|
2160
2017
|
for (let i = 0; i < classDecl.modifiers.length; i++) {
|
|
@@ -2172,14 +2029,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2172
2029
|
return classDecl;
|
|
2173
2030
|
// Compare type parameters presence
|
|
2174
2031
|
if ((classDecl.typeParameters !== undefined) !== (otherClassDecl.typeParameters !== undefined)) {
|
|
2175
|
-
this.abort();
|
|
2176
|
-
return classDecl;
|
|
2032
|
+
return this.abort(classDecl);
|
|
2177
2033
|
}
|
|
2178
2034
|
// Visit type parameters if they exist
|
|
2179
2035
|
if (classDecl.typeParameters && otherClassDecl.typeParameters) {
|
|
2180
2036
|
if (classDecl.typeParameters.elements.length !== otherClassDecl.typeParameters.elements.length) {
|
|
2181
|
-
this.abort();
|
|
2182
|
-
return classDecl;
|
|
2037
|
+
return this.abort(classDecl);
|
|
2183
2038
|
}
|
|
2184
2039
|
// Visit each type parameter in lock step
|
|
2185
2040
|
for (let i = 0; i < classDecl.typeParameters.elements.length; i++) {
|
|
@@ -2190,14 +2045,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2190
2045
|
}
|
|
2191
2046
|
// Compare primary constructor presence
|
|
2192
2047
|
if ((classDecl.primaryConstructor !== undefined) !== (otherClassDecl.primaryConstructor !== undefined)) {
|
|
2193
|
-
this.abort();
|
|
2194
|
-
return classDecl;
|
|
2048
|
+
return this.abort(classDecl);
|
|
2195
2049
|
}
|
|
2196
2050
|
// Visit primary constructor if it exists
|
|
2197
2051
|
if (classDecl.primaryConstructor && otherClassDecl.primaryConstructor) {
|
|
2198
2052
|
if (classDecl.primaryConstructor.elements.length !== otherClassDecl.primaryConstructor.elements.length) {
|
|
2199
|
-
this.abort();
|
|
2200
|
-
return classDecl;
|
|
2053
|
+
return this.abort(classDecl);
|
|
2201
2054
|
}
|
|
2202
2055
|
// Visit each primary constructor element in lock step
|
|
2203
2056
|
for (let i = 0; i < classDecl.primaryConstructor.elements.length; i++) {
|
|
@@ -2208,8 +2061,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2208
2061
|
}
|
|
2209
2062
|
// Compare extends presence
|
|
2210
2063
|
if ((classDecl.extends !== undefined) !== (otherClassDecl.extends !== undefined)) {
|
|
2211
|
-
this.abort();
|
|
2212
|
-
return classDecl;
|
|
2064
|
+
return this.abort(classDecl);
|
|
2213
2065
|
}
|
|
2214
2066
|
// Visit extends if it exists
|
|
2215
2067
|
if (classDecl.extends && otherClassDecl.extends) {
|
|
@@ -2219,14 +2071,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2219
2071
|
}
|
|
2220
2072
|
// Compare implements presence
|
|
2221
2073
|
if ((classDecl.implements !== undefined) !== (otherClassDecl.implements !== undefined)) {
|
|
2222
|
-
this.abort();
|
|
2223
|
-
return classDecl;
|
|
2074
|
+
return this.abort(classDecl);
|
|
2224
2075
|
}
|
|
2225
2076
|
// Visit implements if it exists
|
|
2226
2077
|
if (classDecl.implements && otherClassDecl.implements) {
|
|
2227
2078
|
if (classDecl.implements.elements.length !== otherClassDecl.implements.elements.length) {
|
|
2228
|
-
this.abort();
|
|
2229
|
-
return classDecl;
|
|
2079
|
+
return this.abort(classDecl);
|
|
2230
2080
|
}
|
|
2231
2081
|
// Visit each implements element in lock step
|
|
2232
2082
|
for (let i = 0; i < classDecl.implements.elements.length; i++) {
|
|
@@ -2237,14 +2087,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2237
2087
|
}
|
|
2238
2088
|
// Compare permitting presence
|
|
2239
2089
|
if ((classDecl.permitting !== undefined) !== (otherClassDecl.permitting !== undefined)) {
|
|
2240
|
-
this.abort();
|
|
2241
|
-
return classDecl;
|
|
2090
|
+
return this.abort(classDecl);
|
|
2242
2091
|
}
|
|
2243
2092
|
// Visit permitting if it exists
|
|
2244
2093
|
if (classDecl.permitting && otherClassDecl.permitting) {
|
|
2245
2094
|
if (classDecl.permitting.elements.length !== otherClassDecl.permitting.elements.length) {
|
|
2246
|
-
this.abort();
|
|
2247
|
-
return classDecl;
|
|
2095
|
+
return this.abort(classDecl);
|
|
2248
2096
|
}
|
|
2249
2097
|
// Visit each permitting element in lock step
|
|
2250
2098
|
for (let i = 0; i < classDecl.permitting.elements.length; i++) {
|
|
@@ -2268,14 +2116,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2268
2116
|
visitClassDeclarationKind(kind, other) {
|
|
2269
2117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2270
2118
|
if (!this.match || other.kind !== java_1.J.Kind.ClassDeclarationKind) {
|
|
2271
|
-
this.abort();
|
|
2272
|
-
return kind;
|
|
2119
|
+
return this.abort(kind);
|
|
2273
2120
|
}
|
|
2274
2121
|
const otherKind = other;
|
|
2275
2122
|
// Compare annotations
|
|
2276
2123
|
if (kind.annotations.length !== otherKind.annotations.length) {
|
|
2277
|
-
this.abort();
|
|
2278
|
-
return kind;
|
|
2124
|
+
return this.abort(kind);
|
|
2279
2125
|
}
|
|
2280
2126
|
// Visit each annotation in lock step
|
|
2281
2127
|
for (let i = 0; i < kind.annotations.length; i++) {
|
|
@@ -2296,14 +2142,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2296
2142
|
visitCompilationUnit(compilationUnit, other) {
|
|
2297
2143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2298
2144
|
if (!this.match || other.kind !== java_1.J.Kind.CompilationUnit) {
|
|
2299
|
-
this.abort();
|
|
2300
|
-
return compilationUnit;
|
|
2145
|
+
return this.abort(compilationUnit);
|
|
2301
2146
|
}
|
|
2302
2147
|
const otherCompilationUnit = other;
|
|
2303
2148
|
// Compare package declaration presence
|
|
2304
2149
|
if ((compilationUnit.packageDeclaration !== undefined) !== (otherCompilationUnit.packageDeclaration !== undefined)) {
|
|
2305
|
-
this.abort();
|
|
2306
|
-
return compilationUnit;
|
|
2150
|
+
return this.abort(compilationUnit);
|
|
2307
2151
|
}
|
|
2308
2152
|
// Visit package declaration if it exists
|
|
2309
2153
|
if (compilationUnit.packageDeclaration && otherCompilationUnit.packageDeclaration) {
|
|
@@ -2313,8 +2157,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2313
2157
|
}
|
|
2314
2158
|
// Compare imports
|
|
2315
2159
|
if (compilationUnit.imports.length !== otherCompilationUnit.imports.length) {
|
|
2316
|
-
this.abort();
|
|
2317
|
-
return compilationUnit;
|
|
2160
|
+
return this.abort(compilationUnit);
|
|
2318
2161
|
}
|
|
2319
2162
|
// Visit each import in lock step
|
|
2320
2163
|
for (let i = 0; i < compilationUnit.imports.length; i++) {
|
|
@@ -2324,8 +2167,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2324
2167
|
}
|
|
2325
2168
|
// Compare classes
|
|
2326
2169
|
if (compilationUnit.classes.length !== otherCompilationUnit.classes.length) {
|
|
2327
|
-
this.abort();
|
|
2328
|
-
return compilationUnit;
|
|
2170
|
+
return this.abort(compilationUnit);
|
|
2329
2171
|
}
|
|
2330
2172
|
// Visit each class in lock step
|
|
2331
2173
|
for (let i = 0; i < compilationUnit.classes.length; i++) {
|
|
@@ -2346,14 +2188,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2346
2188
|
visitContinue(continueStatement, other) {
|
|
2347
2189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2348
2190
|
if (!this.match || other.kind !== java_1.J.Kind.Continue) {
|
|
2349
|
-
this.abort();
|
|
2350
|
-
return continueStatement;
|
|
2191
|
+
return this.abort(continueStatement);
|
|
2351
2192
|
}
|
|
2352
2193
|
const otherContinue = other;
|
|
2353
2194
|
// Compare label presence
|
|
2354
2195
|
if ((continueStatement.label !== undefined) !== (otherContinue.label !== undefined)) {
|
|
2355
|
-
this.abort();
|
|
2356
|
-
return continueStatement;
|
|
2196
|
+
return this.abort(continueStatement);
|
|
2357
2197
|
}
|
|
2358
2198
|
// Visit label if it exists
|
|
2359
2199
|
if (continueStatement.label && otherContinue.label) {
|
|
@@ -2372,8 +2212,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2372
2212
|
visitControlParentheses(controlParens, other) {
|
|
2373
2213
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2374
2214
|
if (!this.match || other.kind !== java_1.J.Kind.ControlParentheses) {
|
|
2375
|
-
this.abort();
|
|
2376
|
-
return controlParens;
|
|
2215
|
+
return this.abort(controlParens);
|
|
2377
2216
|
}
|
|
2378
2217
|
const otherControlParens = other;
|
|
2379
2218
|
// Visit tree
|
|
@@ -2391,8 +2230,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2391
2230
|
visitDeconstructionPattern(pattern, other) {
|
|
2392
2231
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2393
2232
|
if (!this.match || other.kind !== java_1.J.Kind.DeconstructionPattern) {
|
|
2394
|
-
this.abort();
|
|
2395
|
-
return pattern;
|
|
2233
|
+
return this.abort(pattern);
|
|
2396
2234
|
}
|
|
2397
2235
|
const otherPattern = other;
|
|
2398
2236
|
// Visit deconstructor
|
|
@@ -2401,8 +2239,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2401
2239
|
return pattern;
|
|
2402
2240
|
// Compare nested elements
|
|
2403
2241
|
if (pattern.nested.elements.length !== otherPattern.nested.elements.length) {
|
|
2404
|
-
this.abort();
|
|
2405
|
-
return pattern;
|
|
2242
|
+
return this.abort(pattern);
|
|
2406
2243
|
}
|
|
2407
2244
|
// Visit each nested element in lock step
|
|
2408
2245
|
for (let i = 0; i < pattern.nested.elements.length; i++) {
|
|
@@ -2423,8 +2260,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2423
2260
|
visitDoWhileLoop(doWhileLoop, other) {
|
|
2424
2261
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2425
2262
|
if (!this.match || other.kind !== java_1.J.Kind.DoWhileLoop) {
|
|
2426
|
-
this.abort();
|
|
2427
|
-
return doWhileLoop;
|
|
2263
|
+
return this.abort(doWhileLoop);
|
|
2428
2264
|
}
|
|
2429
2265
|
const otherDoWhileLoop = other;
|
|
2430
2266
|
// Visit body
|
|
@@ -2446,8 +2282,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2446
2282
|
visitEmpty(empty, other) {
|
|
2447
2283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2448
2284
|
if (!this.match || other.kind !== java_1.J.Kind.Empty) {
|
|
2449
|
-
this.abort();
|
|
2450
|
-
return empty;
|
|
2285
|
+
return this.abort(empty);
|
|
2451
2286
|
}
|
|
2452
2287
|
// Empty statements have no properties to compare, so we just check the kind
|
|
2453
2288
|
return empty;
|
|
@@ -2463,14 +2298,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2463
2298
|
visitEnumValue(enumValue, other) {
|
|
2464
2299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2465
2300
|
if (!this.match || other.kind !== java_1.J.Kind.EnumValue) {
|
|
2466
|
-
this.abort();
|
|
2467
|
-
return enumValue;
|
|
2301
|
+
return this.abort(enumValue);
|
|
2468
2302
|
}
|
|
2469
2303
|
const otherEnumValue = other;
|
|
2470
2304
|
// Compare annotations
|
|
2471
2305
|
if (enumValue.annotations.length !== otherEnumValue.annotations.length) {
|
|
2472
|
-
this.abort();
|
|
2473
|
-
return enumValue;
|
|
2306
|
+
return this.abort(enumValue);
|
|
2474
2307
|
}
|
|
2475
2308
|
// Visit each annotation in lock step
|
|
2476
2309
|
for (let i = 0; i < enumValue.annotations.length; i++) {
|
|
@@ -2484,8 +2317,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2484
2317
|
return enumValue;
|
|
2485
2318
|
// Compare initializer presence
|
|
2486
2319
|
if ((enumValue.initializer !== undefined) !== (otherEnumValue.initializer !== undefined)) {
|
|
2487
|
-
this.abort();
|
|
2488
|
-
return enumValue;
|
|
2320
|
+
return this.abort(enumValue);
|
|
2489
2321
|
}
|
|
2490
2322
|
// Visit initializer if it exists
|
|
2491
2323
|
if (enumValue.initializer && otherEnumValue.initializer) {
|
|
@@ -2504,14 +2336,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2504
2336
|
visitEnumValueSet(enumValueSet, other) {
|
|
2505
2337
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2506
2338
|
if (!this.match || other.kind !== java_1.J.Kind.EnumValueSet) {
|
|
2507
|
-
this.abort();
|
|
2508
|
-
return enumValueSet;
|
|
2339
|
+
return this.abort(enumValueSet);
|
|
2509
2340
|
}
|
|
2510
2341
|
const otherEnumValueSet = other;
|
|
2511
2342
|
// Compare enums
|
|
2512
2343
|
if (enumValueSet.enums.length !== otherEnumValueSet.enums.length) {
|
|
2513
|
-
this.abort();
|
|
2514
|
-
return enumValueSet;
|
|
2344
|
+
return this.abort(enumValueSet);
|
|
2515
2345
|
}
|
|
2516
2346
|
// Visit each enum in lock step
|
|
2517
2347
|
for (let i = 0; i < enumValueSet.enums.length; i++) {
|
|
@@ -2532,14 +2362,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2532
2362
|
visitErroneous(erroneous, other) {
|
|
2533
2363
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2534
2364
|
if (!this.match || other.kind !== java_1.J.Kind.Erroneous) {
|
|
2535
|
-
this.abort();
|
|
2536
|
-
return erroneous;
|
|
2365
|
+
return this.abort(erroneous);
|
|
2537
2366
|
}
|
|
2538
2367
|
const otherErroneous = other;
|
|
2539
2368
|
// Compare text
|
|
2540
2369
|
if (erroneous.text !== otherErroneous.text) {
|
|
2541
|
-
this.abort();
|
|
2542
|
-
return erroneous;
|
|
2370
|
+
return this.abort(erroneous);
|
|
2543
2371
|
}
|
|
2544
2372
|
return erroneous;
|
|
2545
2373
|
});
|
|
@@ -2554,8 +2382,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2554
2382
|
visitFieldAccess(fieldAccess, other) {
|
|
2555
2383
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2556
2384
|
if (!this.match || other.kind !== java_1.J.Kind.FieldAccess) {
|
|
2557
|
-
this.abort();
|
|
2558
|
-
return fieldAccess;
|
|
2385
|
+
return this.abort(fieldAccess);
|
|
2559
2386
|
}
|
|
2560
2387
|
const otherFieldAccess = other;
|
|
2561
2388
|
// Visit target
|
|
@@ -2579,8 +2406,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2579
2406
|
visitForEachLoop(forEachLoop, other) {
|
|
2580
2407
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2581
2408
|
if (!this.match || other.kind !== java_1.J.Kind.ForEachLoop) {
|
|
2582
|
-
this.abort();
|
|
2583
|
-
return forEachLoop;
|
|
2409
|
+
return this.abort(forEachLoop);
|
|
2584
2410
|
}
|
|
2585
2411
|
const otherForEachLoop = other;
|
|
2586
2412
|
// Visit control
|
|
@@ -2604,8 +2430,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2604
2430
|
visitForEachLoopControl(control, other) {
|
|
2605
2431
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2606
2432
|
if (!this.match || other.kind !== java_1.J.Kind.ForEachLoopControl) {
|
|
2607
|
-
this.abort();
|
|
2608
|
-
return control;
|
|
2433
|
+
return this.abort(control);
|
|
2609
2434
|
}
|
|
2610
2435
|
const otherControl = other;
|
|
2611
2436
|
// Visit variable
|
|
@@ -2629,8 +2454,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2629
2454
|
visitForLoop(forLoop, other) {
|
|
2630
2455
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2631
2456
|
if (!this.match || other.kind !== java_1.J.Kind.ForLoop) {
|
|
2632
|
-
this.abort();
|
|
2633
|
-
return forLoop;
|
|
2457
|
+
return this.abort(forLoop);
|
|
2634
2458
|
}
|
|
2635
2459
|
const otherForLoop = other;
|
|
2636
2460
|
// Visit control
|
|
@@ -2654,14 +2478,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2654
2478
|
visitForLoopControl(control, other) {
|
|
2655
2479
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2656
2480
|
if (!this.match || other.kind !== java_1.J.Kind.ForLoopControl) {
|
|
2657
|
-
this.abort();
|
|
2658
|
-
return control;
|
|
2481
|
+
return this.abort(control);
|
|
2659
2482
|
}
|
|
2660
2483
|
const otherControl = other;
|
|
2661
2484
|
// Compare init statements
|
|
2662
2485
|
if (control.init.length !== otherControl.init.length) {
|
|
2663
|
-
this.abort();
|
|
2664
|
-
return control;
|
|
2486
|
+
return this.abort(control);
|
|
2665
2487
|
}
|
|
2666
2488
|
// Visit each init statement in lock step
|
|
2667
2489
|
for (let i = 0; i < control.init.length; i++) {
|
|
@@ -2671,8 +2493,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2671
2493
|
}
|
|
2672
2494
|
// Compare condition
|
|
2673
2495
|
if ((control.condition === undefined) !== (otherControl.condition === undefined)) {
|
|
2674
|
-
this.abort();
|
|
2675
|
-
return control;
|
|
2496
|
+
return this.abort(control);
|
|
2676
2497
|
}
|
|
2677
2498
|
// Visit condition if present
|
|
2678
2499
|
if (control.condition && otherControl.condition) {
|
|
@@ -2682,8 +2503,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2682
2503
|
}
|
|
2683
2504
|
// Compare update statements
|
|
2684
2505
|
if (control.update.length !== otherControl.update.length) {
|
|
2685
|
-
this.abort();
|
|
2686
|
-
return control;
|
|
2506
|
+
return this.abort(control);
|
|
2687
2507
|
}
|
|
2688
2508
|
// Visit each update statement in lock step
|
|
2689
2509
|
for (let i = 0; i < control.update.length; i++) {
|
|
@@ -2704,8 +2524,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2704
2524
|
visitIf(ifStatement, other) {
|
|
2705
2525
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2706
2526
|
if (!this.match || other.kind !== java_1.J.Kind.If) {
|
|
2707
|
-
this.abort();
|
|
2708
|
-
return ifStatement;
|
|
2527
|
+
return this.abort(ifStatement);
|
|
2709
2528
|
}
|
|
2710
2529
|
const otherIfStatement = other;
|
|
2711
2530
|
// Visit condition
|
|
@@ -2718,8 +2537,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2718
2537
|
return ifStatement;
|
|
2719
2538
|
// Compare else part
|
|
2720
2539
|
if ((ifStatement.elsePart === undefined) !== (otherIfStatement.elsePart === undefined)) {
|
|
2721
|
-
this.abort();
|
|
2722
|
-
return ifStatement;
|
|
2540
|
+
return this.abort(ifStatement);
|
|
2723
2541
|
}
|
|
2724
2542
|
// Visit else part if present
|
|
2725
2543
|
if (ifStatement.elsePart && otherIfStatement.elsePart) {
|
|
@@ -2740,8 +2558,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2740
2558
|
visitElse(elseStatement, other) {
|
|
2741
2559
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2742
2560
|
if (!this.match || other.kind !== java_1.J.Kind.IfElse) {
|
|
2743
|
-
this.abort();
|
|
2744
|
-
return elseStatement;
|
|
2561
|
+
return this.abort(elseStatement);
|
|
2745
2562
|
}
|
|
2746
2563
|
const otherElseStatement = other;
|
|
2747
2564
|
// Visit body
|
|
@@ -2761,14 +2578,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2761
2578
|
visitImport(importStatement, other) {
|
|
2762
2579
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2763
2580
|
if (!this.match || other.kind !== java_1.J.Kind.Import) {
|
|
2764
|
-
this.abort();
|
|
2765
|
-
return importStatement;
|
|
2581
|
+
return this.abort(importStatement);
|
|
2766
2582
|
}
|
|
2767
2583
|
const otherImportStatement = other;
|
|
2768
2584
|
// Compare static
|
|
2769
2585
|
if (importStatement.static.element !== otherImportStatement.static.element) {
|
|
2770
|
-
this.abort();
|
|
2771
|
-
return importStatement;
|
|
2586
|
+
return this.abort(importStatement);
|
|
2772
2587
|
}
|
|
2773
2588
|
// Visit qualid
|
|
2774
2589
|
yield this.visit(importStatement.qualid, otherImportStatement.qualid);
|
|
@@ -2776,8 +2591,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2776
2591
|
return importStatement;
|
|
2777
2592
|
// Compare alias
|
|
2778
2593
|
if ((importStatement.alias === undefined) !== (otherImportStatement.alias === undefined)) {
|
|
2779
|
-
this.abort();
|
|
2780
|
-
return importStatement;
|
|
2594
|
+
return this.abort(importStatement);
|
|
2781
2595
|
}
|
|
2782
2596
|
// Visit alias if present
|
|
2783
2597
|
if (importStatement.alias && otherImportStatement.alias) {
|
|
@@ -2798,8 +2612,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2798
2612
|
visitInstanceOf(instanceOf, other) {
|
|
2799
2613
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2800
2614
|
if (!this.match || other.kind !== java_1.J.Kind.InstanceOf) {
|
|
2801
|
-
this.abort();
|
|
2802
|
-
return instanceOf;
|
|
2615
|
+
return this.abort(instanceOf);
|
|
2803
2616
|
}
|
|
2804
2617
|
const otherInstanceOf = other;
|
|
2805
2618
|
// Visit expression
|
|
@@ -2812,8 +2625,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2812
2625
|
return instanceOf;
|
|
2813
2626
|
// Compare pattern
|
|
2814
2627
|
if ((instanceOf.pattern === undefined) !== (otherInstanceOf.pattern === undefined)) {
|
|
2815
|
-
this.abort();
|
|
2816
|
-
return instanceOf;
|
|
2628
|
+
return this.abort(instanceOf);
|
|
2817
2629
|
}
|
|
2818
2630
|
// Visit pattern if present
|
|
2819
2631
|
if (instanceOf.pattern && otherInstanceOf.pattern) {
|
|
@@ -2823,8 +2635,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2823
2635
|
}
|
|
2824
2636
|
// Compare modifier
|
|
2825
2637
|
if ((instanceOf.modifier === undefined) !== (otherInstanceOf.modifier === undefined)) {
|
|
2826
|
-
this.abort();
|
|
2827
|
-
return instanceOf;
|
|
2638
|
+
return this.abort(instanceOf);
|
|
2828
2639
|
}
|
|
2829
2640
|
// Visit modifier if present
|
|
2830
2641
|
if (instanceOf.modifier && otherInstanceOf.modifier) {
|
|
@@ -2845,14 +2656,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2845
2656
|
visitIntersectionType(intersectionType, other) {
|
|
2846
2657
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2847
2658
|
if (!this.match || other.kind !== java_1.J.Kind.IntersectionType) {
|
|
2848
|
-
this.abort();
|
|
2849
|
-
return intersectionType;
|
|
2659
|
+
return this.abort(intersectionType);
|
|
2850
2660
|
}
|
|
2851
2661
|
const otherIntersectionType = other;
|
|
2852
2662
|
// Compare bounds
|
|
2853
2663
|
if (intersectionType.bounds.elements.length !== otherIntersectionType.bounds.elements.length) {
|
|
2854
|
-
this.abort();
|
|
2855
|
-
return intersectionType;
|
|
2664
|
+
return this.abort(intersectionType);
|
|
2856
2665
|
}
|
|
2857
2666
|
// Visit each bound in lock step
|
|
2858
2667
|
for (let i = 0; i < intersectionType.bounds.elements.length; i++) {
|
|
@@ -2873,8 +2682,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2873
2682
|
visitLabel(label, other) {
|
|
2874
2683
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2875
2684
|
if (!this.match || other.kind !== java_1.J.Kind.Label) {
|
|
2876
|
-
this.abort();
|
|
2877
|
-
return label;
|
|
2685
|
+
return this.abort(label);
|
|
2878
2686
|
}
|
|
2879
2687
|
const otherLabel = other;
|
|
2880
2688
|
// Visit label identifier
|
|
@@ -2898,8 +2706,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2898
2706
|
visitLambda(lambda, other) {
|
|
2899
2707
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2900
2708
|
if (!this.match || other.kind !== java_1.J.Kind.Lambda) {
|
|
2901
|
-
this.abort();
|
|
2902
|
-
return lambda;
|
|
2709
|
+
return this.abort(lambda);
|
|
2903
2710
|
}
|
|
2904
2711
|
const otherLambda = other;
|
|
2905
2712
|
// Visit parameters
|
|
@@ -2923,19 +2730,16 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2923
2730
|
visitLambdaParameters(parameters, other) {
|
|
2924
2731
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2925
2732
|
if (!this.match || other.kind !== java_1.J.Kind.LambdaParameters) {
|
|
2926
|
-
this.abort();
|
|
2927
|
-
return parameters;
|
|
2733
|
+
return this.abort(parameters);
|
|
2928
2734
|
}
|
|
2929
2735
|
const otherParameters = other;
|
|
2930
2736
|
// Compare parenthesized
|
|
2931
2737
|
if (parameters.parenthesized !== otherParameters.parenthesized) {
|
|
2932
|
-
this.abort();
|
|
2933
|
-
return parameters;
|
|
2738
|
+
return this.abort(parameters);
|
|
2934
2739
|
}
|
|
2935
2740
|
// Compare parameters
|
|
2936
2741
|
if (parameters.parameters.length !== otherParameters.parameters.length) {
|
|
2937
|
-
this.abort();
|
|
2938
|
-
return parameters;
|
|
2742
|
+
return this.abort(parameters);
|
|
2939
2743
|
}
|
|
2940
2744
|
// Visit each parameter in lock step
|
|
2941
2745
|
for (let i = 0; i < parameters.parameters.length; i++) {
|
|
@@ -2956,8 +2760,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2956
2760
|
visitMemberReference(memberReference, other) {
|
|
2957
2761
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2958
2762
|
if (!this.match || other.kind !== java_1.J.Kind.MemberReference) {
|
|
2959
|
-
this.abort();
|
|
2960
|
-
return memberReference;
|
|
2763
|
+
return this.abort(memberReference);
|
|
2961
2764
|
}
|
|
2962
2765
|
const otherMemberReference = other;
|
|
2963
2766
|
// Visit containing
|
|
@@ -2966,14 +2769,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2966
2769
|
return memberReference;
|
|
2967
2770
|
// Compare typeParameters
|
|
2968
2771
|
if ((memberReference.typeParameters === undefined) !== (otherMemberReference.typeParameters === undefined)) {
|
|
2969
|
-
this.abort();
|
|
2970
|
-
return memberReference;
|
|
2772
|
+
return this.abort(memberReference);
|
|
2971
2773
|
}
|
|
2972
2774
|
// Visit typeParameters if present
|
|
2973
2775
|
if (memberReference.typeParameters && otherMemberReference.typeParameters) {
|
|
2974
2776
|
if (memberReference.typeParameters.elements.length !== otherMemberReference.typeParameters.elements.length) {
|
|
2975
|
-
this.abort();
|
|
2976
|
-
return memberReference;
|
|
2777
|
+
return this.abort(memberReference);
|
|
2977
2778
|
}
|
|
2978
2779
|
// Visit each type parameter in lock step
|
|
2979
2780
|
for (let i = 0; i < memberReference.typeParameters.elements.length; i++) {
|
|
@@ -2999,14 +2800,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
2999
2800
|
visitMethodDeclaration(methodDeclaration, other) {
|
|
3000
2801
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3001
2802
|
if (!this.match || other.kind !== java_1.J.Kind.MethodDeclaration) {
|
|
3002
|
-
this.abort();
|
|
3003
|
-
return methodDeclaration;
|
|
2803
|
+
return this.abort(methodDeclaration);
|
|
3004
2804
|
}
|
|
3005
2805
|
const otherMethodDeclaration = other;
|
|
3006
2806
|
// Compare leadingAnnotations
|
|
3007
2807
|
if (methodDeclaration.leadingAnnotations.length !== otherMethodDeclaration.leadingAnnotations.length) {
|
|
3008
|
-
this.abort();
|
|
3009
|
-
return methodDeclaration;
|
|
2808
|
+
return this.abort(methodDeclaration);
|
|
3010
2809
|
}
|
|
3011
2810
|
// Visit each leading annotation in lock step
|
|
3012
2811
|
for (let i = 0; i < methodDeclaration.leadingAnnotations.length; i++) {
|
|
@@ -3016,8 +2815,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3016
2815
|
}
|
|
3017
2816
|
// Compare modifiers
|
|
3018
2817
|
if (methodDeclaration.modifiers.length !== otherMethodDeclaration.modifiers.length) {
|
|
3019
|
-
this.abort();
|
|
3020
|
-
return methodDeclaration;
|
|
2818
|
+
return this.abort(methodDeclaration);
|
|
3021
2819
|
}
|
|
3022
2820
|
// Visit each modifier in lock step
|
|
3023
2821
|
for (let i = 0; i < methodDeclaration.modifiers.length; i++) {
|
|
@@ -3027,8 +2825,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3027
2825
|
}
|
|
3028
2826
|
// Compare typeParameters
|
|
3029
2827
|
if ((methodDeclaration.typeParameters === undefined) !== (otherMethodDeclaration.typeParameters === undefined)) {
|
|
3030
|
-
this.abort();
|
|
3031
|
-
return methodDeclaration;
|
|
2828
|
+
return this.abort(methodDeclaration);
|
|
3032
2829
|
}
|
|
3033
2830
|
// Visit typeParameters if present
|
|
3034
2831
|
if (methodDeclaration.typeParameters && otherMethodDeclaration.typeParameters) {
|
|
@@ -3038,8 +2835,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3038
2835
|
}
|
|
3039
2836
|
// Compare returnTypeExpression
|
|
3040
2837
|
if ((methodDeclaration.returnTypeExpression === undefined) !== (otherMethodDeclaration.returnTypeExpression === undefined)) {
|
|
3041
|
-
this.abort();
|
|
3042
|
-
return methodDeclaration;
|
|
2838
|
+
return this.abort(methodDeclaration);
|
|
3043
2839
|
}
|
|
3044
2840
|
// Visit returnTypeExpression if present
|
|
3045
2841
|
if (methodDeclaration.returnTypeExpression && otherMethodDeclaration.returnTypeExpression) {
|
|
@@ -3049,8 +2845,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3049
2845
|
}
|
|
3050
2846
|
// Compare nameAnnotations
|
|
3051
2847
|
if (methodDeclaration.nameAnnotations.length !== otherMethodDeclaration.nameAnnotations.length) {
|
|
3052
|
-
this.abort();
|
|
3053
|
-
return methodDeclaration;
|
|
2848
|
+
return this.abort(methodDeclaration);
|
|
3054
2849
|
}
|
|
3055
2850
|
// Visit each name annotation in lock step
|
|
3056
2851
|
for (let i = 0; i < methodDeclaration.nameAnnotations.length; i++) {
|
|
@@ -3064,8 +2859,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3064
2859
|
return methodDeclaration;
|
|
3065
2860
|
// Compare parameters
|
|
3066
2861
|
if (methodDeclaration.parameters.elements.length !== otherMethodDeclaration.parameters.elements.length) {
|
|
3067
|
-
this.abort();
|
|
3068
|
-
return methodDeclaration;
|
|
2862
|
+
return this.abort(methodDeclaration);
|
|
3069
2863
|
}
|
|
3070
2864
|
// Visit each parameter in lock step
|
|
3071
2865
|
for (let i = 0; i < methodDeclaration.parameters.elements.length; i++) {
|
|
@@ -3075,14 +2869,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3075
2869
|
}
|
|
3076
2870
|
// Compare throws
|
|
3077
2871
|
if ((methodDeclaration.throws === undefined) !== (otherMethodDeclaration.throws === undefined)) {
|
|
3078
|
-
this.abort();
|
|
3079
|
-
return methodDeclaration;
|
|
2872
|
+
return this.abort(methodDeclaration);
|
|
3080
2873
|
}
|
|
3081
2874
|
// Visit throws if present
|
|
3082
2875
|
if (methodDeclaration.throws && otherMethodDeclaration.throws) {
|
|
3083
2876
|
if (methodDeclaration.throws.elements.length !== otherMethodDeclaration.throws.elements.length) {
|
|
3084
|
-
this.abort();
|
|
3085
|
-
return methodDeclaration;
|
|
2877
|
+
return this.abort(methodDeclaration);
|
|
3086
2878
|
}
|
|
3087
2879
|
// Visit each throw in lock step
|
|
3088
2880
|
for (let i = 0; i < methodDeclaration.throws.elements.length; i++) {
|
|
@@ -3093,8 +2885,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3093
2885
|
}
|
|
3094
2886
|
// Compare body
|
|
3095
2887
|
if ((methodDeclaration.body === undefined) !== (otherMethodDeclaration.body === undefined)) {
|
|
3096
|
-
this.abort();
|
|
3097
|
-
return methodDeclaration;
|
|
2888
|
+
return this.abort(methodDeclaration);
|
|
3098
2889
|
}
|
|
3099
2890
|
// Visit body if present
|
|
3100
2891
|
if (methodDeclaration.body && otherMethodDeclaration.body) {
|
|
@@ -3104,8 +2895,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3104
2895
|
}
|
|
3105
2896
|
// Compare defaultValue
|
|
3106
2897
|
if ((methodDeclaration.defaultValue === undefined) !== (otherMethodDeclaration.defaultValue === undefined)) {
|
|
3107
|
-
this.abort();
|
|
3108
|
-
return methodDeclaration;
|
|
2898
|
+
return this.abort(methodDeclaration);
|
|
3109
2899
|
}
|
|
3110
2900
|
// Visit defaultValue if present
|
|
3111
2901
|
if (methodDeclaration.defaultValue && otherMethodDeclaration.defaultValue) {
|
|
@@ -3126,14 +2916,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3126
2916
|
visitMethodInvocation(methodInvocation, other) {
|
|
3127
2917
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3128
2918
|
if (!this.match || other.kind !== java_1.J.Kind.MethodInvocation) {
|
|
3129
|
-
this.abort();
|
|
3130
|
-
return methodInvocation;
|
|
2919
|
+
return this.abort(methodInvocation);
|
|
3131
2920
|
}
|
|
3132
2921
|
const otherMethodInvocation = other;
|
|
3133
2922
|
// Compare select
|
|
3134
2923
|
if ((methodInvocation.select === undefined) !== (otherMethodInvocation.select === undefined)) {
|
|
3135
|
-
this.abort();
|
|
3136
|
-
return methodInvocation;
|
|
2924
|
+
return this.abort(methodInvocation);
|
|
3137
2925
|
}
|
|
3138
2926
|
// Visit select if present
|
|
3139
2927
|
if (methodInvocation.select && otherMethodInvocation.select) {
|
|
@@ -3143,14 +2931,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3143
2931
|
}
|
|
3144
2932
|
// Compare typeParameters
|
|
3145
2933
|
if ((methodInvocation.typeParameters === undefined) !== (otherMethodInvocation.typeParameters === undefined)) {
|
|
3146
|
-
this.abort();
|
|
3147
|
-
return methodInvocation;
|
|
2934
|
+
return this.abort(methodInvocation);
|
|
3148
2935
|
}
|
|
3149
2936
|
// Visit typeParameters if present
|
|
3150
2937
|
if (methodInvocation.typeParameters && otherMethodInvocation.typeParameters) {
|
|
3151
2938
|
if (methodInvocation.typeParameters.elements.length !== otherMethodInvocation.typeParameters.elements.length) {
|
|
3152
|
-
this.abort();
|
|
3153
|
-
return methodInvocation;
|
|
2939
|
+
return this.abort(methodInvocation);
|
|
3154
2940
|
}
|
|
3155
2941
|
// Visit each type parameter in lock step
|
|
3156
2942
|
for (let i = 0; i < methodInvocation.typeParameters.elements.length; i++) {
|
|
@@ -3165,8 +2951,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3165
2951
|
return methodInvocation;
|
|
3166
2952
|
// Compare arguments
|
|
3167
2953
|
if (methodInvocation.arguments.elements.length !== otherMethodInvocation.arguments.elements.length) {
|
|
3168
|
-
this.abort();
|
|
3169
|
-
return methodInvocation;
|
|
2954
|
+
return this.abort(methodInvocation);
|
|
3170
2955
|
}
|
|
3171
2956
|
// Visit each argument in lock step
|
|
3172
2957
|
for (let i = 0; i < methodInvocation.arguments.elements.length; i++) {
|
|
@@ -3187,24 +2972,20 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3187
2972
|
visitModifier(modifier, other) {
|
|
3188
2973
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3189
2974
|
if (!this.match || other.kind !== java_1.J.Kind.Modifier) {
|
|
3190
|
-
this.abort();
|
|
3191
|
-
return modifier;
|
|
2975
|
+
return this.abort(modifier);
|
|
3192
2976
|
}
|
|
3193
2977
|
const otherModifier = other;
|
|
3194
2978
|
// Compare keyword
|
|
3195
2979
|
if (modifier.keyword !== otherModifier.keyword) {
|
|
3196
|
-
this.abort();
|
|
3197
|
-
return modifier;
|
|
2980
|
+
return this.abort(modifier);
|
|
3198
2981
|
}
|
|
3199
2982
|
// Compare type
|
|
3200
2983
|
if (modifier.type !== otherModifier.type) {
|
|
3201
|
-
this.abort();
|
|
3202
|
-
return modifier;
|
|
2984
|
+
return this.abort(modifier);
|
|
3203
2985
|
}
|
|
3204
2986
|
// Compare annotations
|
|
3205
2987
|
if (modifier.annotations.length !== otherModifier.annotations.length) {
|
|
3206
|
-
this.abort();
|
|
3207
|
-
return modifier;
|
|
2988
|
+
return this.abort(modifier);
|
|
3208
2989
|
}
|
|
3209
2990
|
// Visit each annotation in lock step
|
|
3210
2991
|
for (let i = 0; i < modifier.annotations.length; i++) {
|
|
@@ -3225,14 +3006,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3225
3006
|
visitMultiCatch(multiCatch, other) {
|
|
3226
3007
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3227
3008
|
if (!this.match || other.kind !== java_1.J.Kind.MultiCatch) {
|
|
3228
|
-
this.abort();
|
|
3229
|
-
return multiCatch;
|
|
3009
|
+
return this.abort(multiCatch);
|
|
3230
3010
|
}
|
|
3231
3011
|
const otherMultiCatch = other;
|
|
3232
3012
|
// Compare alternatives
|
|
3233
3013
|
if (multiCatch.alternatives.length !== otherMultiCatch.alternatives.length) {
|
|
3234
|
-
this.abort();
|
|
3235
|
-
return multiCatch;
|
|
3014
|
+
return this.abort(multiCatch);
|
|
3236
3015
|
}
|
|
3237
3016
|
// Visit each alternative in lock step
|
|
3238
3017
|
for (let i = 0; i < multiCatch.alternatives.length; i++) {
|
|
@@ -3253,14 +3032,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3253
3032
|
visitNewArray(newArray, other) {
|
|
3254
3033
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3255
3034
|
if (!this.match || other.kind !== java_1.J.Kind.NewArray) {
|
|
3256
|
-
this.abort();
|
|
3257
|
-
return newArray;
|
|
3035
|
+
return this.abort(newArray);
|
|
3258
3036
|
}
|
|
3259
3037
|
const otherNewArray = other;
|
|
3260
3038
|
// Compare typeExpression
|
|
3261
3039
|
if ((newArray.typeExpression === undefined) !== (otherNewArray.typeExpression === undefined)) {
|
|
3262
|
-
this.abort();
|
|
3263
|
-
return newArray;
|
|
3040
|
+
return this.abort(newArray);
|
|
3264
3041
|
}
|
|
3265
3042
|
// Visit typeExpression if present
|
|
3266
3043
|
if (newArray.typeExpression && otherNewArray.typeExpression) {
|
|
@@ -3270,8 +3047,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3270
3047
|
}
|
|
3271
3048
|
// Compare dimensions
|
|
3272
3049
|
if (newArray.dimensions.length !== otherNewArray.dimensions.length) {
|
|
3273
|
-
this.abort();
|
|
3274
|
-
return newArray;
|
|
3050
|
+
return this.abort(newArray);
|
|
3275
3051
|
}
|
|
3276
3052
|
// Visit each dimension in lock step
|
|
3277
3053
|
for (let i = 0; i < newArray.dimensions.length; i++) {
|
|
@@ -3281,14 +3057,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3281
3057
|
}
|
|
3282
3058
|
// Compare initializer
|
|
3283
3059
|
if ((newArray.initializer === undefined) !== (otherNewArray.initializer === undefined)) {
|
|
3284
|
-
this.abort();
|
|
3285
|
-
return newArray;
|
|
3060
|
+
return this.abort(newArray);
|
|
3286
3061
|
}
|
|
3287
3062
|
// Visit initializer if present
|
|
3288
3063
|
if (newArray.initializer && otherNewArray.initializer) {
|
|
3289
3064
|
if (newArray.initializer.elements.length !== otherNewArray.initializer.elements.length) {
|
|
3290
|
-
this.abort();
|
|
3291
|
-
return newArray;
|
|
3065
|
+
return this.abort(newArray);
|
|
3292
3066
|
}
|
|
3293
3067
|
// Visit each initializer element in lock step
|
|
3294
3068
|
for (let i = 0; i < newArray.initializer.elements.length; i++) {
|
|
@@ -3310,14 +3084,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3310
3084
|
visitNewClass(newClass, other) {
|
|
3311
3085
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3312
3086
|
if (!this.match || other.kind !== java_1.J.Kind.NewClass) {
|
|
3313
|
-
this.abort();
|
|
3314
|
-
return newClass;
|
|
3087
|
+
return this.abort(newClass);
|
|
3315
3088
|
}
|
|
3316
3089
|
const otherNewClass = other;
|
|
3317
3090
|
// Compare enclosing
|
|
3318
3091
|
if ((newClass.enclosing === undefined) !== (otherNewClass.enclosing === undefined)) {
|
|
3319
|
-
this.abort();
|
|
3320
|
-
return newClass;
|
|
3092
|
+
return this.abort(newClass);
|
|
3321
3093
|
}
|
|
3322
3094
|
// Visit enclosing if present
|
|
3323
3095
|
if (newClass.enclosing && otherNewClass.enclosing) {
|
|
@@ -3327,8 +3099,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3327
3099
|
}
|
|
3328
3100
|
// Compare class
|
|
3329
3101
|
if ((newClass.class === undefined) !== (otherNewClass.class === undefined)) {
|
|
3330
|
-
this.abort();
|
|
3331
|
-
return newClass;
|
|
3102
|
+
return this.abort(newClass);
|
|
3332
3103
|
}
|
|
3333
3104
|
// Visit class if present
|
|
3334
3105
|
if (newClass.class && otherNewClass.class) {
|
|
@@ -3338,8 +3109,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3338
3109
|
}
|
|
3339
3110
|
// Compare arguments
|
|
3340
3111
|
if (newClass.arguments.elements.length !== otherNewClass.arguments.elements.length) {
|
|
3341
|
-
this.abort();
|
|
3342
|
-
return newClass;
|
|
3112
|
+
return this.abort(newClass);
|
|
3343
3113
|
}
|
|
3344
3114
|
// Visit each argument in lock step
|
|
3345
3115
|
for (let i = 0; i < newClass.arguments.elements.length; i++) {
|
|
@@ -3349,8 +3119,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3349
3119
|
}
|
|
3350
3120
|
// Compare body
|
|
3351
3121
|
if ((newClass.body === undefined) !== (otherNewClass.body === undefined)) {
|
|
3352
|
-
this.abort();
|
|
3353
|
-
return newClass;
|
|
3122
|
+
return this.abort(newClass);
|
|
3354
3123
|
}
|
|
3355
3124
|
// Visit body if present
|
|
3356
3125
|
if (newClass.body && otherNewClass.body) {
|
|
@@ -3371,14 +3140,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3371
3140
|
visitNullableType(nullableType, other) {
|
|
3372
3141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3373
3142
|
if (!this.match || other.kind !== java_1.J.Kind.NullableType) {
|
|
3374
|
-
this.abort();
|
|
3375
|
-
return nullableType;
|
|
3143
|
+
return this.abort(nullableType);
|
|
3376
3144
|
}
|
|
3377
3145
|
const otherNullableType = other;
|
|
3378
3146
|
// Compare annotations
|
|
3379
3147
|
if (nullableType.annotations.length !== otherNullableType.annotations.length) {
|
|
3380
|
-
this.abort();
|
|
3381
|
-
return nullableType;
|
|
3148
|
+
return this.abort(nullableType);
|
|
3382
3149
|
}
|
|
3383
3150
|
// Visit each annotation in lock step
|
|
3384
3151
|
for (let i = 0; i < nullableType.annotations.length; i++) {
|
|
@@ -3403,8 +3170,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3403
3170
|
visitPackage(packageDeclaration, other) {
|
|
3404
3171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3405
3172
|
if (!this.match || other.kind !== java_1.J.Kind.Package) {
|
|
3406
|
-
this.abort();
|
|
3407
|
-
return packageDeclaration;
|
|
3173
|
+
return this.abort(packageDeclaration);
|
|
3408
3174
|
}
|
|
3409
3175
|
const otherPackageDeclaration = other;
|
|
3410
3176
|
// Visit expression
|
|
@@ -3413,14 +3179,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3413
3179
|
return packageDeclaration;
|
|
3414
3180
|
// Compare annotations
|
|
3415
3181
|
if ((packageDeclaration.annotations === undefined) !== (otherPackageDeclaration.annotations === undefined)) {
|
|
3416
|
-
this.abort();
|
|
3417
|
-
return packageDeclaration;
|
|
3182
|
+
return this.abort(packageDeclaration);
|
|
3418
3183
|
}
|
|
3419
3184
|
// Visit annotations if present
|
|
3420
3185
|
if (packageDeclaration.annotations && otherPackageDeclaration.annotations) {
|
|
3421
3186
|
if (packageDeclaration.annotations.length !== otherPackageDeclaration.annotations.length) {
|
|
3422
|
-
this.abort();
|
|
3423
|
-
return packageDeclaration;
|
|
3187
|
+
return this.abort(packageDeclaration);
|
|
3424
3188
|
}
|
|
3425
3189
|
// Visit each annotation in lock step
|
|
3426
3190
|
for (let i = 0; i < packageDeclaration.annotations.length; i++) {
|
|
@@ -3442,8 +3206,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3442
3206
|
visitParameterizedType(parameterizedType, other) {
|
|
3443
3207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3444
3208
|
if (!this.match || other.kind !== java_1.J.Kind.ParameterizedType) {
|
|
3445
|
-
this.abort();
|
|
3446
|
-
return parameterizedType;
|
|
3209
|
+
return this.abort(parameterizedType);
|
|
3447
3210
|
}
|
|
3448
3211
|
const otherParameterizedType = other;
|
|
3449
3212
|
// Visit class
|
|
@@ -3452,14 +3215,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3452
3215
|
return parameterizedType;
|
|
3453
3216
|
// Compare typeParameters
|
|
3454
3217
|
if ((parameterizedType.typeParameters === undefined) !== (otherParameterizedType.typeParameters === undefined)) {
|
|
3455
|
-
this.abort();
|
|
3456
|
-
return parameterizedType;
|
|
3218
|
+
return this.abort(parameterizedType);
|
|
3457
3219
|
}
|
|
3458
3220
|
// Visit typeParameters if present
|
|
3459
3221
|
if (parameterizedType.typeParameters && otherParameterizedType.typeParameters) {
|
|
3460
3222
|
if (parameterizedType.typeParameters.elements.length !== otherParameterizedType.typeParameters.elements.length) {
|
|
3461
|
-
this.abort();
|
|
3462
|
-
return parameterizedType;
|
|
3223
|
+
return this.abort(parameterizedType);
|
|
3463
3224
|
}
|
|
3464
3225
|
// Visit each type parameter in lock step
|
|
3465
3226
|
for (let i = 0; i < parameterizedType.typeParameters.elements.length; i++) {
|
|
@@ -3481,8 +3242,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3481
3242
|
visitParentheses(parentheses, other) {
|
|
3482
3243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3483
3244
|
if (!this.match || other.kind !== java_1.J.Kind.Parentheses) {
|
|
3484
|
-
this.abort();
|
|
3485
|
-
return parentheses;
|
|
3245
|
+
return this.abort(parentheses);
|
|
3486
3246
|
}
|
|
3487
3247
|
const otherParentheses = other;
|
|
3488
3248
|
// Visit tree
|
|
@@ -3502,14 +3262,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3502
3262
|
visitParenthesizedTypeTree(parenthesizedTypeTree, other) {
|
|
3503
3263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3504
3264
|
if (!this.match || other.kind !== java_1.J.Kind.ParenthesizedTypeTree) {
|
|
3505
|
-
this.abort();
|
|
3506
|
-
return parenthesizedTypeTree;
|
|
3265
|
+
return this.abort(parenthesizedTypeTree);
|
|
3507
3266
|
}
|
|
3508
3267
|
const otherParenthesizedTypeTree = other;
|
|
3509
3268
|
// Compare annotations
|
|
3510
3269
|
if (parenthesizedTypeTree.annotations.length !== otherParenthesizedTypeTree.annotations.length) {
|
|
3511
|
-
this.abort();
|
|
3512
|
-
return parenthesizedTypeTree;
|
|
3270
|
+
return this.abort(parenthesizedTypeTree);
|
|
3513
3271
|
}
|
|
3514
3272
|
// Visit each annotation in lock step
|
|
3515
3273
|
for (let i = 0; i < parenthesizedTypeTree.annotations.length; i++) {
|
|
@@ -3534,14 +3292,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3534
3292
|
visitPrimitive(primitive, other) {
|
|
3535
3293
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3536
3294
|
if (!this.match || other.kind !== java_1.J.Kind.Primitive) {
|
|
3537
|
-
this.abort();
|
|
3538
|
-
return primitive;
|
|
3295
|
+
return this.abort(primitive);
|
|
3539
3296
|
}
|
|
3540
3297
|
const otherPrimitive = other;
|
|
3541
3298
|
// Compare type
|
|
3542
3299
|
if (primitive.type.kind !== otherPrimitive.type.kind) {
|
|
3543
|
-
this.abort();
|
|
3544
|
-
return primitive;
|
|
3300
|
+
return this.abort(primitive);
|
|
3545
3301
|
}
|
|
3546
3302
|
return primitive;
|
|
3547
3303
|
});
|
|
@@ -3556,14 +3312,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3556
3312
|
visitReturn(returnStatement, other) {
|
|
3557
3313
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3558
3314
|
if (!this.match || other.kind !== java_1.J.Kind.Return) {
|
|
3559
|
-
this.abort();
|
|
3560
|
-
return returnStatement;
|
|
3315
|
+
return this.abort(returnStatement);
|
|
3561
3316
|
}
|
|
3562
3317
|
const otherReturnStatement = other;
|
|
3563
3318
|
// Compare expression
|
|
3564
3319
|
if ((returnStatement.expression === undefined) !== (otherReturnStatement.expression === undefined)) {
|
|
3565
|
-
this.abort();
|
|
3566
|
-
return returnStatement;
|
|
3320
|
+
return this.abort(returnStatement);
|
|
3567
3321
|
}
|
|
3568
3322
|
// Visit expression if present
|
|
3569
3323
|
if (returnStatement.expression && otherReturnStatement.expression) {
|
|
@@ -3584,8 +3338,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3584
3338
|
visitSwitch(switchStatement, other) {
|
|
3585
3339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3586
3340
|
if (!this.match || other.kind !== java_1.J.Kind.Switch) {
|
|
3587
|
-
this.abort();
|
|
3588
|
-
return switchStatement;
|
|
3341
|
+
return this.abort(switchStatement);
|
|
3589
3342
|
}
|
|
3590
3343
|
const otherSwitchStatement = other;
|
|
3591
3344
|
// Visit selector
|
|
@@ -3609,8 +3362,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3609
3362
|
visitSwitchExpression(switchExpression, other) {
|
|
3610
3363
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3611
3364
|
if (!this.match || other.kind !== java_1.J.Kind.SwitchExpression) {
|
|
3612
|
-
this.abort();
|
|
3613
|
-
return switchExpression;
|
|
3365
|
+
return this.abort(switchExpression);
|
|
3614
3366
|
}
|
|
3615
3367
|
const otherSwitchExpression = other;
|
|
3616
3368
|
// Visit selector
|
|
@@ -3634,8 +3386,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3634
3386
|
visitSynchronized(synchronizedStatement, other) {
|
|
3635
3387
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3636
3388
|
if (!this.match || other.kind !== java_1.J.Kind.Synchronized) {
|
|
3637
|
-
this.abort();
|
|
3638
|
-
return synchronizedStatement;
|
|
3389
|
+
return this.abort(synchronizedStatement);
|
|
3639
3390
|
}
|
|
3640
3391
|
const otherSynchronizedStatement = other;
|
|
3641
3392
|
// Visit lock
|
|
@@ -3659,8 +3410,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3659
3410
|
visitTernary(ternary, other) {
|
|
3660
3411
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3661
3412
|
if (!this.match || other.kind !== java_1.J.Kind.Ternary) {
|
|
3662
|
-
this.abort();
|
|
3663
|
-
return ternary;
|
|
3413
|
+
return this.abort(ternary);
|
|
3664
3414
|
}
|
|
3665
3415
|
const otherTernary = other;
|
|
3666
3416
|
// Visit condition
|
|
@@ -3688,8 +3438,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3688
3438
|
visitThrow(throwStatement, other) {
|
|
3689
3439
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3690
3440
|
if (!this.match || other.kind !== java_1.J.Kind.Throw) {
|
|
3691
|
-
this.abort();
|
|
3692
|
-
return throwStatement;
|
|
3441
|
+
return this.abort(throwStatement);
|
|
3693
3442
|
}
|
|
3694
3443
|
const otherThrowStatement = other;
|
|
3695
3444
|
// Visit exception
|
|
@@ -3709,20 +3458,17 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3709
3458
|
visitTry(tryStatement, other) {
|
|
3710
3459
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3711
3460
|
if (!this.match || other.kind !== java_1.J.Kind.Try) {
|
|
3712
|
-
this.abort();
|
|
3713
|
-
return tryStatement;
|
|
3461
|
+
return this.abort(tryStatement);
|
|
3714
3462
|
}
|
|
3715
3463
|
const otherTryStatement = other;
|
|
3716
3464
|
// Compare resources
|
|
3717
3465
|
if ((tryStatement.resources === undefined) !== (otherTryStatement.resources === undefined)) {
|
|
3718
|
-
this.abort();
|
|
3719
|
-
return tryStatement;
|
|
3466
|
+
return this.abort(tryStatement);
|
|
3720
3467
|
}
|
|
3721
3468
|
// Visit resources if present
|
|
3722
3469
|
if (tryStatement.resources && otherTryStatement.resources) {
|
|
3723
3470
|
if (tryStatement.resources.elements.length !== otherTryStatement.resources.elements.length) {
|
|
3724
|
-
this.abort();
|
|
3725
|
-
return tryStatement;
|
|
3471
|
+
return this.abort(tryStatement);
|
|
3726
3472
|
}
|
|
3727
3473
|
// Visit each resource in lock step
|
|
3728
3474
|
for (let i = 0; i < tryStatement.resources.elements.length; i++) {
|
|
@@ -3737,8 +3483,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3737
3483
|
return tryStatement;
|
|
3738
3484
|
// Compare catches
|
|
3739
3485
|
if (tryStatement.catches.length !== otherTryStatement.catches.length) {
|
|
3740
|
-
this.abort();
|
|
3741
|
-
return tryStatement;
|
|
3486
|
+
return this.abort(tryStatement);
|
|
3742
3487
|
}
|
|
3743
3488
|
// Visit each catch in lock step
|
|
3744
3489
|
for (let i = 0; i < tryStatement.catches.length; i++) {
|
|
@@ -3748,8 +3493,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3748
3493
|
}
|
|
3749
3494
|
// Compare finally
|
|
3750
3495
|
if ((tryStatement.finally === undefined) !== (otherTryStatement.finally === undefined)) {
|
|
3751
|
-
this.abort();
|
|
3752
|
-
return tryStatement;
|
|
3496
|
+
return this.abort(tryStatement);
|
|
3753
3497
|
}
|
|
3754
3498
|
// Visit finally if present
|
|
3755
3499
|
if (tryStatement.finally && otherTryStatement.finally) {
|
|
@@ -3770,8 +3514,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3770
3514
|
visitTryResource(resource, other) {
|
|
3771
3515
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3772
3516
|
if (!this.match || other.kind !== java_1.J.Kind.TryResource) {
|
|
3773
|
-
this.abort();
|
|
3774
|
-
return resource;
|
|
3517
|
+
return this.abort(resource);
|
|
3775
3518
|
}
|
|
3776
3519
|
const otherResource = other;
|
|
3777
3520
|
// Visit variableDeclarations
|
|
@@ -3780,8 +3523,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3780
3523
|
return resource;
|
|
3781
3524
|
// Compare terminatedWithSemicolon
|
|
3782
3525
|
if (resource.terminatedWithSemicolon !== otherResource.terminatedWithSemicolon) {
|
|
3783
|
-
this.abort();
|
|
3784
|
-
return resource;
|
|
3526
|
+
return this.abort(resource);
|
|
3785
3527
|
}
|
|
3786
3528
|
return resource;
|
|
3787
3529
|
});
|
|
@@ -3796,8 +3538,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3796
3538
|
visitTryCatch(tryCatch, other) {
|
|
3797
3539
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3798
3540
|
if (!this.match || other.kind !== java_1.J.Kind.TryCatch) {
|
|
3799
|
-
this.abort();
|
|
3800
|
-
return tryCatch;
|
|
3541
|
+
return this.abort(tryCatch);
|
|
3801
3542
|
}
|
|
3802
3543
|
const otherTryCatch = other;
|
|
3803
3544
|
// Visit parameter
|
|
@@ -3821,8 +3562,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3821
3562
|
visitTypeCast(typeCast, other) {
|
|
3822
3563
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3823
3564
|
if (!this.match || other.kind !== java_1.J.Kind.TypeCast) {
|
|
3824
|
-
this.abort();
|
|
3825
|
-
return typeCast;
|
|
3565
|
+
return this.abort(typeCast);
|
|
3826
3566
|
}
|
|
3827
3567
|
const otherTypeCast = other;
|
|
3828
3568
|
// Visit class
|
|
@@ -3846,14 +3586,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3846
3586
|
visitTypeParameter(typeParameter, other) {
|
|
3847
3587
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3848
3588
|
if (!this.match || other.kind !== java_1.J.Kind.TypeParameter) {
|
|
3849
|
-
this.abort();
|
|
3850
|
-
return typeParameter;
|
|
3589
|
+
return this.abort(typeParameter);
|
|
3851
3590
|
}
|
|
3852
3591
|
const otherTypeParameter = other;
|
|
3853
3592
|
// Compare annotations
|
|
3854
3593
|
if (typeParameter.annotations.length !== otherTypeParameter.annotations.length) {
|
|
3855
|
-
this.abort();
|
|
3856
|
-
return typeParameter;
|
|
3594
|
+
return this.abort(typeParameter);
|
|
3857
3595
|
}
|
|
3858
3596
|
// Visit each annotation in lock step
|
|
3859
3597
|
for (let i = 0; i < typeParameter.annotations.length; i++) {
|
|
@@ -3863,8 +3601,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3863
3601
|
}
|
|
3864
3602
|
// Compare modifiers
|
|
3865
3603
|
if (typeParameter.modifiers.length !== otherTypeParameter.modifiers.length) {
|
|
3866
|
-
this.abort();
|
|
3867
|
-
return typeParameter;
|
|
3604
|
+
return this.abort(typeParameter);
|
|
3868
3605
|
}
|
|
3869
3606
|
// Visit each modifier in lock step
|
|
3870
3607
|
for (let i = 0; i < typeParameter.modifiers.length; i++) {
|
|
@@ -3878,14 +3615,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3878
3615
|
return typeParameter;
|
|
3879
3616
|
// Compare bounds
|
|
3880
3617
|
if ((typeParameter.bounds === undefined) !== (otherTypeParameter.bounds === undefined)) {
|
|
3881
|
-
this.abort();
|
|
3882
|
-
return typeParameter;
|
|
3618
|
+
return this.abort(typeParameter);
|
|
3883
3619
|
}
|
|
3884
3620
|
// Visit bounds if present
|
|
3885
3621
|
if (typeParameter.bounds && otherTypeParameter.bounds) {
|
|
3886
3622
|
if (typeParameter.bounds.elements.length !== otherTypeParameter.bounds.elements.length) {
|
|
3887
|
-
this.abort();
|
|
3888
|
-
return typeParameter;
|
|
3623
|
+
return this.abort(typeParameter);
|
|
3889
3624
|
}
|
|
3890
3625
|
// Visit each bound in lock step
|
|
3891
3626
|
for (let i = 0; i < typeParameter.bounds.elements.length; i++) {
|
|
@@ -3907,14 +3642,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3907
3642
|
visitTypeParameters(typeParameters, other) {
|
|
3908
3643
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3909
3644
|
if (!this.match || other.kind !== java_1.J.Kind.TypeParameters) {
|
|
3910
|
-
this.abort();
|
|
3911
|
-
return typeParameters;
|
|
3645
|
+
return this.abort(typeParameters);
|
|
3912
3646
|
}
|
|
3913
3647
|
const otherTypeParameters = other;
|
|
3914
3648
|
// Compare annotations
|
|
3915
3649
|
if (typeParameters.annotations.length !== otherTypeParameters.annotations.length) {
|
|
3916
|
-
this.abort();
|
|
3917
|
-
return typeParameters;
|
|
3650
|
+
return this.abort(typeParameters);
|
|
3918
3651
|
}
|
|
3919
3652
|
// Visit each annotation in lock step
|
|
3920
3653
|
for (let i = 0; i < typeParameters.annotations.length; i++) {
|
|
@@ -3924,8 +3657,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3924
3657
|
}
|
|
3925
3658
|
// Compare typeParameters
|
|
3926
3659
|
if (typeParameters.typeParameters.length !== otherTypeParameters.typeParameters.length) {
|
|
3927
|
-
this.abort();
|
|
3928
|
-
return typeParameters;
|
|
3660
|
+
return this.abort(typeParameters);
|
|
3929
3661
|
}
|
|
3930
3662
|
// Visit each type parameter in lock step
|
|
3931
3663
|
for (let i = 0; i < typeParameters.typeParameters.length; i++) {
|
|
@@ -3946,14 +3678,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3946
3678
|
visitUnary(unary, other) {
|
|
3947
3679
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3948
3680
|
if (!this.match || other.kind !== java_1.J.Kind.Unary) {
|
|
3949
|
-
this.abort();
|
|
3950
|
-
return unary;
|
|
3681
|
+
return this.abort(unary);
|
|
3951
3682
|
}
|
|
3952
3683
|
const otherUnary = other;
|
|
3953
3684
|
// Compare operator
|
|
3954
3685
|
if (unary.operator.element !== otherUnary.operator.element) {
|
|
3955
|
-
this.abort();
|
|
3956
|
-
return unary;
|
|
3686
|
+
return this.abort(unary);
|
|
3957
3687
|
}
|
|
3958
3688
|
// Visit expression
|
|
3959
3689
|
yield this.visit(unary.expression, otherUnary.expression);
|
|
@@ -3972,8 +3702,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3972
3702
|
visitUnknown(unknown, other) {
|
|
3973
3703
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3974
3704
|
if (!this.match || other.kind !== java_1.J.Kind.Unknown) {
|
|
3975
|
-
this.abort();
|
|
3976
|
-
return unknown;
|
|
3705
|
+
return this.abort(unknown);
|
|
3977
3706
|
}
|
|
3978
3707
|
const otherUnknown = other;
|
|
3979
3708
|
// Visit source
|
|
@@ -3993,14 +3722,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
3993
3722
|
visitUnknownSource(unknownSource, other) {
|
|
3994
3723
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3995
3724
|
if (!this.match || other.kind !== java_1.J.Kind.UnknownSource) {
|
|
3996
|
-
this.abort();
|
|
3997
|
-
return unknownSource;
|
|
3725
|
+
return this.abort(unknownSource);
|
|
3998
3726
|
}
|
|
3999
3727
|
const otherUnknownSource = other;
|
|
4000
3728
|
// Compare text
|
|
4001
3729
|
if (unknownSource.text !== otherUnknownSource.text) {
|
|
4002
|
-
this.abort();
|
|
4003
|
-
return unknownSource;
|
|
3730
|
+
return this.abort(unknownSource);
|
|
4004
3731
|
}
|
|
4005
3732
|
return unknownSource;
|
|
4006
3733
|
});
|
|
@@ -4015,14 +3742,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4015
3742
|
visitVariableDeclarations(variableDeclarations, other) {
|
|
4016
3743
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4017
3744
|
if (!this.match || other.kind !== java_1.J.Kind.VariableDeclarations) {
|
|
4018
|
-
this.abort();
|
|
4019
|
-
return variableDeclarations;
|
|
3745
|
+
return this.abort(variableDeclarations);
|
|
4020
3746
|
}
|
|
4021
3747
|
const otherVariableDeclarations = other;
|
|
4022
3748
|
// Compare leadingAnnotations
|
|
4023
3749
|
if (variableDeclarations.leadingAnnotations.length !== otherVariableDeclarations.leadingAnnotations.length) {
|
|
4024
|
-
this.abort();
|
|
4025
|
-
return variableDeclarations;
|
|
3750
|
+
return this.abort(variableDeclarations);
|
|
4026
3751
|
}
|
|
4027
3752
|
// Visit each leading annotation in lock step
|
|
4028
3753
|
for (let i = 0; i < variableDeclarations.leadingAnnotations.length; i++) {
|
|
@@ -4032,8 +3757,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4032
3757
|
}
|
|
4033
3758
|
// Compare modifiers
|
|
4034
3759
|
if (variableDeclarations.modifiers.length !== otherVariableDeclarations.modifiers.length) {
|
|
4035
|
-
this.abort();
|
|
4036
|
-
return variableDeclarations;
|
|
3760
|
+
return this.abort(variableDeclarations);
|
|
4037
3761
|
}
|
|
4038
3762
|
// Visit each modifier in lock step
|
|
4039
3763
|
for (let i = 0; i < variableDeclarations.modifiers.length; i++) {
|
|
@@ -4043,8 +3767,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4043
3767
|
}
|
|
4044
3768
|
// Compare typeExpression
|
|
4045
3769
|
if ((variableDeclarations.typeExpression === undefined) !== (otherVariableDeclarations.typeExpression === undefined)) {
|
|
4046
|
-
this.abort();
|
|
4047
|
-
return variableDeclarations;
|
|
3770
|
+
return this.abort(variableDeclarations);
|
|
4048
3771
|
}
|
|
4049
3772
|
// Visit typeExpression if present
|
|
4050
3773
|
if (variableDeclarations.typeExpression && otherVariableDeclarations.typeExpression) {
|
|
@@ -4054,13 +3777,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4054
3777
|
}
|
|
4055
3778
|
// Compare varargs
|
|
4056
3779
|
if ((variableDeclarations.varargs === undefined) !== (otherVariableDeclarations.varargs === undefined)) {
|
|
4057
|
-
this.abort();
|
|
4058
|
-
return variableDeclarations;
|
|
3780
|
+
return this.abort(variableDeclarations);
|
|
4059
3781
|
}
|
|
4060
3782
|
// Compare variables
|
|
4061
3783
|
if (variableDeclarations.variables.length !== otherVariableDeclarations.variables.length) {
|
|
4062
|
-
this.abort();
|
|
4063
|
-
return variableDeclarations;
|
|
3784
|
+
return this.abort(variableDeclarations);
|
|
4064
3785
|
}
|
|
4065
3786
|
// Visit each variable in lock step
|
|
4066
3787
|
for (let i = 0; i < variableDeclarations.variables.length; i++) {
|
|
@@ -4081,8 +3802,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4081
3802
|
visitVariable(variable, other) {
|
|
4082
3803
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4083
3804
|
if (!this.match || other.kind !== java_1.J.Kind.NamedVariable) {
|
|
4084
|
-
this.abort();
|
|
4085
|
-
return variable;
|
|
3805
|
+
return this.abort(variable);
|
|
4086
3806
|
}
|
|
4087
3807
|
const otherVariable = other;
|
|
4088
3808
|
// Visit name
|
|
@@ -4091,13 +3811,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4091
3811
|
return variable;
|
|
4092
3812
|
// Compare dimensionsAfterName
|
|
4093
3813
|
if (variable.dimensionsAfterName.length !== otherVariable.dimensionsAfterName.length) {
|
|
4094
|
-
this.abort();
|
|
4095
|
-
return variable;
|
|
3814
|
+
return this.abort(variable);
|
|
4096
3815
|
}
|
|
4097
3816
|
// Compare initializer
|
|
4098
3817
|
if ((variable.initializer === undefined) !== (otherVariable.initializer === undefined)) {
|
|
4099
|
-
this.abort();
|
|
4100
|
-
return variable;
|
|
3818
|
+
return this.abort(variable);
|
|
4101
3819
|
}
|
|
4102
3820
|
// Visit initializer if present
|
|
4103
3821
|
if (variable.initializer && otherVariable.initializer) {
|
|
@@ -4118,8 +3836,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4118
3836
|
visitWhileLoop(whileLoop, other) {
|
|
4119
3837
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4120
3838
|
if (!this.match || other.kind !== java_1.J.Kind.WhileLoop) {
|
|
4121
|
-
this.abort();
|
|
4122
|
-
return whileLoop;
|
|
3839
|
+
return this.abort(whileLoop);
|
|
4123
3840
|
}
|
|
4124
3841
|
const otherWhileLoop = other;
|
|
4125
3842
|
// Visit condition
|
|
@@ -4143,26 +3860,22 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4143
3860
|
visitWildcard(wildcard, other) {
|
|
4144
3861
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4145
3862
|
if (!this.match || other.kind !== java_1.J.Kind.Wildcard) {
|
|
4146
|
-
this.abort();
|
|
4147
|
-
return wildcard;
|
|
3863
|
+
return this.abort(wildcard);
|
|
4148
3864
|
}
|
|
4149
3865
|
const otherWildcard = other;
|
|
4150
3866
|
// Compare bound
|
|
4151
3867
|
if ((wildcard.bound === undefined) !== (otherWildcard.bound === undefined)) {
|
|
4152
|
-
this.abort();
|
|
4153
|
-
return wildcard;
|
|
3868
|
+
return this.abort(wildcard);
|
|
4154
3869
|
}
|
|
4155
3870
|
// Compare bound if present
|
|
4156
3871
|
if (wildcard.bound && otherWildcard.bound) {
|
|
4157
3872
|
if (wildcard.bound.element !== otherWildcard.bound.element) {
|
|
4158
|
-
this.abort();
|
|
4159
|
-
return wildcard;
|
|
3873
|
+
return this.abort(wildcard);
|
|
4160
3874
|
}
|
|
4161
3875
|
}
|
|
4162
3876
|
// Compare boundedType
|
|
4163
3877
|
if ((wildcard.boundedType === undefined) !== (otherWildcard.boundedType === undefined)) {
|
|
4164
|
-
this.abort();
|
|
4165
|
-
return wildcard;
|
|
3878
|
+
return this.abort(wildcard);
|
|
4166
3879
|
}
|
|
4167
3880
|
// Visit boundedType if present
|
|
4168
3881
|
if (wildcard.boundedType && otherWildcard.boundedType) {
|
|
@@ -4183,14 +3896,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4183
3896
|
visitYield(yieldStatement, other) {
|
|
4184
3897
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4185
3898
|
if (!this.match || other.kind !== java_1.J.Kind.Yield) {
|
|
4186
|
-
this.abort();
|
|
4187
|
-
return yieldStatement;
|
|
3899
|
+
return this.abort(yieldStatement);
|
|
4188
3900
|
}
|
|
4189
3901
|
const otherYieldStatement = other;
|
|
4190
3902
|
// Compare implicit
|
|
4191
3903
|
if (yieldStatement.implicit !== otherYieldStatement.implicit) {
|
|
4192
|
-
this.abort();
|
|
4193
|
-
return yieldStatement;
|
|
3904
|
+
return this.abort(yieldStatement);
|
|
4194
3905
|
}
|
|
4195
3906
|
// Visit value
|
|
4196
3907
|
yield this.visit(yieldStatement.value, otherYieldStatement.value);
|
|
@@ -4209,8 +3920,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4209
3920
|
visitVoid(void_, other) {
|
|
4210
3921
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4211
3922
|
if (!this.match || other.kind !== tree_1.JS.Kind.Void) {
|
|
4212
|
-
this.abort();
|
|
4213
|
-
return void_;
|
|
3923
|
+
return this.abort(void_);
|
|
4214
3924
|
}
|
|
4215
3925
|
const otherVoid = other;
|
|
4216
3926
|
// Visit expression
|
|
@@ -4228,8 +3938,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4228
3938
|
visitWithStatement(withStatement, other) {
|
|
4229
3939
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4230
3940
|
if (!this.match || other.kind !== tree_1.JS.Kind.WithStatement) {
|
|
4231
|
-
this.abort();
|
|
4232
|
-
return withStatement;
|
|
3941
|
+
return this.abort(withStatement);
|
|
4233
3942
|
}
|
|
4234
3943
|
const otherWithStatement = other;
|
|
4235
3944
|
// Visit expression
|
|
@@ -4251,14 +3960,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4251
3960
|
visitIndexSignatureDeclaration(indexSignatureDeclaration, other) {
|
|
4252
3961
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4253
3962
|
if (!this.match || other.kind !== tree_1.JS.Kind.IndexSignatureDeclaration) {
|
|
4254
|
-
this.abort();
|
|
4255
|
-
return indexSignatureDeclaration;
|
|
3963
|
+
return this.abort(indexSignatureDeclaration);
|
|
4256
3964
|
}
|
|
4257
3965
|
const otherIndexSignatureDeclaration = other;
|
|
4258
3966
|
// Compare modifiers
|
|
4259
3967
|
if (indexSignatureDeclaration.modifiers.length !== otherIndexSignatureDeclaration.modifiers.length) {
|
|
4260
|
-
this.abort();
|
|
4261
|
-
return indexSignatureDeclaration;
|
|
3968
|
+
return this.abort(indexSignatureDeclaration);
|
|
4262
3969
|
}
|
|
4263
3970
|
// Visit modifiers in lock step
|
|
4264
3971
|
for (let i = 0; i < indexSignatureDeclaration.modifiers.length; i++) {
|
|
@@ -4268,8 +3975,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4268
3975
|
}
|
|
4269
3976
|
// Compare parameters
|
|
4270
3977
|
if (indexSignatureDeclaration.parameters.elements.length !== otherIndexSignatureDeclaration.parameters.elements.length) {
|
|
4271
|
-
this.abort();
|
|
4272
|
-
return indexSignatureDeclaration;
|
|
3978
|
+
return this.abort(indexSignatureDeclaration);
|
|
4273
3979
|
}
|
|
4274
3980
|
// Visit parameters in lock step
|
|
4275
3981
|
for (let i = 0; i < indexSignatureDeclaration.parameters.elements.length; i++) {
|
|
@@ -4292,14 +3998,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4292
3998
|
visitForOfLoop(forOfLoop, other) {
|
|
4293
3999
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4294
4000
|
if (!this.match || other.kind !== tree_1.JS.Kind.ForOfLoop) {
|
|
4295
|
-
this.abort();
|
|
4296
|
-
return forOfLoop;
|
|
4001
|
+
return this.abort(forOfLoop);
|
|
4297
4002
|
}
|
|
4298
4003
|
const otherForOfLoop = other;
|
|
4299
4004
|
// Compare await
|
|
4300
4005
|
if ((forOfLoop.await === undefined) !== (otherForOfLoop.await === undefined)) {
|
|
4301
|
-
this.abort();
|
|
4302
|
-
return forOfLoop;
|
|
4006
|
+
return this.abort(forOfLoop);
|
|
4303
4007
|
}
|
|
4304
4008
|
// Visit loop
|
|
4305
4009
|
yield this.visit(forOfLoop.loop, otherForOfLoop.loop);
|
|
@@ -4318,8 +4022,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4318
4022
|
visitForInLoop(forInLoop, other) {
|
|
4319
4023
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4320
4024
|
if (!this.match || other.kind !== tree_1.JS.Kind.ForInLoop) {
|
|
4321
|
-
this.abort();
|
|
4322
|
-
return forInLoop;
|
|
4025
|
+
return this.abort(forInLoop);
|
|
4323
4026
|
}
|
|
4324
4027
|
const otherForInLoop = other;
|
|
4325
4028
|
// Visit control
|
|
@@ -4343,14 +4046,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4343
4046
|
visitNamespaceDeclaration(namespaceDeclaration, other) {
|
|
4344
4047
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4345
4048
|
if (!this.match || other.kind !== tree_1.JS.Kind.NamespaceDeclaration) {
|
|
4346
|
-
this.abort();
|
|
4347
|
-
return namespaceDeclaration;
|
|
4049
|
+
return this.abort(namespaceDeclaration);
|
|
4348
4050
|
}
|
|
4349
4051
|
const otherNamespaceDeclaration = other;
|
|
4350
4052
|
// Compare modifiers
|
|
4351
4053
|
if (namespaceDeclaration.modifiers.length !== otherNamespaceDeclaration.modifiers.length) {
|
|
4352
|
-
this.abort();
|
|
4353
|
-
return namespaceDeclaration;
|
|
4054
|
+
return this.abort(namespaceDeclaration);
|
|
4354
4055
|
}
|
|
4355
4056
|
// Visit each modifier in lock step
|
|
4356
4057
|
for (let i = 0; i < namespaceDeclaration.modifiers.length; i++) {
|
|
@@ -4360,8 +4061,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4360
4061
|
}
|
|
4361
4062
|
// Compare keywordType
|
|
4362
4063
|
if (namespaceDeclaration.keywordType.element !== otherNamespaceDeclaration.keywordType.element) {
|
|
4363
|
-
this.abort();
|
|
4364
|
-
return namespaceDeclaration;
|
|
4064
|
+
return this.abort(namespaceDeclaration);
|
|
4365
4065
|
}
|
|
4366
4066
|
// Visit name
|
|
4367
4067
|
yield this.visit(namespaceDeclaration.name.element, otherNamespaceDeclaration.name.element);
|
|
@@ -4369,8 +4069,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4369
4069
|
return namespaceDeclaration;
|
|
4370
4070
|
// Compare body
|
|
4371
4071
|
if ((namespaceDeclaration.body === undefined) !== (otherNamespaceDeclaration.body === undefined)) {
|
|
4372
|
-
this.abort();
|
|
4373
|
-
return namespaceDeclaration;
|
|
4072
|
+
return this.abort(namespaceDeclaration);
|
|
4374
4073
|
}
|
|
4375
4074
|
// Visit body if present
|
|
4376
4075
|
if (namespaceDeclaration.body && otherNamespaceDeclaration.body) {
|
|
@@ -4391,8 +4090,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4391
4090
|
visitTypeLiteral(typeLiteral, other) {
|
|
4392
4091
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4393
4092
|
if (!this.match || other.kind !== tree_1.JS.Kind.TypeLiteral) {
|
|
4394
|
-
this.abort();
|
|
4395
|
-
return typeLiteral;
|
|
4093
|
+
return this.abort(typeLiteral);
|
|
4396
4094
|
}
|
|
4397
4095
|
const otherTypeLiteral = other;
|
|
4398
4096
|
// Visit members
|
|
@@ -4412,14 +4110,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4412
4110
|
visitBindingElement(bindingElement, other) {
|
|
4413
4111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4414
4112
|
if (!this.match || other.kind !== tree_1.JS.Kind.BindingElement) {
|
|
4415
|
-
this.abort();
|
|
4416
|
-
return bindingElement;
|
|
4113
|
+
return this.abort(bindingElement);
|
|
4417
4114
|
}
|
|
4418
4115
|
const otherBindingElement = other;
|
|
4419
4116
|
// Compare propertyName
|
|
4420
4117
|
if ((bindingElement.propertyName === undefined) !== (otherBindingElement.propertyName === undefined)) {
|
|
4421
|
-
this.abort();
|
|
4422
|
-
return bindingElement;
|
|
4118
|
+
return this.abort(bindingElement);
|
|
4423
4119
|
}
|
|
4424
4120
|
// Visit propertyName if present
|
|
4425
4121
|
if (bindingElement.propertyName && otherBindingElement.propertyName) {
|
|
@@ -4433,8 +4129,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4433
4129
|
return bindingElement;
|
|
4434
4130
|
// Compare initializer
|
|
4435
4131
|
if ((bindingElement.initializer === undefined) !== (otherBindingElement.initializer === undefined)) {
|
|
4436
|
-
this.abort();
|
|
4437
|
-
return bindingElement;
|
|
4132
|
+
return this.abort(bindingElement);
|
|
4438
4133
|
}
|
|
4439
4134
|
// Visit initializer if present
|
|
4440
4135
|
if (bindingElement.initializer && otherBindingElement.initializer) {
|
|
@@ -4455,14 +4150,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4455
4150
|
visitArrayBindingPattern(arrayBindingPattern, other) {
|
|
4456
4151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4457
4152
|
if (!this.match || other.kind !== tree_1.JS.Kind.ArrayBindingPattern) {
|
|
4458
|
-
this.abort();
|
|
4459
|
-
return arrayBindingPattern;
|
|
4153
|
+
return this.abort(arrayBindingPattern);
|
|
4460
4154
|
}
|
|
4461
4155
|
const otherArrayBindingPattern = other;
|
|
4462
4156
|
// Compare elements
|
|
4463
4157
|
if (arrayBindingPattern.elements.elements.length !== otherArrayBindingPattern.elements.elements.length) {
|
|
4464
|
-
this.abort();
|
|
4465
|
-
return arrayBindingPattern;
|
|
4158
|
+
return this.abort(arrayBindingPattern);
|
|
4466
4159
|
}
|
|
4467
4160
|
// Visit each element in lock step
|
|
4468
4161
|
for (let i = 0; i < arrayBindingPattern.elements.elements.length; i++) {
|
|
@@ -4483,14 +4176,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4483
4176
|
visitExportDeclaration(exportDeclaration, other) {
|
|
4484
4177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4485
4178
|
if (!this.match || other.kind !== tree_1.JS.Kind.ExportDeclaration) {
|
|
4486
|
-
this.abort();
|
|
4487
|
-
return exportDeclaration;
|
|
4179
|
+
return this.abort(exportDeclaration);
|
|
4488
4180
|
}
|
|
4489
4181
|
const otherExportDeclaration = other;
|
|
4490
4182
|
// Compare modifiers
|
|
4491
4183
|
if (exportDeclaration.modifiers.length !== otherExportDeclaration.modifiers.length) {
|
|
4492
|
-
this.abort();
|
|
4493
|
-
return exportDeclaration;
|
|
4184
|
+
return this.abort(exportDeclaration);
|
|
4494
4185
|
}
|
|
4495
4186
|
// Visit each modifier in lock step
|
|
4496
4187
|
for (let i = 0; i < exportDeclaration.modifiers.length; i++) {
|
|
@@ -4500,13 +4191,11 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4500
4191
|
}
|
|
4501
4192
|
// Compare typeOnly
|
|
4502
4193
|
if (exportDeclaration.typeOnly.element !== otherExportDeclaration.typeOnly.element) {
|
|
4503
|
-
this.abort();
|
|
4504
|
-
return exportDeclaration;
|
|
4194
|
+
return this.abort(exportDeclaration);
|
|
4505
4195
|
}
|
|
4506
4196
|
// Compare exportClause
|
|
4507
4197
|
if ((exportDeclaration.exportClause === undefined) !== (otherExportDeclaration.exportClause === undefined)) {
|
|
4508
|
-
this.abort();
|
|
4509
|
-
return exportDeclaration;
|
|
4198
|
+
return this.abort(exportDeclaration);
|
|
4510
4199
|
}
|
|
4511
4200
|
// Visit exportClause if present
|
|
4512
4201
|
if (exportDeclaration.exportClause && otherExportDeclaration.exportClause) {
|
|
@@ -4516,8 +4205,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4516
4205
|
}
|
|
4517
4206
|
// Compare moduleSpecifier
|
|
4518
4207
|
if ((exportDeclaration.moduleSpecifier === undefined) !== (otherExportDeclaration.moduleSpecifier === undefined)) {
|
|
4519
|
-
this.abort();
|
|
4520
|
-
return exportDeclaration;
|
|
4208
|
+
return this.abort(exportDeclaration);
|
|
4521
4209
|
}
|
|
4522
4210
|
// Visit moduleSpecifier if present
|
|
4523
4211
|
if (exportDeclaration.moduleSpecifier && otherExportDeclaration.moduleSpecifier) {
|
|
@@ -4527,8 +4215,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4527
4215
|
}
|
|
4528
4216
|
// Compare attributes
|
|
4529
4217
|
if ((exportDeclaration.attributes === undefined) !== (otherExportDeclaration.attributes === undefined)) {
|
|
4530
|
-
this.abort();
|
|
4531
|
-
return exportDeclaration;
|
|
4218
|
+
return this.abort(exportDeclaration);
|
|
4532
4219
|
}
|
|
4533
4220
|
// Visit attributes if present
|
|
4534
4221
|
if (exportDeclaration.attributes && otherExportDeclaration.attributes) {
|
|
@@ -4549,14 +4236,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4549
4236
|
visitExportAssignment(exportAssignment, other) {
|
|
4550
4237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4551
4238
|
if (!this.match || other.kind !== tree_1.JS.Kind.ExportAssignment) {
|
|
4552
|
-
this.abort();
|
|
4553
|
-
return exportAssignment;
|
|
4239
|
+
return this.abort(exportAssignment);
|
|
4554
4240
|
}
|
|
4555
4241
|
const otherExportAssignment = other;
|
|
4556
4242
|
// Compare exportEquals
|
|
4557
4243
|
if (exportAssignment.exportEquals !== otherExportAssignment.exportEquals) {
|
|
4558
|
-
this.abort();
|
|
4559
|
-
return exportAssignment;
|
|
4244
|
+
return this.abort(exportAssignment);
|
|
4560
4245
|
}
|
|
4561
4246
|
// Visit expression
|
|
4562
4247
|
yield this.visit(exportAssignment.expression.element, otherExportAssignment.expression.element);
|
|
@@ -4575,14 +4260,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4575
4260
|
visitNamedExports(namedExports, other) {
|
|
4576
4261
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4577
4262
|
if (!this.match || other.kind !== tree_1.JS.Kind.NamedExports) {
|
|
4578
|
-
this.abort();
|
|
4579
|
-
return namedExports;
|
|
4263
|
+
return this.abort(namedExports);
|
|
4580
4264
|
}
|
|
4581
4265
|
const otherNamedExports = other;
|
|
4582
4266
|
// Compare elements
|
|
4583
4267
|
if (namedExports.elements.elements.length !== otherNamedExports.elements.elements.length) {
|
|
4584
|
-
this.abort();
|
|
4585
|
-
return namedExports;
|
|
4268
|
+
return this.abort(namedExports);
|
|
4586
4269
|
}
|
|
4587
4270
|
// Visit each element in lock step
|
|
4588
4271
|
for (let i = 0; i < namedExports.elements.elements.length; i++) {
|
|
@@ -4603,14 +4286,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4603
4286
|
visitExportSpecifier(exportSpecifier, other) {
|
|
4604
4287
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4605
4288
|
if (!this.match || other.kind !== tree_1.JS.Kind.ExportSpecifier) {
|
|
4606
|
-
this.abort();
|
|
4607
|
-
return exportSpecifier;
|
|
4289
|
+
return this.abort(exportSpecifier);
|
|
4608
4290
|
}
|
|
4609
4291
|
const otherExportSpecifier = other;
|
|
4610
4292
|
// Compare typeOnly
|
|
4611
4293
|
if (exportSpecifier.typeOnly.element !== otherExportSpecifier.typeOnly.element) {
|
|
4612
|
-
this.abort();
|
|
4613
|
-
return exportSpecifier;
|
|
4294
|
+
return this.abort(exportSpecifier);
|
|
4614
4295
|
}
|
|
4615
4296
|
// Visit specifier
|
|
4616
4297
|
yield this.visit(exportSpecifier.specifier, otherExportSpecifier.specifier);
|
|
@@ -4629,14 +4310,12 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4629
4310
|
visitComputedPropertyMethodDeclaration(computedPropMethod, other) {
|
|
4630
4311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4631
4312
|
if (!this.match || other.kind !== tree_1.JS.Kind.ComputedPropertyMethodDeclaration) {
|
|
4632
|
-
this.abort();
|
|
4633
|
-
return computedPropMethod;
|
|
4313
|
+
return this.abort(computedPropMethod);
|
|
4634
4314
|
}
|
|
4635
4315
|
const otherComputedPropMethod = other;
|
|
4636
4316
|
// Compare leading annotations
|
|
4637
4317
|
if (computedPropMethod.leadingAnnotations.length !== otherComputedPropMethod.leadingAnnotations.length) {
|
|
4638
|
-
this.abort();
|
|
4639
|
-
return computedPropMethod;
|
|
4318
|
+
return this.abort(computedPropMethod);
|
|
4640
4319
|
}
|
|
4641
4320
|
// Visit leading annotations in lock step
|
|
4642
4321
|
for (let i = 0; i < computedPropMethod.leadingAnnotations.length; i++) {
|
|
@@ -4646,8 +4325,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4646
4325
|
}
|
|
4647
4326
|
// Compare modifiers
|
|
4648
4327
|
if (computedPropMethod.modifiers.length !== otherComputedPropMethod.modifiers.length) {
|
|
4649
|
-
this.abort();
|
|
4650
|
-
return computedPropMethod;
|
|
4328
|
+
return this.abort(computedPropMethod);
|
|
4651
4329
|
}
|
|
4652
4330
|
// Visit modifiers in lock step
|
|
4653
4331
|
for (let i = 0; i < computedPropMethod.modifiers.length; i++) {
|
|
@@ -4657,8 +4335,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4657
4335
|
}
|
|
4658
4336
|
// Compare type parameters
|
|
4659
4337
|
if (!!computedPropMethod.typeParameters !== !!otherComputedPropMethod.typeParameters) {
|
|
4660
|
-
this.abort();
|
|
4661
|
-
return computedPropMethod;
|
|
4338
|
+
return this.abort(computedPropMethod);
|
|
4662
4339
|
}
|
|
4663
4340
|
if (computedPropMethod.typeParameters) {
|
|
4664
4341
|
yield this.visit(computedPropMethod.typeParameters, otherComputedPropMethod.typeParameters);
|
|
@@ -4667,8 +4344,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4667
4344
|
}
|
|
4668
4345
|
// Compare return type expression
|
|
4669
4346
|
if (!!computedPropMethod.returnTypeExpression !== !!otherComputedPropMethod.returnTypeExpression) {
|
|
4670
|
-
this.abort();
|
|
4671
|
-
return computedPropMethod;
|
|
4347
|
+
return this.abort(computedPropMethod);
|
|
4672
4348
|
}
|
|
4673
4349
|
if (computedPropMethod.returnTypeExpression) {
|
|
4674
4350
|
yield this.visit(computedPropMethod.returnTypeExpression, otherComputedPropMethod.returnTypeExpression);
|
|
@@ -4681,8 +4357,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4681
4357
|
return computedPropMethod;
|
|
4682
4358
|
// Compare parameters
|
|
4683
4359
|
if (computedPropMethod.parameters.elements.length !== otherComputedPropMethod.parameters.elements.length) {
|
|
4684
|
-
this.abort();
|
|
4685
|
-
return computedPropMethod;
|
|
4360
|
+
return this.abort(computedPropMethod);
|
|
4686
4361
|
}
|
|
4687
4362
|
// Visit parameters in lock step
|
|
4688
4363
|
for (let i = 0; i < computedPropMethod.parameters.elements.length; i++) {
|
|
@@ -4692,8 +4367,7 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4692
4367
|
}
|
|
4693
4368
|
// Compare body
|
|
4694
4369
|
if (!!computedPropMethod.body !== !!otherComputedPropMethod.body) {
|
|
4695
|
-
this.abort();
|
|
4696
|
-
return computedPropMethod;
|
|
4370
|
+
return this.abort(computedPropMethod);
|
|
4697
4371
|
}
|
|
4698
4372
|
if (computedPropMethod.body) {
|
|
4699
4373
|
yield this.visit(computedPropMethod.body, otherComputedPropMethod.body);
|
|
@@ -4703,4 +4377,189 @@ class JavaScriptComparatorVisitor extends visitor_1.JavaScriptVisitor {
|
|
|
4703
4377
|
}
|
|
4704
4378
|
}
|
|
4705
4379
|
exports.JavaScriptComparatorVisitor = JavaScriptComparatorVisitor;
|
|
4380
|
+
/**
|
|
4381
|
+
* A comparator visitor that checks semantic equality including type attribution.
|
|
4382
|
+
* This ensures comparisons account for type information, allowing semantically
|
|
4383
|
+
* equivalent code to match even when structurally different (e.g., `foo()` vs `module.foo()`
|
|
4384
|
+
* when both refer to the same method).
|
|
4385
|
+
*/
|
|
4386
|
+
class JavaScriptSemanticComparatorVisitor extends JavaScriptComparatorVisitor {
|
|
4387
|
+
/**
|
|
4388
|
+
* Checks if two types are semantically equal.
|
|
4389
|
+
* For method types, this checks that the declaring type and method name match.
|
|
4390
|
+
*/
|
|
4391
|
+
isOfType(target, source) {
|
|
4392
|
+
if (!target || !source) {
|
|
4393
|
+
return target === source;
|
|
4394
|
+
}
|
|
4395
|
+
if (target.kind !== source.kind) {
|
|
4396
|
+
return false;
|
|
4397
|
+
}
|
|
4398
|
+
// For method types, check declaring type
|
|
4399
|
+
// Note: We don't check the name field because it might not be fully resolved in patterns
|
|
4400
|
+
// The method invocation visitor already checks that simple names match
|
|
4401
|
+
if (target.kind === java_1.Type.Kind.Method && source.kind === java_1.Type.Kind.Method) {
|
|
4402
|
+
const targetMethod = target;
|
|
4403
|
+
const sourceMethod = source;
|
|
4404
|
+
// Check if declaring types match
|
|
4405
|
+
const declaringTypesMatch = this.isOfType(targetMethod.declaringType, sourceMethod.declaringType);
|
|
4406
|
+
if (declaringTypesMatch) {
|
|
4407
|
+
return true;
|
|
4408
|
+
}
|
|
4409
|
+
// If declaring types don't match exactly, check if they might be semantically equivalent
|
|
4410
|
+
// (e.g., 'react' module vs 'React' namespace importing from 'react')
|
|
4411
|
+
// In this case, we check if the method signatures are otherwise identical
|
|
4412
|
+
if (targetMethod.declaringType && sourceMethod.declaringType &&
|
|
4413
|
+
java_1.Type.isFullyQualified(targetMethod.declaringType) && java_1.Type.isFullyQualified(sourceMethod.declaringType)) {
|
|
4414
|
+
const targetDeclType = targetMethod.declaringType;
|
|
4415
|
+
const sourceDeclType = sourceMethod.declaringType;
|
|
4416
|
+
// Check if the declaring type names could represent the same module
|
|
4417
|
+
// (e.g., 'react' and 'React', where React is a namespace alias)
|
|
4418
|
+
const targetFQN = java_1.Type.FullyQualified.getFullyQualifiedName(targetDeclType);
|
|
4419
|
+
const sourceFQN = java_1.Type.FullyQualified.getFullyQualifiedName(sourceDeclType);
|
|
4420
|
+
// If the names differ only in case and one appears to be a module name
|
|
4421
|
+
// (all lowercase) while the other is capitalized (namespace alias),
|
|
4422
|
+
// check if the method signatures match
|
|
4423
|
+
if (targetFQN.toLowerCase() === sourceFQN.toLowerCase()) {
|
|
4424
|
+
// Method signatures should match: return type and parameters
|
|
4425
|
+
if (!this.isOfType(targetMethod.returnType, sourceMethod.returnType)) {
|
|
4426
|
+
return false;
|
|
4427
|
+
}
|
|
4428
|
+
if (targetMethod.parameterTypes.length !== sourceMethod.parameterTypes.length) {
|
|
4429
|
+
return false;
|
|
4430
|
+
}
|
|
4431
|
+
for (let i = 0; i < targetMethod.parameterTypes.length; i++) {
|
|
4432
|
+
if (!this.isOfType(targetMethod.parameterTypes[i], sourceMethod.parameterTypes[i])) {
|
|
4433
|
+
return false;
|
|
4434
|
+
}
|
|
4435
|
+
}
|
|
4436
|
+
return true;
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4439
|
+
return false;
|
|
4440
|
+
}
|
|
4441
|
+
// For fully qualified types, check the fully qualified name
|
|
4442
|
+
if (java_1.Type.isFullyQualified(target) && java_1.Type.isFullyQualified(source)) {
|
|
4443
|
+
return java_1.Type.FullyQualified.getFullyQualifiedName(target) ===
|
|
4444
|
+
java_1.Type.FullyQualified.getFullyQualifiedName(source);
|
|
4445
|
+
}
|
|
4446
|
+
// Default: types are equal if they're the same kind
|
|
4447
|
+
return true;
|
|
4448
|
+
}
|
|
4449
|
+
/**
|
|
4450
|
+
* Override method invocation comparison to include type attribution checking.
|
|
4451
|
+
* When types match semantically, we allow matching even if one has a receiver
|
|
4452
|
+
* and the other doesn't (e.g., `isDate(x)` vs `util.isDate(x)`).
|
|
4453
|
+
*/
|
|
4454
|
+
visitMethodInvocation(method, other) {
|
|
4455
|
+
const _super = Object.create(null, {
|
|
4456
|
+
visitMethodInvocation: { get: () => super.visitMethodInvocation }
|
|
4457
|
+
});
|
|
4458
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4459
|
+
if (other.kind !== java_1.J.Kind.MethodInvocation) {
|
|
4460
|
+
return this.abort(method);
|
|
4461
|
+
}
|
|
4462
|
+
const otherMethod = other;
|
|
4463
|
+
// Check basic structural equality first
|
|
4464
|
+
if (method.name.simpleName !== otherMethod.name.simpleName ||
|
|
4465
|
+
method.arguments.elements.length !== otherMethod.arguments.elements.length) {
|
|
4466
|
+
return this.abort(method);
|
|
4467
|
+
}
|
|
4468
|
+
// Check type attribution
|
|
4469
|
+
// Both must have method types for semantic equality
|
|
4470
|
+
if (!method.methodType || !otherMethod.methodType) {
|
|
4471
|
+
// If template has type but target doesn't, they don't match
|
|
4472
|
+
if (method.methodType || otherMethod.methodType) {
|
|
4473
|
+
return this.abort(method);
|
|
4474
|
+
}
|
|
4475
|
+
// If neither has type, fall through to structural comparison
|
|
4476
|
+
return _super.visitMethodInvocation.call(this, method, other);
|
|
4477
|
+
}
|
|
4478
|
+
// Both have types - check they match semantically
|
|
4479
|
+
const typesMatch = this.isOfType(method.methodType, otherMethod.methodType);
|
|
4480
|
+
if (!typesMatch) {
|
|
4481
|
+
// Types don't match - abort comparison
|
|
4482
|
+
return this.abort(method);
|
|
4483
|
+
}
|
|
4484
|
+
// Types match! Now check if we can ignore receiver differences.
|
|
4485
|
+
// We can only ignore receiver differences when one or both receivers are identifiers
|
|
4486
|
+
// that represent module/namespace imports (e.g., `util` in `util.isDate()`).
|
|
4487
|
+
// For other receivers (e.g., variables, expressions), we must compare them.
|
|
4488
|
+
const canIgnoreReceiverDifference =
|
|
4489
|
+
// Case 1: One has no select (direct call like `forwardRef()`), other has select (namespace like `React.forwardRef()`)
|
|
4490
|
+
(!method.select && otherMethod.select) ||
|
|
4491
|
+
(method.select && !otherMethod.select);
|
|
4492
|
+
if (!canIgnoreReceiverDifference) {
|
|
4493
|
+
// Both have selects or both don't - must compare them structurally
|
|
4494
|
+
if ((method.select === undefined) !== (otherMethod.select === undefined)) {
|
|
4495
|
+
return this.abort(method);
|
|
4496
|
+
}
|
|
4497
|
+
if (method.select && otherMethod.select) {
|
|
4498
|
+
yield this.visit(method.select.element, otherMethod.select.element);
|
|
4499
|
+
if (!this.match) {
|
|
4500
|
+
return this.abort(method);
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
}
|
|
4504
|
+
// Compare type parameters
|
|
4505
|
+
if ((method.typeParameters === undefined) !== (otherMethod.typeParameters === undefined)) {
|
|
4506
|
+
return this.abort(method);
|
|
4507
|
+
}
|
|
4508
|
+
if (method.typeParameters && otherMethod.typeParameters) {
|
|
4509
|
+
if (method.typeParameters.elements.length !== otherMethod.typeParameters.elements.length) {
|
|
4510
|
+
return this.abort(method);
|
|
4511
|
+
}
|
|
4512
|
+
for (let i = 0; i < method.typeParameters.elements.length; i++) {
|
|
4513
|
+
yield this.visit(method.typeParameters.elements[i].element, otherMethod.typeParameters.elements[i].element);
|
|
4514
|
+
if (!this.match) {
|
|
4515
|
+
return this.abort(method);
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4518
|
+
}
|
|
4519
|
+
// Compare name (already checked simpleName above, but visit for markers/prefix)
|
|
4520
|
+
yield this.visit(method.name, otherMethod.name);
|
|
4521
|
+
if (!this.match) {
|
|
4522
|
+
return this.abort(method);
|
|
4523
|
+
}
|
|
4524
|
+
// Compare arguments
|
|
4525
|
+
for (let i = 0; i < method.arguments.elements.length; i++) {
|
|
4526
|
+
yield this.visit(method.arguments.elements[i].element, otherMethod.arguments.elements[i].element);
|
|
4527
|
+
if (!this.match) {
|
|
4528
|
+
return this.abort(method);
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
return method;
|
|
4532
|
+
});
|
|
4533
|
+
}
|
|
4534
|
+
/**
|
|
4535
|
+
* Override identifier comparison to include type checking for field access.
|
|
4536
|
+
*/
|
|
4537
|
+
visitIdentifier(identifier, other) {
|
|
4538
|
+
const _super = Object.create(null, {
|
|
4539
|
+
visitIdentifier: { get: () => super.visitIdentifier }
|
|
4540
|
+
});
|
|
4541
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4542
|
+
if (other.kind !== java_1.J.Kind.Identifier) {
|
|
4543
|
+
return this.abort(identifier);
|
|
4544
|
+
}
|
|
4545
|
+
const otherIdentifier = other;
|
|
4546
|
+
// Check name matches
|
|
4547
|
+
if (identifier.simpleName !== otherIdentifier.simpleName) {
|
|
4548
|
+
return this.abort(identifier);
|
|
4549
|
+
}
|
|
4550
|
+
// For identifiers with field types, check type attribution
|
|
4551
|
+
if (identifier.fieldType && otherIdentifier.fieldType) {
|
|
4552
|
+
if (!this.isOfType(identifier.fieldType, otherIdentifier.fieldType)) {
|
|
4553
|
+
return this.abort(identifier);
|
|
4554
|
+
}
|
|
4555
|
+
}
|
|
4556
|
+
else if (identifier.fieldType || otherIdentifier.fieldType) {
|
|
4557
|
+
// If only one has a type, they don't match
|
|
4558
|
+
return this.abort(identifier);
|
|
4559
|
+
}
|
|
4560
|
+
return _super.visitIdentifier.call(this, identifier, other);
|
|
4561
|
+
});
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
exports.JavaScriptSemanticComparatorVisitor = JavaScriptSemanticComparatorVisitor;
|
|
4706
4565
|
//# sourceMappingURL=comparator.js.map
|