chore(diag): 变量声明槽类型 [VAR-DIAG] - 定位 class 标注是否被解析成 ptr

This commit is contained in:
TermiNexus committed 2026-10-15 23:00:04 +08:00
1 parent 59c032f135
commit 15a210bede
1 file changed
+15
+15
View File
@@ -2254,6 +2254,21 @@ novirtual class AssignGenMixin:
# Ensure the full cross-module struct definition is available (for alloca)
self.Gen.StructGen.ensure_struct_def_in_module(pool, trans.Module, var_ty)
# [TEMP-DIAG] 变量声明的槽类型文本(定位完删除):
# class 标注若被解析成 `ptr`,槽就是"指针"而非值本位(`CAM: V3` / `col: V3` 现场)。
vtb: str = "?"
bt0: str = pool.alloc_tagged(512, memhub.DETSITE_ASSIGNGEN_578)
if bt0 is not None:
mlirlite.TypePrint(bt0, 512, var_ty, pool)
vtb = bt0
vptr0: int = -1
if var_ty is not None: vptr0 = self.Gen.ExprGenBase.is_ptr_type(var_ty)
nm0: str = nm.id
if nm0 is None: nm0 = "?"
fn0: str = None
if trans._cur_func is not None: fn0 = mlirlite.function_get_name(trans._cur_func)
if fn0 is None: fn0 = "?"
stdio.printf("[VAR-DIAG] fn=%s name=%s vptr=%d var_ty=%s\n", fn0, nm0, vptr0, vtb)
alloca: mlirlite.Value* = self.Gen.VarGen._alloca_at_entry(builder, var_ty)
if alloca is not None:
if self.Gen.VarGen.define_var(trans.SymTab, nm.id, alloca) == 0: