From e63ff4f1c110165c4b92025cb5b9d5531e861643 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Sun, 13 Jun 2021 22:27:27 +0300 Subject: add ast-check flag to zig fmt, fix found bugs --- src/type.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/type.zig') diff --git a/src/type.zig b/src/type.zig index 3e6c810b20..410773b649 100644 --- a/src/type.zig +++ b/src/type.zig @@ -6,6 +6,8 @@ const Target = std.Target; const Module = @import("Module.zig"); const log = std.log.scoped(.Type); +const file_struct = @This(); + /// This is the raw data, with no bookkeeping, no memory awareness, no de-duplication. /// It's important for this type to be small. /// Types are not de-duplicated, which helps with multi-threading since it obviates the requirement @@ -3000,12 +3002,12 @@ pub const Type = extern union { }; } - pub fn init(comptime t: Tag) Type { + pub fn init(comptime t: Tag) file_struct.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 { + pub fn create(comptime t: Tag, ally: *Allocator, data: Data(t)) error{OutOfMemory}!file_struct.Type { const ptr = try ally.create(t.Type()); ptr.* = .{ .base = .{ .tag = t }, -- cgit v1.2.3