From 77a97303b7ceebbb0c85ed7cfbeb6c445e172aa5 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sun, 18 Oct 2026 15:54:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(imports):=20=E5=85=A8=E5=B1=80=E5=A3=B0?= =?UTF-8?q?=E6=98=8E=E8=AF=86=E5=88=AB=20Markers=20=E4=B8=AD=E7=9A=84=20ty?= =?UTF-8?q?pedef/define?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit typedef VOID = void 等新语法不再被当作全局变量发射,避免 void 全局变量断言失败。 --- lib/core/Handles/HandlesImports.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/core/Handles/HandlesImports.py b/lib/core/Handles/HandlesImports.py index fd14f7e..74fd7bb 100644 --- a/lib/core/Handles/HandlesImports.py +++ b/lib/core/Handles/HandlesImports.py @@ -1398,7 +1398,13 @@ class ImportHandle(BaseHandle): # 检查是否是 CDefine 常量或 CTypedef 类型别名 IsCDefine = False IsCTypedef = False - if isinstance(Node.annotation, ast.Name): + _GlobalMarkers: tuple[str, ...] = (tuple(getattr(Node, 'Markers', None) or ()) + + tuple(getattr(Node.annotation, 'Markers', None) or ())) + if 'define' in _GlobalMarkers: + IsCDefine = True + elif 'typedef' in _GlobalMarkers: + IsCTypedef = True + elif isinstance(Node.annotation, ast.Name): if Node.annotation.id == 'CDefine': IsCDefine = True elif Node.annotation.id == 'CTypedef':