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

Function resolve_condition_value

src/cypher/cypher.c:2545–2574  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2543
2544/* Resolve the actual property value for a condition from a binding */
2545static const char *resolve_condition_value(const cbm_condition_t *c, binding_t *b) {
2546 /* Multi-arg scalar function LHS: coalesce(f.depth, 0) >= 2 (#874).
2547 * Evaluated through the same code path as RETURN projections. The value is
2548 * consumed by eval_condition before any other condition is resolved, so a
2549 * single thread-local buffer per call is safe. */
2550 if (c->func) {
2551 static _Thread_local char func_buf[CBM_SZ_512];
2552 cbm_return_item_t item = {0};
2553 item.variable = c->variable;
2554 item.property = c->property;
2555 item.func = c->func;
2556 item.args = c->args;
2557 item.arg_count = c->arg_count;
2558 return eval_multiarg_func(b, &item, func_buf, sizeof(func_buf));
2559 }
2560
2561 cbm_edge_t *e = binding_get_edge(b, c->variable);
2562 if (e) {
2563 return edge_prop(e, c->property);
2564 }
2565 cbm_node_t *n = binding_get(b, c->variable);
2566 if (!n) {
2567 return NULL; /* unbound variable */
2568 }
2569 if (c->property) {
2570 return node_prop(n, c->property, b->store);
2571 }
2572 /* Bare alias (e.g. post-WITH virtual var) — use node name directly */
2573 return n->name ? n->name : "";
2574}
2575
2576/* Evaluate a comparison operator between actual and expected strings. */
2577static bool eval_comparison_op(const char *op, const char *actual, const char *expected) {

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