doc: rewrite stale evalComptimeString comment (no shortcut still exists)

This commit is contained in:
agra
2026-05-25 11:43:15 +03:00
parent f2b3868579
commit b47896eadf

View File

@@ -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);