| 111 | } // namespace |
| 112 | |
| 113 | absl::StatusOr<bool> CompileAndEvaluateWithBoolVar(absl::string_view cel_expr, |
| 114 | bool bool_var) { |
| 115 | CEL_ASSIGN_OR_RETURN(std::unique_ptr<cel::Compiler> compiler, |
| 116 | MakeCelCompiler()); |
| 117 | |
| 118 | CEL_ASSIGN_OR_RETURN(CheckedExpr checked_expr, |
| 119 | CompileToCheckedExpr(*compiler, cel_expr)); |
| 120 | |
| 121 | Activation activation; |
| 122 | google::protobuf::Arena arena; |
| 123 | // === Start Codelab === |
| 124 | activation.InsertValue("bool_var", CelValue::CreateBool(bool_var)); |
| 125 | // === End Codelab === |
| 126 | |
| 127 | return EvalCheckedExpr(checked_expr, activation, &arena); |
| 128 | } |
| 129 | |
| 130 | absl::StatusOr<bool> CompileAndEvaluateWithContext( |
| 131 | absl::string_view cel_expr, const AttributeContext& context) { |