From 3e4f3b88b0a0bf13acbb5a860b8071a1dc212060 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Wed, 9 Sep 2026 08:57:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(tpv-class):=20lookup=5Ffield=5Fby=5Fclass?= =?UTF-8?q?=20=E8=AF=86=E5=88=AB=2016hex=20=E7=B1=BB=E9=94=AE=E5=89=8D?= =?UTF-8?q?=E7=BC=80=E4=B8=BA=20sha1=EF=BC=8C=E4=BF=AE=E5=A4=8D=20GSList[P?= =?UTF-8?q?aram]=20=E6=A8=A1=E5=9D=97=E8=A7=A3=E6=9E=90=E8=AF=AF=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/lib/core/Gen/StructGenMixin.vp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/App/lib/core/Gen/StructGenMixin.vp b/App/lib/core/Gen/StructGenMixin.vp index 2b6ffce..8ba17db 100644 --- a/App/lib/core/Gen/StructGenMixin.vp +++ b/App/lib/core/Gen/StructGenMixin.vp @@ -897,7 +897,34 @@ class StructGenMixin: string.strncpy(mod_buf_q, class_name, mod_len_q) mod_buf_q[mod_len_q] = '\0' if string.strcmp(mod_buf_q, "t") != 0 and string.strcmp(mod_buf_q, "c") != 0: - mod_sha1_q: str = self._resolve_module_sha1(mod_buf_q, from_imports) + # 模块段是 16 位 hex = SHA1 字面量("{16hex}.Class" 类键形态, + # 泛型类型实参 _norm_type_arg_name 规范化产物,如 + # "29fdb5e25dc949f4.Param"——GSList[Param] 特化方法体内 + # `cur: T | t.CPtr = self.Head` 经 resolve_generic_type_name + # 替换 T 为实参串后 AnnotClassName 即该形态):模块段即模块 + # SHA1,类已注册就证明该模块已编译,直接按 name+sha1 精确匹配, + # 不走 _resolve_module_sha1(store 键是模块名不是 sha1,查 + # "29fdb5e25dc949f4" 恒 None → L956 fail-fast 误杀。本应找得到)。 + # 对齐 find_struct L571-592 同款 hex 处理与 TypeGenResolve + # _is_sha1_prefixed 语义(含 sha1 前缀名的 Name/Attribute 注解 + # 解析均跳过 import 检查)。泛型下标内点(GSList[sha.Param]) + # 已被 _last_dot_outside_brackets 跳过,此处仅顶层 a.b 形态。 + mod_hex_ok_q: int = 1 + if string.strlen(mod_buf_q) == 16: + for hi_q in range(16): + ch_hq: t.CChar = mod_buf_q[hi_q] + if not ((ch_hq >= 48 and ch_hq <= 57) or (ch_hq >= 97 and ch_hq <= 102)): + mod_hex_ok_q = 0 + break + else: + mod_hex_ok_q = 0 + mod_sha1_q: str = None + if mod_hex_ok_q != 0: + # SHA1 前缀自身即"已登记"证据(与既有解析同语义): + # mod_sha1_q 别名 mod_buf_q(下方各返回路径统一 free 一次) + mod_sha1_q = mod_buf_q + else: + mod_sha1_q = self._resolve_module_sha1(mod_buf_q, from_imports) if mod_sha1_q is not None: mod_entry_q: GenTypes.StructEntry | t.CPtr = \ self.find_struct_by_module(bare_q, mod_sha1_q)