fix(imports): 全局声明识别 Markers 中的 typedef/define
typedef VOID = void 等新语法不再被当作全局变量发射,避免 void 全局变量断言失败。
This commit is contained in:
1 parent
a91bd8f35b
commit
77a97303b7
1 file changed
+7
-1
@@ -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':
|
||||
|
||||
Reference in new issue
Block a user