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

Function find_function_params

internal/cbm/extract_defs.c:3405–3429  ·  view source on GitHub ↗

Resolve the parameter-list node across the grammars used by the generic * definition extractor. Newer tree-sitter-kotlin exposes * `function_value_parameters` as a direct child rather than a `parameters` * field. Keep the legacy and ordered signature extractors on the same node so * adding positional metadata does not replace or reinterpret `param_types`. */

Source from the content-addressed store, hash-verified

3403 * field. Keep the legacy and ordered signature extractors on the same node so
3404 * adding positional metadata does not replace or reinterpret `param_types`. */
3405static TSNode find_function_params(TSNode func_node, CBMLanguage lang) {
3406 TSNode params = ts_node_child_by_field_name(func_node, TS_FIELD("parameters"));
3407 // ObjectScript exposes the parameter list under a `parameter_list` field.
3408 if (ts_node_is_null(params) &&
3409 (lang == CBM_LANG_OBJECTSCRIPT_UDL || lang == CBM_LANG_OBJECTSCRIPT_ROUTINE)) {
3410 params = ts_node_child_by_field_name(func_node, TS_FIELD("parameter_list"));
3411 }
3412 if (ts_node_is_null(params) && lang == CBM_LANG_OBJECTSCRIPT_ROUTINE) {
3413 params = cbm_find_child_by_kind(func_node, "parameter_list");
3414 }
3415 if (ts_node_is_null(params) && lang == CBM_LANG_OBJECTSCRIPT_UDL) {
3416 TSNode method_definition = cbm_find_child_by_kind(func_node, "method_definition");
3417 if (!ts_node_is_null(method_definition)) {
3418 params = cbm_find_child_by_kind(method_definition, "arguments");
3419 }
3420 }
3421 if (ts_node_is_null(params) && lang == CBM_LANG_KOTLIN) {
3422 params = cbm_find_child_by_kind(func_node, "function_value_parameters");
3423 }
3424 if (ts_node_is_null(params) && (lang == CBM_LANG_C || lang == CBM_LANG_CPP ||
3425 lang == CBM_LANG_CUDA || lang == CBM_LANG_GLSL)) {
3426 params = find_c_params(func_node);
3427 }
3428 return params;
3429}
3430
3431// C++: resolve trailing return type (auto f() -> Type) on a declarator node.
3432// Updates def->return_type and def->return_types if trailing type found.

Callers 2

extract_func_defFunction · 0.85
push_method_defFunction · 0.85

Calls 2

cbm_find_child_by_kindFunction · 0.85
find_c_paramsFunction · 0.85

Tested by

no test coverage detected