cli: add explicit package source modules

Link manifest-selected source graphs with module-local names, qualified
structs/enums/functions and task workers through ordinary AIR verification.
Keep source inputs bounded, reject source symlinks and preserve explicit
grants, diagnostics and deterministic canonical lowering.

Integrate spec 12/15, RFC 0021, source reference budgets, roadmap, examples
and CI coverage. Validate 579 conformance tests, unit tests, 76 source
constructs, hosted smoke, 36 package CLI checks and task schedule stress.
This commit is contained in:
dev committed 2026-10-06 18:51:54 +03:00
1 parent 618b4b95c1
commit c96199e7ec
81 files changed
+1419 -234

No files matched your search

+6 -1
View File
@@ -8,6 +8,7 @@ pub const lex = @import("frontend/lex.zig");
pub const ast = @import("frontend/ast.zig");
pub const parse = @import("frontend/parse.zig");
pub const lower_mod = @import("frontend/lower.zig");
pub const modules = @import("frontend/modules.zig");
pub const stdlib = @import("frontend/stdlib.zig");
pub const Span = ast.Span;
@@ -21,6 +22,10 @@ pub const Compiled = union(enum) {
};
pub fn compile(arena: std.mem.Allocator, file: []const u8, source: []const u8) std.mem.Allocator.Error!Compiled {
return compileWithModules(arena, file, source, &.{});
}
pub fn compileWithModules(arena: std.mem.Allocator, file: []const u8, source: []const u8, sources: []const modules.Source) std.mem.Allocator.Error!Compiled {
const parsed = try parse.parse(arena, source);
const m = switch (parsed) {
.ok => |m| m,
@@ -34,7 +39,7 @@ pub fn compile(arena: std.mem.Allocator, file: []const u8, source: []const u8) s
}),
} },
};
const linked = try stdlib.link(arena, m);
const linked = try modules.link(arena, m, sources);
const result = switch (linked) {
.ok => |combined| try lower_mod.lower(arena, combined),
.err => |p| lower_mod.Result{ .err = p },