Scan the annotation nodes nested in a JVM/C# `modifiers`/`attribute_list` * wrapper (and direct children) for a route-mapping annotation. Java/Kotlin * Spring annotations (@GetMapping, @RequestMapping, ...) live here rather than * as prev-siblings, so the prev-sibling decorator walk never sees them. */
| 1610 | * Spring annotations (@GetMapping, @RequestMapping, ...) live here rather than |
| 1611 | * as prev-siblings, so the prev-sibling decorator walk never sees them. */ |
| 1612 | static bool extract_route_from_annotations(CBMArena *a, TSNode func_node, const char *source, |
| 1613 | const CBMLangSpec *spec, const char **out_path, |
| 1614 | const char **out_method) { |
| 1615 | TSNode modifiers = find_jvm_modifiers(func_node, spec->language); |
| 1616 | if (!ts_node_is_null(modifiers)) { |
| 1617 | uint32_t mc = ts_node_child_count(modifiers); |
| 1618 | for (uint32_t mi = 0; mi < mc; mi++) { |
| 1619 | TSNode mchild = ts_node_child(modifiers, mi); |
| 1620 | if (cbm_kind_in_set(mchild, spec->decorator_node_types) && |
| 1621 | try_route_from_annotation(a, mchild, source, out_path, out_method)) { |
| 1622 | return true; |
| 1623 | } |
| 1624 | } |
| 1625 | } |
| 1626 | /* Direct-child annotations (some grammars attach the annotation as a child |
| 1627 | * of the method node rather than under `modifiers`). */ |
| 1628 | uint32_t cc = ts_node_child_count(func_node); |
| 1629 | for (uint32_t ci = 0; ci < cc; ci++) { |
| 1630 | TSNode child = ts_node_child(func_node, ci); |
| 1631 | if (cbm_kind_in_set(child, spec->decorator_node_types) && |
| 1632 | try_route_from_annotation(a, child, source, out_path, out_method)) { |
| 1633 | return true; |
| 1634 | } |
| 1635 | } |
| 1636 | return false; |
| 1637 | } |
| 1638 | |
| 1639 | static void extract_route_from_decorators(CBMArena *a, TSNode func_node, const char *source, |
| 1640 | const CBMLangSpec *spec, const char **out_path, |
no test coverage detected