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

Function py_parameter_name

internal/cbm/extract_unified.c:268–286  ·  view source on GitHub ↗

The identifier a Python parameter node binds. Handles the bare, typed, * defaulted, keyword-only, *args and **kwargs shapes. */

Source from the content-addressed store, hash-verified

266/* The identifier a Python parameter node binds. Handles the bare, typed,
267 * defaulted, keyword-only, *args and **kwargs shapes. */
268static const char *py_parameter_name(CBMExtractCtx *ctx, TSNode param) {
269 if (ts_node_is_null(param)) {
270 return NULL;
271 }
272 if (strcmp(ts_node_type(param), "identifier") == 0) {
273 return cbm_node_text(ctx->arena, param, ctx->source);
274 }
275 TSNode name = ts_node_child_by_field_name(param, TS_FIELD("name"));
276 if (!ts_node_is_null(name) && strcmp(ts_node_type(name), "identifier") == 0) {
277 return cbm_node_text(ctx->arena, name, ctx->source);
278 }
279 /* `*args` / `**kwargs`, and any typed shape without a `name` field: the
280 * bound identifier is the first named child. */
281 TSNode first = ts_node_named_child(param, 0);
282 if (!ts_node_is_null(first) && strcmp(ts_node_type(first), "identifier") == 0) {
283 return cbm_node_text(ctx->arena, first, ctx->source);
284 }
285 return NULL;
286}
287
288/* Bind this node's parameters into the frame just pushed for it. Called after
289 * every push in push_boundary_scopes, so the top frame is this node's own and

Callers 1

py_bind_scope_parametersFunction · 0.85

Calls 1

cbm_node_textFunction · 0.85

Tested by

no test coverage detected