Bind this node's parameters into the frame just pushed for it. Called after * every push in push_boundary_scopes, so the top frame is this node's own and * pop_expired_scopes unwinds them at exactly the right depth. */
| 289 | * every push in push_boundary_scopes, so the top frame is this node's own and |
| 290 | * pop_expired_scopes unwinds them at exactly the right depth. */ |
| 291 | static void py_bind_scope_parameters(CBMExtractCtx *ctx, TSNode node, WalkState *state) { |
| 292 | if (ctx->language != CBM_LANG_PYTHON || state->scope_top == 0) { |
| 293 | return; |
| 294 | } |
| 295 | const char *kind = ts_node_type(node); |
| 296 | if (strcmp(kind, "function_definition") != 0 && strcmp(kind, "lambda") != 0) { |
| 297 | return; |
| 298 | } |
| 299 | TSNode params = ts_node_child_by_field_name(node, TS_FIELD("parameters")); |
| 300 | if (ts_node_is_null(params)) { |
| 301 | return; |
| 302 | } |
| 303 | uint32_t count = ts_node_named_child_count(params); |
| 304 | for (uint32_t i = 0; i < count; i++) { |
| 305 | py_param_bind(state, py_parameter_name(ctx, ts_node_named_child(params, i))); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | static bool push_scope(WalkState *state, uint8_t kind, uint32_t depth, const char *qn) { |
| 310 | if (!ensure_scope_capacity(state)) { |
no test coverage detected