From 60dbdfe8d2b43cfe038eb57684f8e320569aa541 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Fri, 28 Aug 2026 10:23:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(tpc):=20=E6=96=B9=E6=B3=95=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E8=99=9A=E5=88=86=E6=B4=BE=E2=80=94=E2=80=94=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E4=B8=8E=E6=A8=A1=E5=9D=97=E7=9F=AD=E5=90=8D=E5=90=8C?= =?UTF-8?q?=E5=90=8D=E6=97=B6=E4=B8=8D=E8=AF=AF=E5=85=A5=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E8=B7=AF=E5=BE=84=EF=BC=88base.kind=20?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E6=A0=B9=E5=9B=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/ast/parser.vp | 7 +++++-- lib/core/Handles/HandlesExprCall.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/ast/parser.vp b/includes/ast/parser.vp index 7a55d99..93bb137 100644 --- a/includes/ast/parser.vp +++ b/includes/ast/parser.vp @@ -1038,6 +1038,9 @@ def _parse_atom(ps: Parser | t.CPtr) -> AST | t.CPtr: if _match_op(ps, TokOp.LBrace): return _parse_brace(ps) + stdio.printf("[DBG-atom-fail] line=%d col=%d type=%d str='%s' op_id=%d\n", + _cur_lineno(ps), _cur_col(ps), _cur_type(ps), + _cur_str(ps) if _cur_str(ps) is not None else "(null)", _cur_op(ps)) ps.error_count += 1 return None @@ -1576,7 +1579,7 @@ def _parse_type_ann(ps: Parser | t.CPtr) -> AST | t.CPtr: ptr_level: t.CInt = 0 # 回收垃圾节点(_parse_test 对后缀 * / ** 的消费产物) if base.kind() == ASTKind.BinOp: - gb: ast.BinOp | t.CPtr = (ast.BinOp | t.CPtr)(base) + gb: BinOp | t.CPtr = (BinOp | t.CPtr)(base) if gb.op == OpKind.Mult and gb.right is None: ptr_level += 1 base = gb.left @@ -1585,7 +1588,7 @@ def _parse_type_ann(ps: Parser | t.CPtr) -> AST | t.CPtr: ptr_level += 2 base = gb.left elif gb.right.kind() == ASTKind.UnaryOp: - gu: ast.UnaryOp | t.CPtr = (ast.UnaryOp | t.CPtr)(gb.right) + gu: UnaryOp | t.CPtr = (UnaryOp | t.CPtr)(gb.right) if gu.op == OpKind.Deref and gu.operand is None: ptr_level += 3 base = gb.left diff --git a/lib/core/Handles/HandlesExprCall.py b/lib/core/Handles/HandlesExprCall.py index 068a7fd..02c0b21 100644 --- a/lib/core/Handles/HandlesExprCall.py +++ b/lib/core/Handles/HandlesExprCall.py @@ -2787,7 +2787,7 @@ class ExprCallHandle(BaseHandle): ModuleName = Node.func.value.id imported = getattr(self.Trans, '_ImportedModules', set()) actual_module = self.Trans.SymbolTable.resolve_alias(ModuleName) - if ModuleName in imported or actual_module in imported: + if (ModuleName in imported or actual_module in imported) and ModuleName not in Gen.var_struct_class: mangled_name = Gen._mangle_func_name(MethodName, actual_module) if Gen._has_function(mangled_name): CallArgs = []