fix(phase1): typedef 收集读取 Markers 字段
typedef LONG = int32 等新语法不再依赖 CTypedef 文本标记,LONG 能正确进入 typedef_map 并解析为 int32。
This commit is contained in:
1 parent
3081d71570
commit
4653abd653
1 file changed
+5
-1
@@ -381,7 +381,11 @@ class Phase1Generator:
|
||||
if isinstance(node, ast.AnnAssign) and isinstance(node.target, ast.Name):
|
||||
var_name: str = node.target.id
|
||||
is_typedef: bool = False
|
||||
if isinstance(node.annotation, ast.Attribute) and hasattr(node.annotation, 'attr') and node.annotation.attr == 'CTypedef':
|
||||
_Markers: tuple[str, ...] = (tuple(getattr(node, 'Markers', None) or ())
|
||||
+ tuple(getattr(node.annotation, 'Markers', None) or ()))
|
||||
if 'typedef' in _Markers:
|
||||
is_typedef = True
|
||||
elif isinstance(node.annotation, ast.Attribute) and hasattr(node.annotation, 'attr') and node.annotation.attr == 'CTypedef':
|
||||
is_typedef = True
|
||||
elif isinstance(node.annotation, ast.Name) and node.annotation.id == 'CTypedef':
|
||||
is_typedef = True
|
||||
|
||||
Reference in new issue
Block a user