diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-05-07 15:23:12 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:42:29 -0700 |
| commit | c1ca16d779a3f3201a5a35a88eff188290b2091a (patch) | |
| tree | f6af6b5ac4da7bb28c1b2821c835e51e5b797be4 /src/Module.zig | |
| parent | 9d9e1a29911c0ecf92eb9db10027cf691cd4b07e (diff) | |
| download | zig-c1ca16d779a3f3201a5a35a88eff188290b2091a.tar.gz zig-c1ca16d779a3f3201a5a35a88eff188290b2091a.zip | |
wip: progress towards compiling tests
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Module.zig b/src/Module.zig index 9315c9efa7..f56235c933 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -934,9 +934,12 @@ pub const Decl = struct { pub fn isExtern(decl: Decl) bool { assert(decl.has_tv); - return switch (decl.val.tag()) { - .extern_fn => true, - .variable => decl.val.castTag(.variable).?.data.init.ip_index == .unreachable_value, + return switch (decl.val.ip_index) { + .none => switch (decl.val.tag()) { + .extern_fn => true, + .variable => decl.val.castTag(.variable).?.data.init.ip_index == .unreachable_value, + else => false, + }, else => false, }; } @@ -6833,6 +6836,10 @@ pub fn intType(mod: *Module, signedness: std.builtin.Signedness, bits: u16) Allo } pub fn arrayType(mod: *Module, info: InternPool.Key.ArrayType) Allocator.Error!Type { + if (std.debug.runtime_safety and info.sentinel != .none) { + const sent_ty = mod.intern_pool.indexToKey(info.sentinel).typeOf(); + assert(sent_ty == info.child); + } const i = try intern(mod, .{ .array_type = info }); return i.toType(); } @@ -6848,6 +6855,10 @@ pub fn optionalType(mod: *Module, child_type: InternPool.Index) Allocator.Error! } pub fn ptrType(mod: *Module, info: InternPool.Key.PtrType) Allocator.Error!Type { + if (std.debug.runtime_safety and info.sentinel != .none) { + const sent_ty = mod.intern_pool.indexToKey(info.sentinel).typeOf(); + assert(sent_ty == info.elem_type); + } const i = try intern(mod, .{ .ptr_type = info }); return i.toType(); } |
