refactor(R0): delete ResolvedProgram pre-pass; add resolveBare/resolveQualified
Removes the S2.x pre-pass and its 10 NodeRefTable maps — 1934 net lines deleted. The Resolver gains two lazy functions: resolveBare(name, from, domain) and resolveQualified(target, name), each returning ResolvedAuthors (verdict + author set). verdictOver and authoredAsDomainAnywhere move from ResolvePass to Resolver as private methods. All domain-predicate helpers (eligibleKind, structDeclOf, fnDeclOf, etc.) are promoted to pub. Test file trimmed from 1352 to 396 lines; old pre-pass population tests replaced by focused resolveBare / resolveQualified verdict tests. 540/540 regression tests pass. Zero behavior change.
This commit is contained in:
19
src/core.zig
19
src/core.zig
@@ -39,11 +39,6 @@ pub const Compilation = struct {
|
||||
/// `imports.buildDeclTable` in parallel with the import facts. Borrowed by
|
||||
/// `ProgramIndex.decl_table`.
|
||||
decl_table: imports.DeclTable,
|
||||
/// The owning resolution pass's output (Fork C S2.1a), built by
|
||||
/// `resolveProgram` before lowering and borrowed by
|
||||
/// `ProgramIndex.resolved_program`. ADDITIVE / PARALLEL / UNCONSUMED — nothing
|
||||
/// in lowering reads it yet, so generated output is byte-identical.
|
||||
resolved_program: ?ir.resolver.ResolvedProgram = null,
|
||||
ir_emitter: ?ir.LLVMEmitter = null,
|
||||
/// Lowered IR module, kept alive past `generateCode` so post-link
|
||||
/// callbacks can re-enter the interpreter to invoke sx functions
|
||||
@@ -85,7 +80,6 @@ pub const Compilation = struct {
|
||||
m.deinit();
|
||||
self.allocator.destroy(m);
|
||||
}
|
||||
if (self.resolved_program) |*rp| rp.deinit();
|
||||
self.diagnostics.deinit();
|
||||
}
|
||||
|
||||
@@ -301,18 +295,6 @@ pub const Compilation = struct {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Run the owning resolution pass (Fork C S2.1a) over the resolved root,
|
||||
/// storing its `ResolvedProgram` on `self` and lending a borrowed pointer to
|
||||
/// `index`. Slotted after the `program_index` import facts are wired and
|
||||
/// before `lowerRoot`. ADDITIVE / PARALLEL / UNCONSUMED — nothing in lowering
|
||||
/// reads the result yet, so this changes no generated byte; it is the clean
|
||||
/// pass seam future consumers (S3) cut over to.
|
||||
fn resolveProgram(self: *Compilation, index: *ir.ProgramIndex, root: *const Node) void {
|
||||
if (self.resolved_program) |*rp| rp.deinit();
|
||||
self.resolved_program = ir.resolver.resolve(root, index, self.file_path, self.allocator);
|
||||
index.resolved_program = &self.resolved_program.?;
|
||||
}
|
||||
|
||||
/// Lower the parsed AST to the sx IR module (shadow pipeline).
|
||||
pub fn lowerToIR(self: *Compilation) !ir.Module {
|
||||
const root = self.resolved_root orelse self.root orelse return ir.Module.init(self.allocator);
|
||||
@@ -332,7 +314,6 @@ pub const Compilation = struct {
|
||||
lowering.program_index.module_decls = &self.module_decls;
|
||||
lowering.program_index.namespace_edges = &self.namespace_edges;
|
||||
lowering.program_index.decl_table = &self.decl_table;
|
||||
self.resolveProgram(&lowering.program_index, root);
|
||||
lowering.lowerRoot(root);
|
||||
if (self.diagnostics.hasErrors()) return error.CompileError;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ const types = @import("types.zig");
|
||||
const inst = @import("inst.zig");
|
||||
const errors = @import("../errors.zig");
|
||||
const type_resolver = @import("type_resolver.zig");
|
||||
const resolver = @import("resolver.zig");
|
||||
|
||||
const Node = ast.Node;
|
||||
const TypeId = types.TypeId;
|
||||
@@ -628,12 +627,6 @@ pub const ProgramIndex = struct {
|
||||
/// in parallel with the import facts. Borrowed view; nothing in lowering
|
||||
/// consumes it for selection yet (additive — S4 makes it the fact-store key).
|
||||
decl_table: ?*imports.DeclTable = null,
|
||||
/// The owning resolution pass's output (Fork C S2.1a), built by
|
||||
/// `resolver.resolve` and owned by `Compilation`. Borrowed view; ADDITIVE /
|
||||
/// PARALLEL / UNCONSUMED — nothing in lowering reads it yet (lowering still
|
||||
/// uses the old selectors), so generated output is byte-identical.
|
||||
resolved_program: ?*resolver.ResolvedProgram = null,
|
||||
|
||||
// ── Declaration maps ──
|
||||
/// Function name → AST decl.
|
||||
fn_ast_map: std.StringHashMap(*const ast.FnDecl),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1478
src/ir/resolver.zig
1478
src/ir/resolver.zig
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user