feat(extraction): model union declarations distinctly
This commit is contained in:
1 parent
86854cd0d7
commit
6978acc92e
7 files changed
+84
-44
No files matched your search
@@ -102,9 +102,9 @@ export const objcExtractor: LanguageExtractor = {
|
||||
methodTypes: ['method_definition'],
|
||||
interfaceTypes: ['protocol_declaration'],
|
||||
interfaceKind: 'protocol',
|
||||
// Objective-C is a C superset: `union U { … };` is a definition, same as in
|
||||
// the C extractor.
|
||||
structTypes: ['struct_specifier', 'union_specifier'],
|
||||
structTypes: ['struct_specifier'],
|
||||
// Objective-C is a C superset: union declarations preserve their own kind.
|
||||
unionTypes: ['union_specifier'],
|
||||
enumTypes: ['enum_specifier'],
|
||||
enumMemberTypes: ['enumerator'],
|
||||
typeAliasTypes: ['type_definition'],
|
||||
@@ -130,12 +130,9 @@ export const objcExtractor: LanguageExtractor = {
|
||||
const child = node.namedChild(i);
|
||||
if (!child) continue;
|
||||
if (child.type === 'enum_specifier' && getChildByField(child, 'body')) return 'enum';
|
||||
// `typedef union { … } name;` resolves like `typedef struct` — see the C extractor.
|
||||
if (
|
||||
(child.type === 'struct_specifier' || child.type === 'union_specifier') &&
|
||||
getChildByField(child, 'body')
|
||||
)
|
||||
if (child.type === 'struct_specifier' && getChildByField(child, 'body'))
|
||||
return 'struct';
|
||||
if (child.type === 'union_specifier' && getChildByField(child, 'body')) return 'union';
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user