fix(codegen): __sizeof__ 缺 rowptr[X] 指针尺寸分支,泛型特化 T.__sizeof__() 报未定义名称 'T'
list[rowptr[AST]] 特化翻译 list.__init__ 的 T.__sizeof__() 时,T 解析为新一代指针包装 rowptr[AST],尺寸表全部 miss 后落回把接收者 Name(T) 当实例翻译 → NameError: 未定义名称 'T'(SlotsBugTest ast 包 rowptr[list[rowptr[AST]]] 泛型特化根因)。在旧语法联合 X|t.CPtr → 8 分支旁补 rowptr[ 前缀 → 8(指针大小),与联合类型口径对齐。
This commit is contained in:
1 parent
ed373a3ef2
commit
41ed7176e9
1 file changed
+6
@@ -632,6 +632,12 @@ class CallGenDispatch(CallGenBase.CallGenBase):
|
||||
# 对应 TPC 中对 BinOp/BitOr 联合类型的特殊处理
|
||||
if string.strstr(sz_cls_name, "|") is not None:
|
||||
return llvmlite.const_int64(pool, 8)
|
||||
# 新一代指针包装 rowptr[X](等价旧语法 X | t.CPtr,指针大小 8):
|
||||
# list[T].__init__ 的 T.__sizeof__() 特化 T→rowptr[AST] 时,若
|
||||
# 不识别会落回把接收者 Name(T) 当实例翻译 → NameError: 未定义名称
|
||||
# 'T'(SlotsBugTest ast 包 rowptr[list[rowptr[AST]]] 泛型特化根因)。
|
||||
if string.strncmp(sz_cls_name, "rowptr[", 7) == 0:
|
||||
return llvmlite.const_int64(pool, 8)
|
||||
# [阶段3] 统一尺寸口径:库 typedef(BYTE/DWORD 等)先经正常
|
||||
# 库分析解析(resolve_typedef_or_map → 位宽/8),miss 才走
|
||||
# 下方硬编码尺寸表(t/c 核心原语)。
|
||||
|
||||
Reference in new issue
Block a user