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

Function sig_cpp_tparams

internal/cbm/callable_sig.c:582–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582static void sig_cpp_tparams(sig_ctx_t *c, TSNode node) {
583 TSNode tmpl = node;
584 if (strcmp(ts_node_type(tmpl), "template_declaration") != 0) {
585 tmpl = ts_node_parent(node);
586 if (ts_node_is_null(tmpl) || strcmp(ts_node_type(tmpl), "template_declaration") != 0) {
587 return;
588 }
589 }
590 TSNode list = sig_field(tmpl, "parameters");
591 uint32_t count = ts_node_is_null(list) ? 0 : ts_node_named_child_count(list);
592 sig_raw(c, "<", 1);
593 int written = 0;
594 for (uint32_t i = 0; i < count; i++) {
595 TSNode p = ts_node_named_child(list, i);
596 const char *k = ts_node_type(p);
597 if (sig_skipped_kind(k)) {
598 continue;
599 }
600 if (written++) {
601 sig_raw(c, ",", 1);
602 }
603 /* Template identity depends on parameter kinds, not their names. */
604 if (strcmp(k, "type_parameter_declaration") == 0 ||
605 strcmp(k, "optional_type_parameter_declaration") == 0) {
606 sig_raw_str(c, "typename");
607 } else if (strcmp(k, "variadic_type_parameter_declaration") == 0) {
608 sig_raw_str(c, "typename");
609 sig_raw_str(c, sig_variadic_marker(c->lang));
610 } else if (strcmp(k, "template_template_parameter_declaration") == 0) {
611 sig_raw_str(c, "template");
612 } else {
613 sig_c_param_type(c, p);
614 }
615 }
616 sig_raw(c, ">", 1);
617}
618
619/* `template <class T> void S<T>::f()`: the template parameters belong to the
620 * class, and the in-class declaration `void f();` carries none — both must

Callers 1

sig_renderFunction · 0.85

Calls 6

sig_fieldFunction · 0.85
sig_rawFunction · 0.85
sig_skipped_kindFunction · 0.85
sig_raw_strFunction · 0.85
sig_variadic_markerFunction · 0.85
sig_c_param_typeFunction · 0.85

Tested by

no test coverage detected