| 308 | } |
| 309 | |
| 310 | absl::Status Unparser::VisitCreateStruct(const Expr::CreateStruct& expr) { |
| 311 | if (!expr.message_name().empty()) { |
| 312 | Print(expr.message_name()); |
| 313 | } |
| 314 | Print(kLeftBrace); |
| 315 | for (int i = 0; i < expr.entries_size(); i++) { |
| 316 | if (i > 0) { |
| 317 | Print(kComma, kSpace); |
| 318 | } |
| 319 | |
| 320 | const auto& e = expr.entries(i); |
| 321 | if (e.optional_entry()) { |
| 322 | Print(kQuestionMark); |
| 323 | } |
| 324 | switch (e.key_kind_case()) { |
| 325 | case Expr::CreateStruct::Entry::kFieldKey: |
| 326 | Print(FormatField(e.field_key())); |
| 327 | break; |
| 328 | case Expr::CreateStruct::Entry::kMapKey: |
| 329 | CEL_RETURN_IF_ERROR(Visit(e.map_key())); |
| 330 | break; |
| 331 | default: |
| 332 | return absl::InvalidArgumentError( |
| 333 | absl::StrCat("Unexpected struct: ", expr.ShortDebugString())); |
| 334 | } |
| 335 | Print(kColon, kSpace); |
| 336 | CEL_RETURN_IF_ERROR(Visit(e.value())); |
| 337 | } |
| 338 | Print(kRightBrace); |
| 339 | return absl::OkStatus(); |
| 340 | } |
| 341 | |
| 342 | absl::Status Unparser::VisitComprehension(const Expr::Comprehension& expr) { |
| 343 | bool nested = IsComplexOperator(expr.iter_range()); |
nothing calls this directly
no test coverage detected