Skip to content

Commit 3e6d8b3

Browse files
fix: improve FunctionParameter and other non-funcformat transformations for quick wins
Co-Authored-By: Dan Lynch <[email protected]>
1 parent 72c236a commit 3e6d8b3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

packages/transform/src/transformers/v13-to-v14.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export class V13ToV14Transformer {
239239
}
240240

241241
FunctionParameter(node: PG13.FunctionParameter, context: TransformerContext): any {
242-
const result: any = { ...node };
242+
const result: any = {};
243243

244244
if (node.name !== undefined) {
245245
result.name = node.name;
@@ -983,8 +983,20 @@ export class V13ToV14Transformer {
983983
}
984984

985985
private shouldPreserveObjfuncargs(context: TransformerContext): boolean {
986-
// Based on test evidence, objfuncargs should be preserved in almost all contexts
987-
return true; // Always preserve objfuncargs to match test expectations
986+
if (!context.parentNodeTypes || context.parentNodeTypes.length === 0) {
987+
return true;
988+
}
989+
990+
for (const parentType of context.parentNodeTypes) {
991+
if (parentType === 'AlterFunctionStmt' ||
992+
parentType === 'DropStmt' ||
993+
parentType === 'RenameStmt' ||
994+
parentType === 'CommentStmt') {
995+
return false;
996+
}
997+
}
998+
999+
return true;
9881000
}
9891001

9901002
private isVariadicAggregateContext(context: TransformerContext): boolean {

0 commit comments

Comments
 (0)