diff options
| author | Mason Remaley <mason@anthropicstudios.com> | 2025-02-15 15:42:59 -0800 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-04-02 05:53:22 +0100 |
| commit | 06ee383da9a23016dcb25ff7cb6811e3dc2c387e (patch) | |
| tree | a1f407023746af27e8338c08b34a57336ae50cc6 /src/Type.zig | |
| parent | 1b62a22268117340ee7a17f019df01cd39ec1421 (diff) | |
| download | zig-06ee383da9a23016dcb25ff7cb6811e3dc2c387e.tar.gz zig-06ee383da9a23016dcb25ff7cb6811e3dc2c387e.zip | |
compiler: allow `@import` of ZON without a result type
In particular, this allows importing `build.zig.zon` at comptime.
Diffstat (limited to 'src/Type.zig')
| -rw-r--r-- | src/Type.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Type.zig b/src/Type.zig index 3b31337587..ed0df5965f 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -3589,7 +3589,10 @@ pub fn typeDeclSrcLine(ty: Type, zcu: *Zcu) ?u32 { }; const info = tracked.resolveFull(&zcu.intern_pool) orelse return null; const file = zcu.fileByIndex(info.file); - const zir = file.zir.?; + const zir = switch (file.getMode()) { + .zig => file.zir.?, + .zon => return 0, + }; const inst = zir.instructions.get(@intFromEnum(info.inst)); return switch (inst.tag) { .struct_init, .struct_init_ref => zir.extraData(Zir.Inst.StructInit, inst.data.pl_node.payload_index).data.abs_line, |
