fix(handles): ExprCallHandle 类方法裸调用补模块前缀(translate_call/printf/print)

拆分后主文件保留的 ExprCallHandle.HandleCall/HandlePrintfCall/
HandlePrintCall 仍裸调 translate_call/translate_printf_call/
translate_print_call → TPC 报 Undefined function: 'translate_call'。
改为 ExprCallCall. 前缀并补 import;ExprGenName.find_func_in_module
裸调用同步补 ExprCallBase. 前缀。全 App 裸调用扫描清零。
This commit is contained in:
TermiNexus committed 2026-08-17 08:27:07 +08:00
1 parent 3ff5769290
commit 285f4c25e2
2 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -980,7 +980,7 @@ class ExprGenName(ExprGenBase.ExprGenBase):
si_lookup_gen: str = pool.alloc(128)
if si_lookup_gen is not None:
viperlib.snprintf(si_lookup_gen, 128, "%s.__setitem__", cls_nm_gen)
if find_func_in_module(mod, si_lookup_gen) is not None:
if ExprCallBase.find_func_in_module(mod, si_lookup_gen) is not None:
return None
# 指针类型: 单索引 GEP (getelementptr ty, ptr, idx)
return llvmlite.build_gep(builder, elem_ty2, ptr_val, idx_val)
+4 -3
View File
@@ -20,6 +20,7 @@ import lib.core.Handles.HandlesStruct as HandlesStruct
import lib.core.Handles.HandlesImports as HandlesImports
import lib.core.Handles.HandlesClassDef as HandlesClassDef
import lib.core.StubMerger as StubMerger
import lib.core.Handles.ExprCallCall as ExprCallCall
# ============================================================
@@ -217,7 +218,7 @@ class ExprCallHandle(HandlesBase.Mixin):
# ============================================================
def HandleCall(self, node: ast.AST | t.CPtr) -> llvmlite.Value | t.CPtr:
"""翻译函数调用,从 self.Trans 获取共享状态"""
return translate_call(
return ExprCallCall.translate_call(
self.Trans.Pool, self.Trans._cur_builder, self.Trans.Module,
node,
self.Trans._funcs, self.Trans._func_count, self.Trans)
@@ -227,7 +228,7 @@ class ExprCallHandle(HandlesBase.Mixin):
# ============================================================
def HandlePrintfCall(self, cl: ast.Call | t.CPtr):
"""翻译 printf 调用,从 self.Trans 获取共享状态"""
translate_printf_call(
ExprCallCall.translate_printf_call(
self.Trans.Pool, self.Trans._cur_builder, self.Trans.Module,
cl, self.Trans)
@@ -236,6 +237,6 @@ class ExprCallHandle(HandlesBase.Mixin):
# ============================================================
def HandlePrintCall(self, cl: ast.Call | t.CPtr):
"""翻译 print 调用(类型感知格式化 + 默认换行)"""
translate_print_call(
ExprCallCall.translate_print_call(
self.Trans.Pool, self.Trans._cur_builder, self.Trans.Module,
cl, self.Trans)