MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / CompileAndEvaluateWithContext

Function CompileAndEvaluateWithContext

codelab/exercise2.cc:126–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126absl::StatusOr<bool> CompileAndEvaluateWithContext(
127 absl::string_view cel_expr, const AttributeContext& context) {
128 CEL_ASSIGN_OR_RETURN(std::unique_ptr<cel::Compiler> compiler,
129 MakeCelCompiler());
130
131 CEL_ASSIGN_OR_RETURN(CheckedExpr checked_expr,
132 CompileToCheckedExpr(*compiler, cel_expr));
133
134 Activation activation;
135 google::protobuf::Arena arena;
136 // === Start Codelab ===
137 // Update the activation to bind the AttributeContext.
138 // === End Codelab ===
139
140 return EvalCheckedExpr(checked_expr, activation, &arena);
141}
142
143} // namespace cel_codelab

Callers 2

TESTFunction · 0.70
TESTFunction · 0.70

Calls 3

MakeCelCompilerFunction · 0.70
EvalCheckedExprFunction · 0.70
CEL_ASSIGN_OR_RETURNFunction · 0.50

Tested by 2

TESTFunction · 0.56
TESTFunction · 0.56