MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / extract_route_from_annotations

Function extract_route_from_annotations

internal/cbm/extract_defs.c:1612–1637  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

1610 * Spring annotations (@GetMapping, @RequestMapping, ...) live here rather than
1611 * as prev-siblings, so the prev-sibling decorator walk never sees them. */
1612static 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
1639static void extract_route_from_decorators(CBMArena *a, TSNode func_node, const char *source,
1640 const CBMLangSpec *spec, const char **out_path,

Callers 2

Calls 3

find_jvm_modifiersFunction · 0.85
cbm_kind_in_setFunction · 0.85

Tested by

no test coverage detected