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:610–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610static bool is_elixir_def_binding(CBMExtractCtx *ctx, TSNode node) {
611 for (TSNode form = ts_node_parent(node); !ts_node_is_null(form); form = ts_node_parent(form)) {
612 if (strcmp(ts_node_type(form), "call") != 0 || ts_node_named_child_count(form) < 2) {
613 continue;
614 }
615 TSNode head = ts_node_named_child(form, 0);
616 if (!text_equals(ctx, head, "def") && !text_equals(ctx, head, "defp") &&
617 !text_equals(ctx, head, "defmacro")) {
618 continue;
619 }
620 TSNode arguments = ts_node_child_by_field_name(form, TS_FIELD("arguments"));
621 if (ts_node_is_null(arguments) || ts_node_named_child_count(arguments) == 0) {
622 arguments = ts_node_named_child(form, 1);
623 }
624 TSNode signature = ts_node_named_child_count(arguments) > 0
625 ? ts_node_named_child(arguments, 0)
626 : arguments;
627 return node_contains(head, node) || node_contains(signature, node);
628 }
629 return false;
630}
631
632static bool is_first_named_part_of(TSNode node, const char *container_kind) {
633 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