| 87 | validator_(std::move(validator)) {} |
| 88 | |
| 89 | absl::Status AddLibrary(CompilerLibrary library) override { |
| 90 | if (!library.id.empty()) { |
| 91 | auto [it, inserted] = library_ids_.insert(library.id); |
| 92 | |
| 93 | if (!inserted) { |
| 94 | return absl::AlreadyExistsError( |
| 95 | absl::StrCat("library already exists: ", library.id)); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | if (library.configure_checker) { |
| 100 | CEL_RETURN_IF_ERROR(type_checker_builder_->AddLibrary({ |
| 101 | .id = library.id, |
| 102 | .configure = std::move(library.configure_checker), |
| 103 | })); |
| 104 | } |
| 105 | if (library.configure_parser) { |
| 106 | CEL_RETURN_IF_ERROR(parser_builder_->AddLibrary({ |
| 107 | .id = library.id, |
| 108 | .configure = std::move(library.configure_parser), |
| 109 | })); |
| 110 | } |
| 111 | return absl::OkStatus(); |
| 112 | } |
| 113 | |
| 114 | absl::Status AddLibrarySubset(CompilerLibrarySubset subset) override { |
| 115 | if (subset.library_id.empty()) { |