From 04acaa3dd531859ef116718e8bc70faa7ef85f25 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 8 Oct 2026 21:44:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(funcdef):=20@life/@willFree=20=E4=BB=8E?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=A1=8C=E4=B8=BA=E8=A3=85=E9=A5=B0?= =?UTF-8?q?=E5=99=A8=E6=A3=80=E6=B5=8B=E4=B8=AD=E6=8E=92=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P2 的编译期生命期标注没有运行时装饰器函数;不排除会生成 wrapper 去调用不存在的 @life/@willFree,并把被装饰的 extern def(stdlib.free)变成本模块 internal 声明。与 TPV 侧 FuncGenDef 同口径。 --- lib/core/Handles/HandlesFunctions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/Handles/HandlesFunctions.py b/lib/core/Handles/HandlesFunctions.py index 7d070a1..761fb07 100644 --- a/lib/core/Handles/HandlesFunctions.py +++ b/lib/core/Handles/HandlesFunctions.py @@ -1398,7 +1398,10 @@ class FunctionHandle(BaseHandle): # 任何 @name 或 @name(args) 只要不是内置装饰器,都视为自定义行为装饰器 behavior_decorators = [] # 内置装饰器名称,这些由编译器特殊处理,不作为行为装饰器 - _BUILTIN_DECORATORS = {'staticmethod', 'property', 'classmethod'} + # 另含**编译期生命期标注**(P2):@life(willFree(...)) 与 @willFree(...) 是纯标注, + # 没有运行时装饰器函数;不排除会生成 wrapper 去调用不存在的 @life/@willFree, + # 并把被装饰的 extern def(如 stdlib.free)变成本模块 internal 声明(llc 报 linkage 错)。 + _BUILTIN_DECORATORS = {'staticmethod', 'property', 'classmethod', 'life', 'willFree'} _symtab: object = self.Trans.SymbolTable if Node.decorator_list: for decorator in Node.decorator_list: