Skip to content

Commit aca31d0

Browse files
committed
Safer query for typedef double-definitions
1 parent 3aaf8dd commit aca31d0

File tree

1 file changed

+12
-0
lines changed
  • packages/cli/src/languagePlugins/c/headerResolver

1 file changed

+12
-0
lines changed

packages/cli/src/languagePlugins/c/headerResolver/queries.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@ export const C_DECLARATION_QUERY = new Parser.Query(
1414
(type_definition
1515
type:[
1616
(struct_specifier
17+
name: (_)
1718
body: (_)) @struct
19+
(struct_specifier !name)
1820
(struct_specifier !body)
1921
(enum_specifier
22+
name: (_)
2023
body: (_)) @enum
24+
(enum_specifier !name)
2125
(enum_specifier !body)
2226
(union_specifier
27+
name: (_)
2328
body: (_)) @union
29+
(union_specifier !name)
2430
(union_specifier !body)
2531
(type_identifier)
2632
(primitive_type)
@@ -36,13 +42,19 @@ export const C_DECLARATION_QUERY = new Parser.Query(
3642
(type_definition
3743
type:[
3844
(struct_specifier
45+
name: (_)
3946
body: (_)) @struct
47+
(struct_specifier !name)
4048
(struct_specifier !body)
4149
(enum_specifier
50+
name: (_)
4251
body: (_)) @enum
52+
(enum_specifier !name)
4353
(enum_specifier !body)
4454
(union_specifier
55+
name: (_)
4556
body: (_)) @union
57+
(union_specifier !name)
4658
(union_specifier !body)
4759
(type_identifier)
4860
(primitive_type)

0 commit comments

Comments
 (0)