diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-02-02 03:19:23 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-02-04 18:38:39 +0000 |
| commit | 7f4bd247c7735ccf277c9bba42222e014cacf856 (patch) | |
| tree | b47acb0631fc101995b03dd415efe587cec9738b /src/type.zig | |
| parent | a1b607acb5c1e9dd03760efd7078185e7628b29d (diff) | |
| download | zig-7f4bd247c7735ccf277c9bba42222e014cacf856.tar.gz zig-7f4bd247c7735ccf277c9bba42222e014cacf856.zip | |
compiler: re-introduce dependencies for incremental compilation
Sema now tracks dependencies appropriately. Early logic in Zcu for
resolving outdated decls/functions is in place. The setup used does not
support `usingnamespace`; compilations using this construct are not yet
supported by this incremental compilation model.
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/type.zig b/src/type.zig index 9ca2822204..f53145a9d7 100644 --- a/src/type.zig +++ b/src/type.zig @@ -4,6 +4,7 @@ const Value = @import("value.zig").Value; const assert = std.debug.assert; const Target = std.Target; const Module = @import("Module.zig"); +const Zcu = Module; const log = std.log.scoped(.Type); const target_util = @import("target.zig"); const TypedValue = @import("TypedValue.zig"); @@ -3228,6 +3229,17 @@ pub const Type = struct { }; } + pub fn typeDeclInst(ty: Type, zcu: *const Zcu) ?InternPool.TrackedInst.Index { + return switch (zcu.intern_pool.indexToKey(ty.toIntern())) { + inline .struct_type, + .union_type, + .enum_type, + .opaque_type, + => |info| info.zir_index.unwrap(), + else => null, + }; + } + pub const @"u1": Type = .{ .ip_index = .u1_type }; pub const @"u8": Type = .{ .ip_index = .u8_type }; pub const @"u16": Type = .{ .ip_index = .u16_type }; |
