diff options
| author | Veikka Tuominen <git@vexu.eu> | 2021-01-31 12:55:33 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2021-02-16 16:37:07 +0200 |
| commit | d835f5cce5fc3b296f55e208905d9ff4d368e497 (patch) | |
| tree | defa873d5bc10497d98599534068b409cdaa782d /src/type.zig | |
| parent | 6ecec4c8b761c9f8f272602ccb2abdfd9656c71c (diff) | |
| download | zig-d835f5cce5fc3b296f55e208905d9ff4d368e497.tar.gz zig-d835f5cce5fc3b296f55e208905d9ff4d368e497.zip | |
translate-c: make Node more like Type
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.* = .{ |
