Skip to content

Commit 7069906

Browse files
committed
Zcu: fix @embedFile of "std", "root", "builtin"
1 parent 5514b3d commit 7069906

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Zcu/PerThread.zig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,16 @@ pub fn embedFile(
23822382
const zcu = pt.zcu;
23832383
const gpa = zcu.gpa;
23842384

2385-
if (cur_file.mod.?.deps.get(import_string)) |mod| {
2385+
const opt_mod: ?*Module = m: {
2386+
if (mem.eql(u8, import_string, "std")) break :m zcu.std_mod;
2387+
if (mem.eql(u8, import_string, "root")) break :m zcu.root_mod;
2388+
if (mem.eql(u8, import_string, "builtin")) {
2389+
const opts = cur_file.mod.?.getBuiltinOptions(zcu.comp.config);
2390+
break :m zcu.builtin_modules.get(opts.hash()).?;
2391+
}
2392+
break :m cur_file.mod.?.deps.get(import_string);
2393+
};
2394+
if (opt_mod) |mod| {
23862395
const resolved_path = try std.fs.path.resolve(gpa, &.{
23872396
zcu.comp.cwd,
23882397
mod.root.root_dir.path orelse ".",

0 commit comments

Comments
 (0)