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

Function sig_of

tests/test_callable_sig.c:42–56  ·  view source on GitHub ↗

Parse `source`, build the nth `kind` node's suffix in `mode`; the returned * string is arena-owned (NULL when absent). */

Source from the content-addressed store, hash-verified

40/* Parse `source`, build the nth `kind` node's suffix in `mode`; the returned
41 * string is arena-owned (NULL when absent). */
42static const char *sig_of(CBMArena *a, CBMLanguage lang, CBMCallableIdentity mode,
43 const char *source, const char *kind, int nth) {
44 TSParser *parser = ts_parser_new();
45 ts_parser_set_language(parser, cbm_ts_language(lang));
46 TSTree *tree = ts_parser_parse_string(parser, NULL, source, (uint32_t)strlen(source));
47 TSNode node = {0};
48 int left = nth;
49 const char *sig = NULL;
50 if (tree && find_nth(ts_tree_root_node(tree), kind, &left, &node)) {
51 sig = cbm_callable_sig_mode(a, node, source, lang, mode);
52 }
53 ts_tree_delete(tree);
54 ts_parser_delete(parser);
55 return sig;
56}
57
58static const sig_case_t k_cases[] = {
59 /* Java: generics kept, qualifiers and annotations dropped, varargs = []. */

Callers 1

Calls 3

cbm_ts_languageFunction · 0.85
find_nthFunction · 0.85
cbm_callable_sig_modeFunction · 0.85

Tested by

no test coverage detected