From 285f4c25e2b442507ee193eaac453d7768588baf Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Mon, 17 Aug 2026 08:27:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(handles):=20ExprCallHandle=20=E7=B1=BB?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E8=A3=B8=E8=B0=83=E7=94=A8=E8=A1=A5=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=89=8D=E7=BC=80=EF=BC=88translate=5Fcall/printf/pri?= =?UTF-8?q?nt=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 拆分后主文件保留的 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 裸调用扫描清零。 --- App/lib/core/Gen/ExprGenName.vp | 2 +- App/lib/core/Handles/HandlesExprCall.vp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/App/lib/core/Gen/ExprGenName.vp b/App/lib/core/Gen/ExprGenName.vp index cdb03bc..0aadd15 100644 --- a/App/lib/core/Gen/ExprGenName.vp +++ b/App/lib/core/Gen/ExprGenName.vp @@ -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) diff --git a/App/lib/core/Handles/HandlesExprCall.vp b/App/lib/core/Handles/HandlesExprCall.vp index 3e37b39..80bd7e2 100644 --- a/App/lib/core/Handles/HandlesExprCall.vp +++ b/App/lib/core/Handles/HandlesExprCall.vp @@ -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)