From 88645fe7dac77c59e5e170ae5749b6598f3476eb Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sun, 18 Oct 2026 20:18:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(func):=20extern/export=20=E5=A3=B0=E6=98=8E?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E6=8E=89=E5=87=BA=E6=9C=AB=E5=B0=BE=E6=A3=80?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FunctionDef.Extern/Export 为真时视为声明型函数,不再要求显式 return。 --- lib/core/Handles/HandlesFunctions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/Handles/HandlesFunctions.py b/lib/core/Handles/HandlesFunctions.py index 87d1d71..8d7c6dd 100644 --- a/lib/core/Handles/HandlesFunctions.py +++ b/lib/core/Handles/HandlesFunctions.py @@ -2101,7 +2101,9 @@ class FunctionHandle(BaseHandle): _DeclMarkers: tuple[str, ...] = ( tuple(getattr(Node, 'Markers', None) or ()) + tuple(getattr(Node.returns, 'Markers', None) or ())) - _IsDecl: bool = any(m in ('state', 'export', 'extern') for m in _DeclMarkers) + _IsDecl: bool = (any(m in ('state', 'export', 'extern') for m in _DeclMarkers) + or bool(getattr(Node, 'Extern', False)) + or bool(getattr(Node, 'Export', False))) if not _IsDecl and not _IsVoidOrDeclAnnotation(Node.returns): raise Exception( f"函数 {Node.name} 声明了返回类型但函数体可能掉出末尾(缺少 return 语句);"