| 112 | } |
| 113 | |
| 114 | absl::Status AddLibrarySubset(CompilerLibrarySubset subset) override { |
| 115 | if (subset.library_id.empty()) { |
| 116 | return absl::InvalidArgumentError("library id must not be empty"); |
| 117 | } |
| 118 | std::string library_id = subset.library_id; |
| 119 | |
| 120 | auto [it, inserted] = subsets_.insert(library_id); |
| 121 | if (!inserted) { |
| 122 | return absl::AlreadyExistsError( |
| 123 | absl::StrCat("library subset already exists for: ", library_id)); |
| 124 | } |
| 125 | |
| 126 | if (subset.should_include_macro) { |
| 127 | CEL_RETURN_IF_ERROR(parser_builder_->AddLibrarySubset({ |
| 128 | library_id, |
| 129 | std::move(subset.should_include_macro), |
| 130 | })); |
| 131 | } |
| 132 | if (subset.should_include_overload) { |
| 133 | CEL_RETURN_IF_ERROR(type_checker_builder_->AddLibrarySubset( |
| 134 | {library_id, std::move(subset.should_include_overload)})); |
| 135 | } |
| 136 | return absl::OkStatus(); |
| 137 | } |
| 138 | |
| 139 | ParserBuilder& GetParserBuilder() override { return *parser_builder_; } |
| 140 | TypeCheckerBuilder& GetCheckerBuilder() override { |