| 196 | } |
| 197 | |
| 198 | absl::Status MapExprToProto(const Expr& expr, const MapExpr& map_expr, |
| 199 | ExprProto* absl_nonnull proto) { |
| 200 | proto->Clear(); |
| 201 | auto* map_proto = proto->mutable_struct_expr(); |
| 202 | proto->set_id(expr.id()); |
| 203 | if (!map_expr.entries().empty()) { |
| 204 | map_proto->mutable_entries()->Reserve( |
| 205 | static_cast<int>(map_expr.entries().size())); |
| 206 | for (const auto& entry_expr : map_expr.entries()) { |
| 207 | auto* entry_proto = map_proto->add_entries(); |
| 208 | entry_proto->set_id(entry_expr.id()); |
| 209 | if (entry_expr.has_key()) { |
| 210 | Push(entry_expr.key(), entry_proto->mutable_map_key()); |
| 211 | } |
| 212 | if (entry_expr.has_value()) { |
| 213 | Push(entry_expr.value(), entry_proto->mutable_value()); |
| 214 | } |
| 215 | if (entry_expr.optional()) { |
| 216 | entry_proto->set_optional_entry(true); |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | return absl::OkStatus(); |
| 221 | } |
| 222 | |
| 223 | absl::Status ComprehensionExprToProto( |
| 224 | const Expr& expr, const ComprehensionExpr& comprehension_expr, |
nothing calls this directly
no test coverage detected