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

Function lexical_boundary_kind

internal/cbm/extract_unified.c:2308–2363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2306}
2307
2308static bool lexical_boundary_kind(TSNode node, CBMLexicalScopeKind *out_kind) {
2309 const char *kind = ts_node_type(node);
2310 static const char *const block_kinds[] = {"block",
2311 "statement_block",
2312 "compound_statement",
2313 "switch_body",
2314 "catch_clause",
2315 "except_clause",
2316 "finally_clause",
2317 "for_statement",
2318 "for_in_statement",
2319 "for_of_statement",
2320 "enhanced_for_statement",
2321 "foreach_statement",
2322 "foreach_clause",
2323 "loop_expression",
2324 "match_block",
2325 "case_block",
2326 "script_block",
2327 "do_block",
2328 NULL};
2329 static const char *const comprehension_kinds[] = {
2330 "list_comprehension", "set_comprehension", "dictionary_comprehension",
2331 "generator_expression", "comprehension_expression", NULL};
2332 static const char *const anonymous_function_kinds[] = {"lambda",
2333 "lambda_expression",
2334 "anonymous_function",
2335 "anonymous_function_creation_expression",
2336 "anonymous_method_expression",
2337 "arrow_function",
2338 "closure_expression",
2339 "func_literal",
2340 "function_expression",
2341 "function_literal",
2342 NULL};
2343 /* Rust inline modules own independent item/import namespaces. Without a
2344 * concrete module scope, `mod inner { use ... as x; }` leaks x into every
2345 * sibling function in the file. */
2346 if (strcmp(kind, "mod_item") == 0) {
2347 *out_kind = CBM_LEXICAL_SCOPE_MODULE;
2348 return true;
2349 }
2350 if (unified_kind_in_set(kind, comprehension_kinds)) {
2351 *out_kind = CBM_LEXICAL_SCOPE_COMPREHENSION;
2352 return true;
2353 }
2354 if (unified_kind_in_set(kind, anonymous_function_kinds)) {
2355 *out_kind = CBM_LEXICAL_SCOPE_FUNCTION;
2356 return true;
2357 }
2358 if (unified_kind_in_set(kind, block_kinds)) {
2359 *out_kind = CBM_LEXICAL_SCOPE_BLOCK;
2360 return true;
2361 }
2362 return false;
2363}
2364
2365static bool node_already_has_lexical_scope(const WalkState *state, TSNode node) {

Callers 1

push_lexical_boundaryFunction · 0.85

Calls 1

unified_kind_in_setFunction · 0.85

Tested by

no test coverage detected