| 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}); |
nothing calls this directly
no test coverage detected