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

Function is_elixir_def_binding

internal/cbm/extract_usages.c:580–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580static bool is_elixir_def_binding(CBMExtractCtx *ctx, TSNode node) {
581 for (TSNode form = ts_node_parent(node); !ts_node_is_null(form); form = ts_node_parent(form)) {
582 if (strcmp(ts_node_type(form), "call") != 0 || ts_node_named_child_count(form) < 2) {
583 continue;
584 }
585 TSNode head = ts_node_named_child(form, 0);
586 if (!text_equals(ctx, head, "def") && !text_equals(ctx, head, "defp") &&
587 !text_equals(ctx, head, "defmacro")) {
588 continue;
589 }
590 TSNode arguments = ts_node_child_by_field_name(form, TS_FIELD("arguments"));
591 if (ts_node_is_null(arguments) || ts_node_named_child_count(arguments) == 0) {
592 arguments = ts_node_named_child(form, 1);
593 }
594 TSNode signature = ts_node_named_child_count(arguments) > 0
595 ? ts_node_named_child(arguments, 0)
596 : arguments;
597 return node_contains(head, node) || node_contains(signature, node);
598 }
599 return false;
600}
601
602static bool is_first_named_part_of(TSNode node, const char *container_kind) {
603 for (TSNode parent = ts_node_parent(node); !ts_node_is_null(parent);

Callers 1

is_policy_bindingFunction · 0.85

Calls 2

text_equalsFunction · 0.85
node_containsFunction · 0.85

Tested by

no test coverage detected