mirror of
https://github.com/ziglang/zig.git
synced 2026-11-22 04:37:39 -05:00
stage2: ensure 'std', 'builtin', and 'root' is always available to @import
This commit is contained in:
1 parent
0fc79d602b
commit
02acde99a1
3 files changed
+9
-21
No files matched your search
@@ -4673,6 +4673,15 @@ pub fn importFile(
|
||||
cur_file: *File,
|
||||
import_string: []const u8,
|
||||
) !ImportFileResult {
|
||||
if (std.mem.eql(u8, import_string, "std")) {
|
||||
return mod.importPkg(mod.main_pkg.table.get("std").?);
|
||||
}
|
||||
if (std.mem.eql(u8, import_string, "builtin")) {
|
||||
return mod.importPkg(mod.main_pkg.table.get("builtin").?);
|
||||
}
|
||||
if (std.mem.eql(u8, import_string, "root")) {
|
||||
return mod.importPkg(mod.root_pkg);
|
||||
}
|
||||
if (cur_file.pkg.table.get(import_string)) |pkg| {
|
||||
return mod.importPkg(pkg);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user