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

Function is_pkl_declaration_binding

internal/cbm/extract_usages.c:1042–1057  ·  view source on GitHub ↗

Pkl declares names positionally: no production labels the declared identifier * with a `name` field, so the generic declared-container rule never binds them * and every method name, parameter name, and property name would be re-emitted * as an ordinary read of itself. Each container below holds its declared name * as named child 0; annotations, defaults, and bodies follow it and stay reads. *

Source from the content-addressed store, hash-verified

1040 * Resolve against the NEAREST container so a nested declaration's own name is
1041 * the only occurrence its parent can bind. */
1042static bool is_pkl_declaration_binding(TSNode node) {
1043 static const char *const declaration_kinds[] = {"methodHeader",
1044 "typedIdentifier",
1045 "classProperty",
1046 "objectProperty",
1047 "clazz",
1048 "typeAlias",
1049 NULL};
1050 for (TSNode parent = ts_node_parent(node); !ts_node_is_null(parent);
1051 parent = ts_node_parent(parent)) {
1052 if (kind_in_exact_set(ts_node_type(parent), declaration_kinds)) {
1053 return named_child_contains(parent, 0, node);
1054 }
1055 }
1056 return false;
1057}
1058
1059static bool is_policy_binding(CBMExtractCtx *ctx, TSNode node, const CBMOccurrenceSpec *occurrence,
1060 WalkState *state) {

Callers 1

is_policy_bindingFunction · 0.85

Calls 2

kind_in_exact_setFunction · 0.85
named_child_containsFunction · 0.85

Tested by

no test coverage detected