We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8689af commit ac878b8Copy full SHA for ac878b8
src/pgzx/node.zig
@@ -21,6 +21,12 @@ pub inline fn create(initFrom: anytype) *@TypeOf(initFrom) {
21
return node;
22
}
23
24
+pub inline fn initNode(initFrom: anytype) @TypeOf(initFrom) {
25
+ var node = initFrom;
26
+ setTag(&node, mustFindTag(@TypeOf(initFrom)));
27
+ return node;
28
+}
29
+
30
fn mustFindTag(comptime T: type) Tag {
31
return generated.findTag(T) orelse @compileError("No tag found for type");
32
@@ -57,7 +63,7 @@ pub inline fn copyTypedNode(node: anytype) @TypeOf(node) {
57
63
return @ptrCast(@alignCast(copy(node)));
58
64
59
65
60
-inline fn asNodePtr(node: anytype) *pg.Node {
66
+pub inline fn asNodePtr(node: anytype) *pg.Node {
61
67
checkIsPotentialNodePtr(node);
62
68
return @ptrCast(@alignCast(node));
69
0 commit comments