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

Function is_reference_node

internal/cbm/extract_usages.c:49–75  ·  view source on GitHub ↗

Is this an identifier-like node that represents a reference?

Source from the content-addressed store, hash-verified

47
48// Is this an identifier-like node that represents a reference?
49static bool is_reference_node(TSNode node, CBMLanguage lang) {
50 const char *kind = ts_node_type(node);
51
52 // Common identifier types across languages
53 if (strcmp(kind, "identifier") == 0 || strcmp(kind, "simple_identifier") == 0 ||
54 strcmp(kind, "type_identifier") == 0) {
55 return true;
56 }
57
58 // Language-specific reference types
59 switch (lang) {
60 case CBM_LANG_GO:
61 return strcmp(kind, "field_identifier") == 0 || strcmp(kind, "package_identifier") == 0;
62 case CBM_LANG_PYTHON:
63 return strcmp(kind, "attribute") == 0;
64 case CBM_LANG_RUST:
65 return strcmp(kind, "field_identifier") == 0 || strcmp(kind, "scoped_identifier") == 0;
66 case CBM_LANG_HASKELL:
67 return strcmp(kind, "variable") == 0 || strcmp(kind, "constructor") == 0;
68 case CBM_LANG_OCAML:
69 return strcmp(kind, "value_path") == 0 || strcmp(kind, "constructor_path") == 0;
70 case CBM_LANG_ERLANG:
71 return strcmp(kind, "atom") == 0 || strcmp(kind, "var") == 0;
72 default:
73 return false;
74 }
75}
76
77// Check if a reference node is a definition name (the "name" field of its parent).
78static bool is_definition_name(TSNode node) {

Callers 2

try_emit_usageFunction · 0.85
handle_usagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected