|
28 | 28 | TypedefMember, |
29 | 29 | VariableMember, |
30 | 30 | ) |
| 31 | +from .member.base import is_function_pointer_argstring |
31 | 32 | from .scope import InterfaceScopeKind, ProtocolScopeKind, StructLikeScopeKind |
32 | 33 | from .snapshot import Snapshot |
33 | 34 | from .template import Template |
@@ -460,7 +461,21 @@ def get_typedef_member( |
460 | 461 |
|
461 | 462 | typedef_keyword = "using" |
462 | 463 | if typedef_definition.startswith("typedef"): |
463 | | - typedef_keyword = "typedef" |
| 464 | + # Doxygen's "combining using relations" pass can emit hybrid definitions |
| 465 | + # like "typedef Type Name = Type" for using-declarations on macOS, while |
| 466 | + # Linux builds report "using Name = Type". Normalise the hybrid form for |
| 467 | + # codegen component aliases so snapshots are stable across platforms. |
| 468 | + if ( |
| 469 | + "=" in typedef_definition |
| 470 | + and not is_function_pointer_argstring(typedef_argstring) |
| 471 | + and ( |
| 472 | + "ConcreteComponentDescriptor" in typedef_definition |
| 473 | + or "ConcreteViewShadowNode" in typedef_definition |
| 474 | + ) |
| 475 | + ): |
| 476 | + typedef_keyword = "using" |
| 477 | + else: |
| 478 | + typedef_keyword = "typedef" |
464 | 479 |
|
465 | 480 | typedef = TypedefMember( |
466 | 481 | typedef_name, |
@@ -605,6 +620,14 @@ def create_enum_scope(snapshot: Snapshot, enum_def: compound.EnumdefType) -> Non |
605 | 620 | """ |
606 | 621 | Create an enum scope in the snapshot. |
607 | 622 | """ |
| 623 | + path = parse_qualified_path(enum_def.qualifiedname) |
| 624 | + parent_scope = snapshot.ensure_scope(path[0:-1]) |
| 625 | + enum_name = path[-1] |
| 626 | + if enum_name in parent_scope.inner_scopes: |
| 627 | + existing = parent_scope.inner_scopes[enum_name] |
| 628 | + if existing.kind.name == "enum": |
| 629 | + return |
| 630 | + |
608 | 631 | scope = snapshot.create_enum(enum_def.qualifiedname) |
609 | 632 | scope.kind.type = resolve_linked_text_name(enum_def.get_type())[0] |
610 | 633 | scope.location = enum_def.location.file |
|
0 commit comments