Skip to content

Commit c36d424

Browse files
fix: add node wrapping for A_ArrayExpr, A_Indices, A_Indirection, A_Star in v15-to-v16
- Fixed A_ArrayExpr with elements array transformation - Fixed A_Indices with lidx/uidx transformation - Fixed A_Indirection with arg and indirection array transformation - Fixed A_Star with empty result wrapper - Switching focus back to v14-to-v15 transformer as requested Co-Authored-By: Dan Lynch <[email protected]>
1 parent 6ed06e6 commit c36d424

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

packages/transform/src/transformers/v15-to-v16.ts

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,19 +564,59 @@ export class V15ToV16Transformer {
564564
}
565565

566566
A_ArrayExpr(node: PG15.A_ArrayExpr, context: TransformerContext): any {
567-
return node;
567+
const result: any = {};
568+
569+
if (node.elements !== undefined) {
570+
result.elements = Array.isArray(node.elements)
571+
? node.elements.map((item: any) => this.transform(item as any, context))
572+
: this.transform(node.elements as any, context);
573+
}
574+
575+
if (node.location !== undefined) {
576+
result.location = node.location;
577+
}
578+
579+
return { A_ArrayExpr: result };
568580
}
569581

570582
A_Indices(node: PG15.A_Indices, context: TransformerContext): any {
571-
return node;
583+
const result: any = {};
584+
585+
if (node.is_slice !== undefined) {
586+
result.is_slice = node.is_slice;
587+
}
588+
589+
if (node.lidx !== undefined) {
590+
result.lidx = this.transform(node.lidx as any, context);
591+
}
592+
593+
if (node.uidx !== undefined) {
594+
result.uidx = this.transform(node.uidx as any, context);
595+
}
596+
597+
return { A_Indices: result };
572598
}
573599

574600
A_Indirection(node: PG15.A_Indirection, context: TransformerContext): any {
575-
return node;
601+
const result: any = {};
602+
603+
if (node.arg !== undefined) {
604+
result.arg = this.transform(node.arg as any, context);
605+
}
606+
607+
if (node.indirection !== undefined) {
608+
result.indirection = Array.isArray(node.indirection)
609+
? node.indirection.map((item: any) => this.transform(item as any, context))
610+
: this.transform(node.indirection as any, context);
611+
}
612+
613+
return { A_Indirection: result };
576614
}
577615

578616
A_Star(node: PG15.A_Star, context: TransformerContext): any {
579-
return node;
617+
const result: any = {};
618+
619+
return { A_Star: result };
580620
}
581621

582622
CaseExpr(node: PG15.CaseExpr, context: TransformerContext): any {

0 commit comments

Comments
 (0)