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

Function CompileAndEvaluateWithContext

codelab/solutions/exercise2.cc:130–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130absl::StatusOr<bool> CompileAndEvaluateWithContext(
131 absl::string_view cel_expr, const AttributeContext& context) {
132 CEL_ASSIGN_OR_RETURN(std::unique_ptr<cel::Compiler> compiler,
133 MakeCelCompiler());
134
135 CEL_ASSIGN_OR_RETURN(CheckedExpr checked_expr,
136 CompileToCheckedExpr(*compiler, cel_expr));
137
138 Activation activation;
139 google::protobuf::Arena arena;
140 // === Start Codelab ===
141 CEL_RETURN_IF_ERROR(BindProtoToActivation(
142 &context, &arena, &activation, ProtoUnsetFieldOptions::kBindDefault));
143 // === End Codelab ===
144
145 return EvalCheckedExpr(checked_expr, activation, &arena);
146}
147
148} // namespace cel_codelab

Callers 1

TESTFunction · 0.70

Calls 4

MakeCelCompilerFunction · 0.70
EvalCheckedExprFunction · 0.70
CEL_ASSIGN_OR_RETURNFunction · 0.50
BindProtoToActivationFunction · 0.50

Tested by 1

TESTFunction · 0.56