Repository navigation
Commit 6b23078
committed
fix(extract): scan every attribute_list sibling, not just the first
A C# attribute stack ([Foo][Bar][Baz]) compiles to separate sibling
attribute_list nodes, one per bracket group — not one attribute_list holding
several entries. find_jvm_modifiers() used ts_node_child_by_field_name(),
which only ever returns the first child registered under a given field, so
every attribute after the first bracket group was silently dropped and never
produced a DECORATES edge (DeusData#1692).
find_jvm_modifiers() now returns every matching wrapper (count + out array,
capped at MAX_ATTR_WRAPPERS) instead of a single TSNode, and its two callers
(extract_decorators, scan_route_annotations) iterate all of them. The
multi-match child scan lives in a new helper, cbm_find_children_by_kind()
(helpers.c/helpers.h), the multi-match sibling of the existing
cbm_find_child_by_kind() — keeps find_jvm_modifiers() a short per-language
dispatch that delegates the traversal, same shape it had before this fix.
Both callers size `wrappers` at MAX_ATTR_WRAPPERS. scan_route_annotations
appends the owner node after the wrappers, so its fill is capped one lower
(MAX_ATTR_WRAPPERS_MINUS_1) rather than the array being declared one larger
— the MAX_X / MAX_X_MINUS_1 pair this file already uses for MAX_BASES,
MAX_PARAMS and MAX_RETURN_TYPES.
No-op for the other languages on this switch: Java/Kotlin/Swift use the
`modifiers` wrapper, a single node that never repeats, and PHP groups a
`#[A] #[B] #[C]` stack under ONE attribute_list holding three
attribute_group children, which the previous lookup already returned whole.
Signed-off-by: Jumaga2015 <jumaga2015@gmail.com>1 parent 46ae198 commit 6b23078
3 files changed
Lines changed: 51 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
1287 | 1289 | | |
1288 | 1290 | | |
1289 | 1291 | | |
1290 | | - | |
| 1292 | + | |
1291 | 1293 | | |
1292 | 1294 | | |
1293 | 1295 | | |
| |||
1673 | 1675 | | |
1674 | 1676 | | |
1675 | 1677 | | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | | - | |
1681 | | - | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1682 | 1681 | | |
1683 | 1682 | | |
1684 | 1683 | | |
| |||
1832 | 1831 | | |
1833 | 1832 | | |
1834 | 1833 | | |
1835 | | - | |
1836 | | - | |
1837 | | - | |
1838 | | - | |
1839 | | - | |
1840 | | - | |
1841 | | - | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
1842 | 1851 | | |
1843 | 1852 | | |
1844 | 1853 | | |
| |||
1848 | 1857 | | |
1849 | 1858 | | |
1850 | 1859 | | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | 1860 | | |
1855 | 1861 | | |
1856 | 1862 | | |
1857 | | - | |
1858 | | - | |
1859 | | - | |
1860 | | - | |
1861 | | - | |
| 1863 | + | |
1862 | 1864 | | |
1863 | | - | |
| 1865 | + | |
1864 | 1866 | | |
1865 | 1867 | | |
1866 | 1868 | | |
| |||
1938 | 1940 | | |
1939 | 1941 | | |
1940 | 1942 | | |
1941 | | - | |
| 1943 | + | |
| 1944 | + | |
1942 | 1945 | | |
1943 | 1946 | | |
1944 | 1947 | | |
1945 | | - | |
1946 | | - | |
1947 | | - | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
1948 | 1951 | | |
1949 | 1952 | | |
1950 | 1953 | | |
| |||
1974 | 1977 | | |
1975 | 1978 | | |
1976 | 1979 | | |
1977 | | - | |
1978 | | - | |
| 1980 | + | |
| 1981 | + | |
1979 | 1982 | | |
1980 | 1983 | | |
1981 | 1984 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
367 | 379 | | |
368 | 380 | | |
369 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
125 | 132 | | |
126 | 133 | | |
127 | 134 | | |
| |||
0 commit comments