feat(gen): M2.3 覆盖面扩展——类方法与嵌套函数的逃逸摘要
摘要键约定:模块级/嵌套函数用裸名(与调用点 func_name 一致),类方法用 "Class.method",查询沿 MRO 回退;刻意不回退裸名,避免方法名与同名模块函数(error/init 等)串味产生误报。 register_file_funcs 登记类方法与嵌套函数摘要,v2 传递闭包相应覆盖(_RescanEscapes 拆为 _RescanOne/_RescanNested/_RescanClassMethods)。 调用点新增:_translate_method_call 的方法路径检查(形参下标含 self,用户第 ai 个实参对应 bit ai+1)、_call_method_on_ptr 的 __init__ 构造器检查(self.f = p 的逃逸;__new__ 形参可能与 __init__ 共享并裁剪,不查)。 已知边界:摘要表按文件重置,跨模块查询待 v3;_PropagateCallEscapes 只处理裸名被调者,方法调用链的传递待补。
This commit is contained in:
1 parent
b03e55bb7e
commit
9f98e683a9
3 files changed
+192
-16
No files matched your search
@@ -298,6 +298,12 @@ def get_ret_borrow(name: str) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def get_param_escapes_method(pool: memhub.MemBuddy*, class_name: str, method_name: str) -> int:
|
||||
"""方法形参逃逸掩码:查 "Class.method" 并沿 MRO 回退,最后退裸名键;无记录返回 0"""
|
||||
if _g_gen is not None: return _g_gen.StructGen.get_param_escapes_method(pool, class_name, method_name)
|
||||
return 0
|
||||
|
||||
|
||||
# ---------------- find_struct_by_type (delegates to StructGenMixin.find_struct_by_type) ----------------
|
||||
def find_struct_by_type(struct_ty: mlirlite.LLVMType*) -> GenTypes.StructEntry*:
|
||||
"""Delegate to gen.find_struct_by_type"""
|
||||
|
||||
Reference in new issue
Block a user