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

Function find_c_params

internal/cbm/extract_defs.c:3378–3398  ·  view source on GitHub ↗

C/C++/CUDA/GLSL: parameters live on function_declarator inside declarator chain.

Source from the content-addressed store, hash-verified

3376
3377// C/C++/CUDA/GLSL: parameters live on function_declarator inside declarator chain.
3378static TSNode find_c_params(TSNode func_node) {
3379 TSNode decl = ts_node_child_by_field_name(func_node, TS_FIELD("declarator"));
3380 for (int d = 0; d < DECLARATOR_DEPTH_LIMIT && !ts_node_is_null(decl); d++) {
3381 TSNode params = ts_node_child_by_field_name(decl, TS_FIELD("parameters"));
3382 if (!ts_node_is_null(params)) {
3383 return params;
3384 }
3385 TSNode nested = ts_node_child_by_field_name(decl, TS_FIELD("declarator"));
3386 /* tree-sitter-cpp and tree-sitter-cuda do not assign the nested
3387 * function declarator a `declarator` field when a reference return
3388 * wraps it (`Item& operator[](int)`). That wrapper has one named child;
3389 * descend only for this reproduced grammar shape. */
3390 if (ts_node_is_null(nested) && strcmp(ts_node_type(decl), "reference_declarator") == 0 &&
3391 ts_node_named_child_count(decl) > 0) {
3392 nested = ts_node_named_child(decl, 0);
3393 }
3394 decl = nested;
3395 }
3396 TSNode null_node = {0};
3397 return null_node;
3398}
3399
3400/* Resolve the parameter-list node across the grammars used by the generic
3401 * definition extractor. Newer tree-sitter-kotlin exposes

Callers 2

find_function_paramsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected