diff options
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/type.zig b/src/type.zig index 7d3308e403..8fcaba6fad 100644 --- a/src/type.zig +++ b/src/type.zig @@ -3408,6 +3408,11 @@ pub const Type = extern union { }; } + pub fn init(comptime t: Tag) Type { + comptime std.debug.assert(@enumToInt(t) < Tag.no_payload_count); + return .{ .tag_if_small_enough = @enumToInt(t) }; + } + pub fn create(comptime t: Tag, ally: *Allocator, data: Data(t)) error{OutOfMemory}!Type { const ptr = try ally.create(t.Type()); ptr.* = .{ |
