Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Sep 9, 2024
1 parent 58d1c11 commit 45adb2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
2 changes: 0 additions & 2 deletions ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7299,7 +7299,6 @@ export type Expr =

export type Node =
| { A_ArrayExpr: A_ArrayExpr }
| { A_Const: A_Const }
| { A_Expr: A_Expr }
| { A_Indices: A_Indices }
| { A_Indirection: A_Indirection }
Expand Down Expand Up @@ -7420,7 +7419,6 @@ export type Node =
| { JsonObjectAgg: JsonObjectAgg }
| { JsonObjectConstructor: JsonObjectConstructor }
| { JsonValueExpr: JsonValueExpr }
| { List: List }
| { LoadStmt: LoadStmt }
| { LockingClause: LockingClause }
| { MergeStmt: MergeStmt }
Expand Down
12 changes: 0 additions & 12 deletions node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,6 @@ export class NodePath<TNodeTag extends NodeTag = NodeTag> {
isString(): this is NodePath<"String"> {
return this.tag === "String"
}
isList(): this is NodePath<"List"> {
return this.tag === "List"
}
isA_Const(): this is NodePath<"A_Const"> {
return this.tag === "A_Const"
}
}

function isTaggedNode(node: object, tag: string) {
Expand Down Expand Up @@ -1091,11 +1085,5 @@ export const NodeTag = {
},
isString(node: object | undefined): node is { String: import("./ast").String } {
return node != null && isTaggedNode(node, "String")
},
isList(node: object | undefined): node is { List: import("./ast").List } {
return node != null && isTaggedNode(node, "List")
},
isA_Const(node: object | undefined): node is { A_Const: import("./ast").A_Const } {
return node != null && isTaggedNode(node, "A_Const")
}
}
12 changes: 9 additions & 3 deletions scripts/generateTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,26 +394,32 @@ async function main() {
}
}

// These are untested by libpg_query's test suite, so they've been incorrectly
// marked as type aliases.
typeAliases.delete("CreateExtensionStmt")
typeAliases.delete("AlterExtensionStmt")
typeAliases.delete("AlterExtensionContentsStmt")

for (const name of typeAliases) {
nodeTypes.delete(name)
expressionTypes.delete(name)
nodeTypes.delete(name)
}

nodeTypes.forEach((name) => {
if (!entityNames.includes(name)) {
console.warn("Unknown node type: %O", name)
nodeTypes.delete(name)
}
})

nodeTypes.add("List")
nodeTypes.add("A_Const")
// These expression types neither end in "Expr" nor have a field named "xpr".
// Nonetheless, they are still valid expressions.
expressionTypes.add("A_Const")
expressionTypes.add("ParamRef")

// nodeTypes.add("List")
// nodeTypes.add("A_Const")

code += "\n"
code += "export type QualifiedName = { String: String }[]\n"

Expand Down

0 comments on commit 45adb2a

Please sign in to comment.