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

Function kind_in_set_strcmp

internal/cbm/helpers.c:497–505  ·  view source on GitHub ↗

── Node-type classification: TSSymbol bitset acceleration ─────────────── * cbm_kind_in_set is called for nearly every AST node (function/class/call/ * import/branching sets), so a linear strcmp over the type-name array is a hot * path. tree-sitter already assigns each node type a small integer TSSymbol, so * we precompute — per (language, type-array) — a bitset of the matching symbol * ids a

Source from the content-addressed store, hash-verified

495 * set (exact=false) and we fall back to the exact strcmp behavior — so the
496 * result is always identical to the original, only faster. */
497static bool kind_in_set_strcmp(TSNode node, const char *const *types) {
498 const char *kind = ts_node_type(node);
499 for (const char *const *t = types; *t; t++) {
500 if (strcmp(kind, *t) == 0) {
501 return true;
502 }
503 }
504 return false;
505}
506
507typedef struct {
508 const TSLanguage *lang; /* NULL = empty slot */

Callers 1

cbm_kind_in_setFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected