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

Method ComprehensionExprToProto

common/ast/expr_proto.cc:223–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221 }
222
223 absl::Status ComprehensionExprToProto(
224 const Expr& expr, const ComprehensionExpr& comprehension_expr,
225 ExprProto* absl_nonnull proto) {
226 proto->Clear();
227 auto* comprehension_proto = proto->mutable_comprehension_expr();
228 proto->set_id(expr.id());
229 comprehension_proto->set_iter_var(comprehension_expr.iter_var());
230 comprehension_proto->set_iter_var2(comprehension_expr.iter_var2());
231 if (comprehension_expr.has_iter_range()) {
232 Push(comprehension_expr.iter_range(),
233 comprehension_proto->mutable_iter_range());
234 }
235 comprehension_proto->set_accu_var(comprehension_expr.accu_var());
236 if (comprehension_expr.has_accu_init()) {
237 Push(comprehension_expr.accu_init(),
238 comprehension_proto->mutable_accu_init());
239 }
240 if (comprehension_expr.has_loop_condition()) {
241 Push(comprehension_expr.loop_condition(),
242 comprehension_proto->mutable_loop_condition());
243 }
244 if (comprehension_expr.has_loop_step()) {
245 Push(comprehension_expr.loop_step(),
246 comprehension_proto->mutable_loop_step());
247 }
248 if (comprehension_expr.has_result()) {
249 Push(comprehension_expr.result(), comprehension_proto->mutable_result());
250 }
251 return absl::OkStatus();
252 }
253
254 void Push(const Expr& expr, ExprProto* absl_nonnull proto) {
255 frames_.push(Frame{&expr, proto});

Callers

nothing calls this directly

Calls 11

set_iter_varMethod · 0.80
set_iter_var2Method · 0.80
has_iter_rangeMethod · 0.80
set_accu_varMethod · 0.80
has_accu_initMethod · 0.80
has_loop_conditionMethod · 0.80
has_loop_stepMethod · 0.80
has_resultMethod · 0.80
ClearMethod · 0.45
set_idMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected