diff --git a/openrewrite/src/java/remote/receiver.ts b/openrewrite/src/java/remote/receiver.ts index 7c5f94b8..9d297b3c 100644 --- a/openrewrite/src/java/remote/receiver.ts +++ b/openrewrite/src/java/remote/receiver.ts @@ -2,7 +2,7 @@ import * as extensions from "./remote_extensions"; import {Checksum, Cursor, FileAttributes, ListUtils, Tree} from '../../core'; import {DetailsReceiver, Receiver, ReceiverContext, ReceiverFactory, ValueType} from '@openrewrite/rewrite-remote'; import {JavaVisitor} from '..'; -import {J, Comment, Expression, JavaSourceFile, JavaType, JContainer, JLeftPadded, JRightPadded, Loop, MethodCall, NameTree, Space, Statement, TextComment, TypedTree, TypeTree, AnnotatedType, Annotation, ArrayAccess, ArrayType, Assert, Assignment, AssignmentOperation, Binary, Block, Break, Case, ClassDeclaration, CompilationUnit, Continue, DoWhileLoop, Empty, EnumValue, EnumValueSet, FieldAccess, ForEachLoop, ForLoop, ParenthesizedTypeTree, Identifier, If, Import, InstanceOf, IntersectionType, Label, Lambda, Literal, MemberReference, MethodDeclaration, MethodInvocation, Modifier, MultiCatch, NewArray, ArrayDimension, NewClass, NullableType, Package, ParameterizedType, Parentheses, ControlParentheses, Primitive, Return, Switch, SwitchExpression, Synchronized, Ternary, Throw, Try, TypeCast, TypeParameter, TypeParameters, Unary, VariableDeclarations, WhileLoop, Wildcard, Yield, Unknown, Erroneous} from '../tree'; +import {J, Comment, Expression, JavaSourceFile, JavaType, JContainer, JLeftPadded, JRightPadded, Loop, MethodCall, NameTree, Space, Statement, TextComment, TypedTree, TypeTree, AnnotatedType, Annotation, ArrayAccess, ArrayType, Assert, Assignment, AssignmentOperation, Binary, Block, Break, Case, ClassDeclaration, CompilationUnit, Continue, DoWhileLoop, Empty, EnumValue, EnumValueSet, FieldAccess, ForEachLoop, ForLoop, ParenthesizedTypeTree, Identifier, If, Import, InstanceOf, DeconstructionPattern, IntersectionType, Label, Lambda, Literal, MemberReference, MethodDeclaration, MethodInvocation, Modifier, MultiCatch, NewArray, ArrayDimension, NewClass, NullableType, Package, ParameterizedType, Parentheses, ControlParentheses, Primitive, Return, Switch, SwitchExpression, Synchronized, Ternary, Throw, Try, TypeCast, TypeParameter, TypeParameters, Unary, VariableDeclarations, WhileLoop, Wildcard, Yield, Unknown, Erroneous} from '../tree'; import * as Java from "../../java/tree"; export class JavaReceiver implements Receiver { @@ -328,6 +328,16 @@ class Visitor extends JavaVisitor { return instanceOf; } + public visitDeconstructionPattern(deconstructionPattern: DeconstructionPattern, ctx: ReceiverContext): J { + deconstructionPattern = deconstructionPattern.withId(ctx.receiveValue(deconstructionPattern.id, ValueType.UUID)!); + deconstructionPattern = deconstructionPattern.withPrefix(ctx.receiveNode(deconstructionPattern.prefix, receiveSpace)!); + deconstructionPattern = deconstructionPattern.withMarkers(ctx.receiveNode(deconstructionPattern.markers, ctx.receiveMarkers)!); + deconstructionPattern = deconstructionPattern.withDeconstructor(ctx.receiveNode(deconstructionPattern.deconstructor, ctx.receiveTree)!); + deconstructionPattern = deconstructionPattern.padding.withNested(ctx.receiveNode(deconstructionPattern.padding.nested, receiveContainer)!); + deconstructionPattern = deconstructionPattern.withType(ctx.receiveValue(deconstructionPattern.type, ValueType.Object)!); + return deconstructionPattern; + } + public visitIntersectionType(intersectionType: IntersectionType, ctx: ReceiverContext): J { intersectionType = intersectionType.withId(ctx.receiveValue(intersectionType.id, ValueType.UUID)!); intersectionType = intersectionType.withPrefix(ctx.receiveNode(intersectionType.prefix, receiveSpace)!); @@ -1054,6 +1064,17 @@ class Factory implements ReceiverFactory { ); } + if (type === "org.openrewrite.java.tree.J$DeconstructionPattern") { + return new DeconstructionPattern( + ctx.receiveValue(null, ValueType.UUID)!, + ctx.receiveNode(null, receiveSpace)!, + ctx.receiveNode(null, ctx.receiveMarkers)!, + ctx.receiveNode(null, ctx.receiveTree)!, + ctx.receiveNode>(null, receiveContainer)!, + ctx.receiveValue(null, ValueType.Object)! + ); + } + if (type === "org.openrewrite.java.tree.J$IntersectionType") { return new IntersectionType( ctx.receiveValue(null, ValueType.UUID)!, diff --git a/openrewrite/src/java/remote/sender.ts b/openrewrite/src/java/remote/sender.ts index bc339423..3b608eb1 100644 --- a/openrewrite/src/java/remote/sender.ts +++ b/openrewrite/src/java/remote/sender.ts @@ -2,7 +2,7 @@ import * as extensions from "./remote_extensions"; import {Cursor, ListUtils, Tree} from '../../core'; import {Sender, SenderContext, ValueType} from '@openrewrite/rewrite-remote'; import {JavaVisitor} from '..'; -import {J, Comment, Expression, JavaSourceFile, JavaType, JContainer, JLeftPadded, JRightPadded, Loop, MethodCall, NameTree, Space, Statement, TextComment, TypedTree, TypeTree, AnnotatedType, Annotation, ArrayAccess, ArrayType, Assert, Assignment, AssignmentOperation, Binary, Block, Break, Case, ClassDeclaration, CompilationUnit, Continue, DoWhileLoop, Empty, EnumValue, EnumValueSet, FieldAccess, ForEachLoop, ForLoop, ParenthesizedTypeTree, Identifier, If, Import, InstanceOf, IntersectionType, Label, Lambda, Literal, MemberReference, MethodDeclaration, MethodInvocation, Modifier, MultiCatch, NewArray, ArrayDimension, NewClass, NullableType, Package, ParameterizedType, Parentheses, ControlParentheses, Primitive, Return, Switch, SwitchExpression, Synchronized, Ternary, Throw, Try, TypeCast, TypeParameter, TypeParameters, Unary, VariableDeclarations, WhileLoop, Wildcard, Yield, Unknown, Erroneous} from '../tree'; +import {J, Comment, Expression, JavaSourceFile, JavaType, JContainer, JLeftPadded, JRightPadded, Loop, MethodCall, NameTree, Space, Statement, TextComment, TypedTree, TypeTree, AnnotatedType, Annotation, ArrayAccess, ArrayType, Assert, Assignment, AssignmentOperation, Binary, Block, Break, Case, ClassDeclaration, CompilationUnit, Continue, DoWhileLoop, Empty, EnumValue, EnumValueSet, FieldAccess, ForEachLoop, ForLoop, ParenthesizedTypeTree, Identifier, If, Import, InstanceOf, DeconstructionPattern, IntersectionType, Label, Lambda, Literal, MemberReference, MethodDeclaration, MethodInvocation, Modifier, MultiCatch, NewArray, ArrayDimension, NewClass, NullableType, Package, ParameterizedType, Parentheses, ControlParentheses, Primitive, Return, Switch, SwitchExpression, Synchronized, Ternary, Throw, Try, TypeCast, TypeParameter, TypeParameters, Unary, VariableDeclarations, WhileLoop, Wildcard, Yield, Unknown, Erroneous} from '../tree'; import * as Java from "../../java/tree"; export class JavaSender implements Sender { @@ -323,6 +323,16 @@ class Visitor extends JavaVisitor { return instanceOf; } + public visitDeconstructionPattern(deconstructionPattern: DeconstructionPattern, ctx: SenderContext): J { + ctx.sendValue(deconstructionPattern, v => v.id, ValueType.UUID); + ctx.sendNode(deconstructionPattern, v => v.prefix, Visitor.sendSpace); + ctx.sendNode(deconstructionPattern, v => v.markers, ctx.sendMarkers); + ctx.sendNode(deconstructionPattern, v => v.deconstructor, ctx.sendTree); + ctx.sendNode(deconstructionPattern, v => v.padding.nested, Visitor.sendContainer(ValueType.Tree)); + ctx.sendTypedValue(deconstructionPattern, v => v.type, ValueType.Object); + return deconstructionPattern; + } + public visitIntersectionType(intersectionType: IntersectionType, ctx: SenderContext): J { ctx.sendValue(intersectionType, v => v.id, ValueType.UUID); ctx.sendNode(intersectionType, v => v.prefix, Visitor.sendSpace); diff --git a/openrewrite/src/java/tree/support_types.ts b/openrewrite/src/java/tree/support_types.ts index 47ae205e..d01d0383 100644 --- a/openrewrite/src/java/tree/support_types.ts +++ b/openrewrite/src/java/tree/support_types.ts @@ -692,6 +692,7 @@ export namespace Space { WILDCARD_PREFIX, YIELD_PREFIX, ERRONEOUS_PREFIX, + DECONSTRUCTION_PATTERN_PREFIX, } } @@ -798,6 +799,7 @@ export namespace JContainer { TRY_RESOURCES, TYPE_BOUNDS, TYPE_PARAMETERS, + DECONSTRUCTION_PATTERN_NESTED, } export namespace Location { diff --git a/openrewrite/src/java/tree/tree.ts b/openrewrite/src/java/tree/tree.ts index 6a52ef3e..309129b7 100644 --- a/openrewrite/src/java/tree/tree.ts +++ b/openrewrite/src/java/tree/tree.ts @@ -2792,6 +2792,96 @@ export class InstanceOf extends JMixin(Object) implements Expression, TypedTree } +@LstType("org.openrewrite.java.tree.J$DeconstructionPattern") +export class DeconstructionPattern extends JMixin(Object) implements TypedTree { + public constructor(id: UUID, prefix: Space, markers: Markers, deconstructor: Expression, nested: JContainer, _type: JavaType) { + super(); + this._id = id; + this._prefix = prefix; + this._markers = markers; + this._deconstructor = deconstructor; + this._nested = nested; + this._type = _type; + } + + private readonly _id: UUID; + + public get id(): UUID { + return this._id; + } + + public withId(id: UUID): DeconstructionPattern { + return id === this._id ? this : new DeconstructionPattern(id, this._prefix, this._markers, this._deconstructor, this._nested, this._type); + } + + private readonly _prefix: Space; + + public get prefix(): Space { + return this._prefix; + } + + public withPrefix(prefix: Space): DeconstructionPattern { + return prefix === this._prefix ? this : new DeconstructionPattern(this._id, prefix, this._markers, this._deconstructor, this._nested, this._type); + } + + private readonly _markers: Markers; + + public get markers(): Markers { + return this._markers; + } + + public withMarkers(markers: Markers): DeconstructionPattern { + return markers === this._markers ? this : new DeconstructionPattern(this._id, this._prefix, markers, this._deconstructor, this._nested, this._type); + } + + private readonly _deconstructor: Expression; + + public get deconstructor(): Expression { + return this._deconstructor; + } + + public withDeconstructor(deconstructor: Expression): DeconstructionPattern { + return deconstructor === this._deconstructor ? this : new DeconstructionPattern(this._id, this._prefix, this._markers, deconstructor, this._nested, this._type); + } + + private readonly _nested: JContainer; + + public get nested(): J[] { + return this._nested.elements; + } + + public withNested(nested: J[]): DeconstructionPattern { + return this.padding.withNested(JContainer.withElements(this._nested, nested)); + } + + private readonly _type: JavaType; + + public get type(): JavaType { + return this._type; + } + + public withType(_type: JavaType): DeconstructionPattern { + return _type === this._type ? this : new DeconstructionPattern(this._id, this._prefix, this._markers, this._deconstructor, this._nested, _type); + } + + public acceptJava

(v: JavaVisitor

, p: P): J | null { + return v.visitDeconstructionPattern(this, p); + } + + get padding() { + const t = this; + return new class { + public get nested(): JContainer { + return t._nested; + } + public withNested(nested: JContainer): DeconstructionPattern { + return t._nested === nested ? t : new DeconstructionPattern(t._id, t._prefix, t._markers, t._deconstructor, nested, t._type); + } + } + } + +} + @LstType("org.openrewrite.java.tree.J$IntersectionType") export class IntersectionType extends JMixin(Object) implements TypeTree, Expression { public constructor(id: UUID, prefix: Space, markers: Markers, bounds: JContainer) { diff --git a/openrewrite/src/java/visitor.ts b/openrewrite/src/java/visitor.ts index 87fa6556..46f0f8ee 100644 --- a/openrewrite/src/java/visitor.ts +++ b/openrewrite/src/java/visitor.ts @@ -1,7 +1,7 @@ import * as extensions from "./extensions"; import {ListUtils, SourceFile, Tree, TreeVisitor} from "../core"; import {J, isJava, Comment, Expression, JavaSourceFile, JavaType, JContainer, JLeftPadded, JRightPadded, Loop, MethodCall, NameTree, Space, Statement, TextComment, TypedTree, TypeTree} from "./tree"; -import {AnnotatedType, Annotation, ArrayAccess, ArrayType, Assert, Assignment, AssignmentOperation, Binary, Block, Break, Case, ClassDeclaration, CompilationUnit, Continue, DoWhileLoop, Empty, EnumValue, EnumValueSet, FieldAccess, ForEachLoop, ForLoop, ParenthesizedTypeTree, Identifier, If, Import, InstanceOf, IntersectionType, Label, Lambda, Literal, MemberReference, MethodDeclaration, MethodInvocation, Modifier, MultiCatch, NewArray, ArrayDimension, NewClass, NullableType, Package, ParameterizedType, Parentheses, ControlParentheses, Primitive, Return, Switch, SwitchExpression, Synchronized, Ternary, Throw, Try, TypeCast, TypeParameter, TypeParameters, Unary, VariableDeclarations, WhileLoop, Wildcard, Yield, Unknown, Erroneous} from "./tree"; +import {AnnotatedType, Annotation, ArrayAccess, ArrayType, Assert, Assignment, AssignmentOperation, Binary, Block, Break, Case, ClassDeclaration, CompilationUnit, Continue, DoWhileLoop, Empty, EnumValue, EnumValueSet, FieldAccess, ForEachLoop, ForLoop, ParenthesizedTypeTree, Identifier, If, Import, InstanceOf, DeconstructionPattern, IntersectionType, Label, Lambda, Literal, MemberReference, MethodDeclaration, MethodInvocation, Modifier, MultiCatch, NewArray, ArrayDimension, NewClass, NullableType, Package, ParameterizedType, Parentheses, ControlParentheses, Primitive, Return, Switch, SwitchExpression, Synchronized, Ternary, Throw, Try, TypeCast, TypeParameter, TypeParameters, Unary, VariableDeclarations, WhileLoop, Wildcard, Yield, Unknown, Erroneous} from "./tree"; export class JavaVisitor

extends TreeVisitor { isAcceptable(sourceFile: SourceFile, p: P): boolean { @@ -437,6 +437,14 @@ export class JavaVisitor

extends TreeVisitor { return instanceOf; } + public visitDeconstructionPattern(deconstructionPattern: DeconstructionPattern, p: P): J | null { + deconstructionPattern = deconstructionPattern.withPrefix(this.visitSpace(deconstructionPattern.prefix, Space.Location.DECONSTRUCTION_PATTERN_PREFIX, p)!); + deconstructionPattern = deconstructionPattern.withMarkers(this.visitMarkers(deconstructionPattern.markers, p)); + deconstructionPattern = deconstructionPattern.withDeconstructor(this.visitAndCast(deconstructionPattern.deconstructor, p)!); + deconstructionPattern = deconstructionPattern.padding.withNested(this.visitContainer(deconstructionPattern.padding.nested, JContainer.Location.DECONSTRUCTION_PATTERN_NESTED, p)!); + return deconstructionPattern; + } + public visitIntersectionType(intersectionType: IntersectionType, p: P): J | null { intersectionType = intersectionType.withPrefix(this.visitSpace(intersectionType.prefix, Space.Location.INTERSECTION_TYPE_PREFIX, p)!); let tempExpression = this.visitExpression(intersectionType, p) as Expression; diff --git a/openrewrite/src/javascript/remote/receiver.ts b/openrewrite/src/javascript/remote/receiver.ts index 9dd4de9b..f16f57aa 100644 --- a/openrewrite/src/javascript/remote/receiver.ts +++ b/openrewrite/src/javascript/remote/receiver.ts @@ -1014,6 +1014,16 @@ class Visitor extends JavaScriptVisitor { return instanceOf; } + public visitDeconstructionPattern(deconstructionPattern: Java.DeconstructionPattern, ctx: ReceiverContext): J { + deconstructionPattern = deconstructionPattern.withId(ctx.receiveValue(deconstructionPattern.id, ValueType.UUID)!); + deconstructionPattern = deconstructionPattern.withPrefix(ctx.receiveNode(deconstructionPattern.prefix, receiveSpace)!); + deconstructionPattern = deconstructionPattern.withMarkers(ctx.receiveNode(deconstructionPattern.markers, ctx.receiveMarkers)!); + deconstructionPattern = deconstructionPattern.withDeconstructor(ctx.receiveNode(deconstructionPattern.deconstructor, ctx.receiveTree)!); + deconstructionPattern = deconstructionPattern.padding.withNested(ctx.receiveNode(deconstructionPattern.padding.nested, receiveContainer)!); + deconstructionPattern = deconstructionPattern.withType(ctx.receiveValue(deconstructionPattern.type, ValueType.Object)!); + return deconstructionPattern; + } + public visitIntersectionType(intersectionType: Java.IntersectionType, ctx: ReceiverContext): J { intersectionType = intersectionType.withId(ctx.receiveValue(intersectionType.id, ValueType.UUID)!); intersectionType = intersectionType.withPrefix(ctx.receiveNode(intersectionType.prefix, receiveSpace)!); @@ -2493,6 +2503,17 @@ class Factory implements ReceiverFactory { ); } + if (type === "org.openrewrite.java.tree.J$DeconstructionPattern") { + return new Java.DeconstructionPattern( + ctx.receiveValue(null, ValueType.UUID)!, + ctx.receiveNode(null, receiveSpace)!, + ctx.receiveNode(null, ctx.receiveMarkers)!, + ctx.receiveNode(null, ctx.receiveTree)!, + ctx.receiveNode>(null, receiveContainer)!, + ctx.receiveValue(null, ValueType.Object)! + ); + } + if (type === "org.openrewrite.java.tree.J$IntersectionType") { return new Java.IntersectionType( ctx.receiveValue(null, ValueType.UUID)!, diff --git a/openrewrite/src/javascript/remote/sender.ts b/openrewrite/src/javascript/remote/sender.ts index 989e328b..8fe3ead1 100644 --- a/openrewrite/src/javascript/remote/sender.ts +++ b/openrewrite/src/javascript/remote/sender.ts @@ -1009,6 +1009,16 @@ class Visitor extends JavaScriptVisitor { return instanceOf; } + public visitDeconstructionPattern(deconstructionPattern: Java.DeconstructionPattern, ctx: SenderContext): J { + ctx.sendValue(deconstructionPattern, v => v.id, ValueType.UUID); + ctx.sendNode(deconstructionPattern, v => v.prefix, Visitor.sendSpace); + ctx.sendNode(deconstructionPattern, v => v.markers, ctx.sendMarkers); + ctx.sendNode(deconstructionPattern, v => v.deconstructor, ctx.sendTree); + ctx.sendNode(deconstructionPattern, v => v.padding.nested, Visitor.sendContainer(ValueType.Tree)); + ctx.sendTypedValue(deconstructionPattern, v => v.type, ValueType.Object); + return deconstructionPattern; + } + public visitIntersectionType(intersectionType: Java.IntersectionType, ctx: SenderContext): J { ctx.sendValue(intersectionType, v => v.id, ValueType.UUID); ctx.sendNode(intersectionType, v => v.prefix, Visitor.sendSpace); diff --git a/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptReceiver.java b/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptReceiver.java index 283c20a2..2db8e1eb 100644 --- a/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptReceiver.java +++ b/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptReceiver.java @@ -1149,6 +1149,17 @@ public J.InstanceOf visitInstanceOf(J.InstanceOf instanceOf, ReceiverContext ctx return instanceOf; } + @Override + public J.DeconstructionPattern visitDeconstructionPattern(J.DeconstructionPattern deconstructionPattern, ReceiverContext ctx) { + deconstructionPattern = deconstructionPattern.withId(ctx.receiveNonNullValue(deconstructionPattern.getId(), UUID.class)); + deconstructionPattern = deconstructionPattern.withPrefix(ctx.receiveNonNullNode(deconstructionPattern.getPrefix(), JavaScriptReceiver::receiveSpace)); + deconstructionPattern = deconstructionPattern.withMarkers(ctx.receiveNonNullNode(deconstructionPattern.getMarkers(), ctx::receiveMarkers)); + deconstructionPattern = deconstructionPattern.withDeconstructor(ctx.receiveNonNullNode(deconstructionPattern.getDeconstructor(), ctx::receiveTree)); + deconstructionPattern = deconstructionPattern.getPadding().withNested(ctx.receiveNonNullNode(deconstructionPattern.getPadding().getNested(), JavaScriptReceiver::receiveContainer)); + deconstructionPattern = deconstructionPattern.withType(ctx.receiveValue(deconstructionPattern.getType(), JavaType.class)); + return deconstructionPattern; + } + @Override public J.IntersectionType visitIntersectionType(J.IntersectionType intersectionType, ReceiverContext ctx) { intersectionType = intersectionType.withId(ctx.receiveNonNullValue(intersectionType.getId(), UUID.class)); @@ -1664,6 +1675,7 @@ protected Function computeValue(Class type) { if (type == J.If.Else.class) return Factory::createJIfElse; if (type == J.Import.class) return Factory::createJImport; if (type == J.InstanceOf.class) return Factory::createJInstanceOf; + if (type == J.DeconstructionPattern.class) return Factory::createJDeconstructionPattern; if (type == J.IntersectionType.class) return Factory::createJIntersectionType; if (type == J.Label.class) return Factory::createJLabel; if (type == J.Lambda.class) return Factory::createJLambda; @@ -2799,6 +2811,17 @@ private static J.InstanceOf createJInstanceOf(ReceiverContext ctx) { ); } + private static J.DeconstructionPattern createJDeconstructionPattern(ReceiverContext ctx) { + return new J.DeconstructionPattern( + ctx.receiveNonNullValue(null, UUID.class), + ctx.receiveNonNullNode(null, JavaScriptReceiver::receiveSpace), + ctx.receiveNonNullNode(null, ctx::receiveMarkers), + ctx.receiveNonNullNode(null, ctx::receiveTree), + ctx.receiveNonNullNode(null, JavaScriptReceiver::receiveContainer), + ctx.receiveValue(null, JavaType.class) + ); + } + private static J.IntersectionType createJIntersectionType(ReceiverContext ctx) { return new J.IntersectionType( ctx.receiveNonNullValue(null, UUID.class), diff --git a/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptSender.java b/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptSender.java index 7c382d8c..92c5e922 100644 --- a/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptSender.java +++ b/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptSender.java @@ -1139,6 +1139,17 @@ public J.InstanceOf visitInstanceOf(J.InstanceOf instanceOf, SenderContext ctx) return instanceOf; } + @Override + public J.DeconstructionPattern visitDeconstructionPattern(J.DeconstructionPattern deconstructionPattern, SenderContext ctx) { + ctx.sendValue(deconstructionPattern, J.DeconstructionPattern::getId); + ctx.sendNode(deconstructionPattern, J.DeconstructionPattern::getPrefix, JavaScriptSender::sendSpace); + ctx.sendNode(deconstructionPattern, J.DeconstructionPattern::getMarkers, ctx::sendMarkers); + ctx.sendNode(deconstructionPattern, J.DeconstructionPattern::getDeconstructor, ctx::sendTree); + ctx.sendNode(deconstructionPattern, e -> e.getPadding().getNested(), JavaScriptSender::sendContainer); + ctx.sendTypedValue(deconstructionPattern, J.DeconstructionPattern::getType); + return deconstructionPattern; + } + @Override public J.IntersectionType visitIntersectionType(J.IntersectionType intersectionType, SenderContext ctx) { ctx.sendValue(intersectionType, J.IntersectionType::getId); diff --git a/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptValidator.java b/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptValidator.java index 109d1a2d..2502226e 100644 --- a/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptValidator.java +++ b/rewrite-javascript-remote/src/main/java/org/openrewrite/javascript/remote/JavaScriptValidator.java @@ -755,6 +755,13 @@ public J.InstanceOf visitInstanceOf(J.InstanceOf instanceOf, P p) { return instanceOf; } + @Override + public J.DeconstructionPattern visitDeconstructionPattern(J.DeconstructionPattern deconstructionPattern, P p) { + visitAndValidateNonNull(deconstructionPattern.getDeconstructor(), Expression.class, p); + visitAndValidate(deconstructionPattern.getNested(), J.class, p); + return deconstructionPattern; + } + @Override public J.IntersectionType visitIntersectionType(J.IntersectionType intersectionType, P p) { visitAndValidate(intersectionType.getBounds(), TypeTree.class, p);