Skip to content

Commit

Permalink
node: copyTypedNode to preserve node type
Browse files Browse the repository at this point in the history
  • Loading branch information
urso committed Jul 29, 2024
1 parent 4653658 commit 7640de9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pgzx/node.zig
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ pub inline fn copy(node: anytype) *pg.Node {
return @ptrCast(@alignCast(raw));
}

pub inline fn copyTypedNode(node: anytype) @TypeOf(node) {
return @ptrCast(@alignCast(copy(node)));
}

inline fn asNodePtr(node: anytype) *pg.Node {
checkIsPotentialNodePtr(node);
return @ptrCast(@alignCast(node));
Expand Down

0 comments on commit 7640de9

Please sign in to comment.