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

Function resolve_condition_value

src/cypher/cypher.c:2648–2677  ·  view source on GitHub ↗

Resolve the actual property value for a condition from a binding */

Source from the content-addressed store, hash-verified

2646
2647/* Resolve the actual property value for a condition from a binding */
2648static const char *resolve_condition_value(const cbm_condition_t *c, binding_t *b) {
2649 /* Multi-arg scalar function LHS: coalesce(f.depth, 0) >= 2 (#874).
2650 * Evaluated through the same code path as RETURN projections. The value is
2651 * consumed by eval_condition before any other condition is resolved, so a
2652 * single thread-local buffer per call is safe. */
2653 if (c->func) {
2654 static _Thread_local char func_buf[CBM_SZ_512];
2655 cbm_return_item_t item = {0};
2656 item.variable = c->variable;
2657 item.property = c->property;
2658 item.func = c->func;
2659 item.args = c->args;
2660 item.arg_count = c->arg_count;
2661 return eval_multiarg_func(b, &item, func_buf, sizeof(func_buf));
2662 }
2663
2664 cbm_edge_t *e = binding_get_edge(b, c->variable);
2665 if (e) {
2666 return edge_prop(e, c->property);
2667 }
2668 cbm_node_t *n = binding_get(b, c->variable);
2669 if (!n) {
2670 return NULL; /* unbound variable */
2671 }
2672 if (c->property) {
2673 return node_prop(n, c->property, b->store);
2674 }
2675 /* Bare alias (e.g. post-WITH virtual var) — use node name directly */
2676 return n->name ? n->name : "";
2677}
2678
2679/* Set when an `=~` or inline-property pattern was refused by the regex
2680 * wrapper's compile-size guard during the CURRENT execution; cbm_cypher_execute

Callers 1

eval_conditionFunction · 0.85

Calls 5

eval_multiarg_funcFunction · 0.85
binding_get_edgeFunction · 0.85
edge_propFunction · 0.85
binding_getFunction · 0.85
node_propFunction · 0.85

Tested by

no test coverage detected