fix(exprcall): 兄弟 Mixin 兜底过滤泛型特化类名——防误绑定 list 特化函数
与 TPV CallGenCall.vp 086e792 同根因:JsonValue.__getitem__ 在 found_func 未命中时被兜底遍历 class_methods 误绑到 list[ASTptr].__getitem__ 特化函数,this 按 list 布局前移 sizeof(list) → 运行期读 -1 崩溃(Config.vp root.__getitem__)。候选类名含 '[' 时跳过。
This commit is contained in:
1 parent
f2cdbdc70f
commit
3fd875daca
1 file changed
+8
@@ -3170,9 +3170,17 @@ class ExprCallHandle(BaseHandle):
|
||||
# 已注册类找定义类,this 由 _adjust_this_for_inherited_method 按
|
||||
# 组合布局前移 sizeof(定义类 struct)。修复 TPC 编译 TPV 的
|
||||
# undefined symbol: <sha1>.BaseB.helper / StmtGenDeclMixin.translate_*。
|
||||
# 仅对普通类名兜底:泛型特化类名(list[X]/dict[K,V],含 '[')是
|
||||
# 模板容器,其特化函数(如 list[ASTptr].__getitem__)在模块中存在
|
||||
# 但绝非"兄弟 Mixin"——若不过滤,JsonValue.__getitem__ 等普通
|
||||
# 方法调用在找不到时会误绑定到 list 特化函数,this 按 list 布局
|
||||
# 前移 sizeof(list) → 运行期读 -1 崩溃(Config.vp 的
|
||||
# root.__getitem__ 根因,与 TPV CallGenCall.vp 兜底修复一致)。
|
||||
for _cand_cls, _cand_methods in list(Gen.class_methods.items()):
|
||||
if _cand_cls == ClassName:
|
||||
continue
|
||||
if '[' in _cand_cls:
|
||||
continue
|
||||
if not any(_cm.endswith(f'.{MethodName}') or _cm == MethodName for _cm in _cand_methods):
|
||||
continue
|
||||
_cand_full = f'{_cand_cls}.{MethodName}'
|
||||
|
||||
Reference in new issue
Block a user