Skip to content

Commit 6ed06e6

Browse files
fix: add node wrapping for A_Expr, BoolExpr, Alias, Boolean in v15-to-v16 transformer
- Fixed A_Expr with proper name, lexpr, rexpr transformation - Fixed BoolExpr with args array transformation - Fixed Alias with colnames array transformation - Fixed Boolean with boolval field transformation - Continuing systematic node wrapping approach following v13-to-v14 patterns Co-Authored-By: Dan Lynch <[email protected]>
1 parent bb3785e commit 6ed06e6

File tree

1 file changed

+62
-4
lines changed

1 file changed

+62
-4
lines changed

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

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,31 @@ export class V15ToV16Transformer {
192192
}
193193

194194
A_Expr(node: PG15.A_Expr, context: TransformerContext): any {
195-
return node;
195+
const result: any = {};
196+
197+
if (node.kind !== undefined) {
198+
result.kind = node.kind;
199+
}
200+
201+
if (node.name !== undefined) {
202+
result.name = Array.isArray(node.name)
203+
? node.name.map((item: any) => this.transform(item as any, context))
204+
: this.transform(node.name as any, context);
205+
}
206+
207+
if (node.lexpr !== undefined) {
208+
result.lexpr = this.transform(node.lexpr as any, context);
209+
}
210+
211+
if (node.rexpr !== undefined) {
212+
result.rexpr = this.transform(node.rexpr as any, context);
213+
}
214+
215+
if (node.location !== undefined) {
216+
result.location = node.location;
217+
}
218+
219+
return { A_Expr: result };
196220
}
197221

198222
InsertStmt(node: PG15.InsertStmt, context: TransformerContext): any {
@@ -328,7 +352,23 @@ export class V15ToV16Transformer {
328352
}
329353

330354
BoolExpr(node: PG15.BoolExpr, context: TransformerContext): any {
331-
return node;
355+
const result: any = {};
356+
357+
if (node.boolop !== undefined) {
358+
result.boolop = node.boolop;
359+
}
360+
361+
if (node.args !== undefined) {
362+
result.args = Array.isArray(node.args)
363+
? node.args.map((item: any) => this.transform(item as any, context))
364+
: this.transform(node.args as any, context);
365+
}
366+
367+
if (node.location !== undefined) {
368+
result.location = node.location;
369+
}
370+
371+
return { BoolExpr: result };
332372
}
333373

334374
FuncCall(node: PG15.FuncCall, context: TransformerContext): any {
@@ -478,7 +518,19 @@ export class V15ToV16Transformer {
478518
}
479519

480520
Alias(node: PG15.Alias, context: TransformerContext): any {
481-
return node;
521+
const result: any = {};
522+
523+
if (node.aliasname !== undefined) {
524+
result.aliasname = node.aliasname;
525+
}
526+
527+
if (node.colnames !== undefined) {
528+
result.colnames = Array.isArray(node.colnames)
529+
? node.colnames.map((item: any) => this.transform(item as any, context))
530+
: this.transform(node.colnames as any, context);
531+
}
532+
533+
return { Alias: result };
482534
}
483535

484536
RangeVar(node: PG15.RangeVar, context: TransformerContext): any {
@@ -596,7 +648,13 @@ export class V15ToV16Transformer {
596648
}
597649

598650
Boolean(node: PG15.Boolean, context: TransformerContext): any {
599-
return node;
651+
const result: any = {};
652+
653+
if (node.boolval !== undefined) {
654+
result.boolval = node.boolval;
655+
}
656+
657+
return { Boolean: result };
600658
}
601659

602660
BitString(node: PG15.BitString, context: TransformerContext): any {

0 commit comments

Comments
 (0)