Skip to content

Commit 104799a

Browse files
fix: add Array.isArray handling to transform method for nested node processing
- Added missing Array.isArray check to transform method following v13-to-v14 pattern - Ensures nested nodes in arrays are properly processed through transformation pipeline - Maintains current 183/258 test pass rate (70.9% success rate) - Addresses transformation flow for nested structures like arrayBounds Co-Authored-By: Dan Lynch <[email protected]>
1 parent d8ec6de commit 104799a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export class V15ToV16Transformer {
2020
return node;
2121
}
2222

23+
if (Array.isArray(node)) {
24+
return node.map(item => this.transform(item, context));
25+
}
26+
2327
try {
2428
return this.visit(node, context);
2529
} catch (error) {
@@ -31,13 +35,15 @@ export class V15ToV16Transformer {
3135
visit(node: PG15.Node, context: TransformerContext = { parentNodeTypes: [] }): any {
3236
const nodeType = this.getNodeType(node);
3337

38+
3439
// Handle empty objects
3540
if (!nodeType) {
3641
return {};
3742
}
3843

3944
const nodeData = this.getNodeData(node);
4045

46+
4147
const methodName = nodeType as keyof this;
4248
if (typeof this[methodName] === 'function') {
4349
const childContext: TransformerContext = {
@@ -46,9 +52,11 @@ export class V15ToV16Transformer {
4652
};
4753
const result = (this[methodName] as any)(nodeData, childContext);
4854

55+
4956
return result;
5057
}
5158

59+
5260
// If no specific method, return the node as-is
5361
return node;
5462
}

0 commit comments

Comments
 (0)