| 124 | } |
| 125 | |
| 126 | absl::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 |