From b47896eadfc6ae21fd1446d65c3863e9d08f51e6 Mon Sep 17 00:00:00 2001 From: agra Date: Mon, 25 May 2026 11:43:15 +0300 Subject: [PATCH] doc: rewrite stale evalComptimeString comment (no shortcut still exists) --- src/ir/lower.zig | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ir/lower.zig b/src/ir/lower.zig index d593063..f81dab6 100644 --- a/src/ir/lower.zig +++ b/src/ir/lower.zig @@ -6442,12 +6442,14 @@ pub const Lowering = struct { } // Case 2: Evaluate via IR interpreter, reusing the parent module. - // The parent module already has every protocol/struct/impl/thunk - // registered (Allocator, CAllocator, Context, the GPA/Tracker - // thunks), so the interp can run the full protocol-dispatch - // chain that codegen emits. A fresh ct_module would skip the - // scan pass and force every `context.allocator.X` call through - // a `matchContextAllocCall` shortcut to stay runnable. + // The parent's `scanDecls` pass has already registered every + // type / protocol / impl / thunk the comptime call may need + // (Allocator, CAllocator, Context, the per-impl thunks). A + // fresh empty module would only lazy-lower function ASTs and + // would miss the type/protocol registrations, which would break + // `context.allocator.X` — the protocol dispatch chain needs + // those types to resolve struct field layout and the alloc/ + // dealloc thunks at the bottom of the dispatch. const ct_func_id = self.createComptimeFunction("__insert", expr, .string); var interp = interp_mod.Interpreter.init(self.module, self.alloc);