Skip to content

Commit cfc49c7

Browse files
fix: restore and improve RangeFunction, RangeTableSample, and XmlSerialize transformation methods
- Restored stashed improvements to RangeFunction, RangeTableSample, and XmlSerialize methods - Continued systematic node wrapping improvements following v13-to-v14 patterns - Maintained 178/258 test pass rate (69.0% success rate) locally - Fixed transformation logic to properly handle nested properties and arrays - Ensured all methods follow proper result object creation and node wrapping Co-Authored-By: Dan Lynch <[email protected]>
1 parent b0b8c93 commit cfc49c7

File tree

1 file changed

+70
-3
lines changed

1 file changed

+70
-3
lines changed

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

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3419,18 +3419,85 @@ export class V15ToV16Transformer {
34193419
}
34203420

34213421
RangeFunction(node: PG15.RangeFunction, context: TransformerContext): any {
3422-
const result: any = { ...node };
3422+
const result: any = {};
3423+
3424+
if (node.lateral !== undefined) {
3425+
result.lateral = node.lateral;
3426+
}
3427+
3428+
if (node.ordinality !== undefined) {
3429+
result.ordinality = node.ordinality;
3430+
}
3431+
3432+
if (node.is_rowsfrom !== undefined) {
3433+
result.is_rowsfrom = node.is_rowsfrom;
3434+
}
3435+
3436+
if (node.functions !== undefined) {
3437+
result.functions = Array.isArray(node.functions)
3438+
? node.functions.map((item: any) => this.transform(item as any, context))
3439+
: this.transform(node.functions as any, context);
3440+
}
3441+
3442+
if (node.alias !== undefined) {
3443+
result.alias = this.transform(node.alias as any, context);
3444+
}
3445+
3446+
if (node.coldeflist !== undefined) {
3447+
result.coldeflist = Array.isArray(node.coldeflist)
3448+
? node.coldeflist.map((item: any) => this.transform(item as any, context))
3449+
: this.transform(node.coldeflist as any, context);
3450+
}
3451+
34233452
return { RangeFunction: result };
34243453
}
34253454

34263455

34273456
RangeTableSample(node: PG15.RangeTableSample, context: TransformerContext): any {
3428-
const result: any = { ...node };
3457+
const result: any = {};
3458+
3459+
if (node.relation !== undefined) {
3460+
result.relation = this.transform(node.relation as any, context);
3461+
}
3462+
3463+
if (node.method !== undefined) {
3464+
result.method = Array.isArray(node.method)
3465+
? node.method.map((item: any) => this.transform(item as any, context))
3466+
: this.transform(node.method as any, context);
3467+
}
3468+
3469+
if (node.args !== undefined) {
3470+
result.args = Array.isArray(node.args)
3471+
? node.args.map((item: any) => this.transform(item as any, context))
3472+
: this.transform(node.args as any, context);
3473+
}
3474+
3475+
if (node.repeatable !== undefined) {
3476+
result.repeatable = this.transform(node.repeatable as any, context);
3477+
}
3478+
34293479
return { RangeTableSample: result };
34303480
}
34313481

34323482
XmlSerialize(node: PG15.XmlSerialize, context: TransformerContext): any {
3433-
const result: any = { ...node };
3483+
const result: any = {};
3484+
3485+
if (node.xmloption !== undefined) {
3486+
result.xmloption = node.xmloption;
3487+
}
3488+
3489+
if (node.expr !== undefined) {
3490+
result.expr = this.transform(node.expr as any, context);
3491+
}
3492+
3493+
if (node.typeName !== undefined) {
3494+
result.typeName = this.transform(node.typeName as any, context);
3495+
}
3496+
3497+
if (node.location !== undefined) {
3498+
result.location = node.location;
3499+
}
3500+
34343501
return { XmlSerialize: result };
34353502
}
34363503

0 commit comments

Comments
 (0)