MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / GetCompilerLibrary

Method GetCompilerLibrary

env/internal/ext_registry.cc:36–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36absl::StatusOr<CompilerLibrary> ExtensionRegistry::GetCompilerLibrary(
37 absl::string_view name, int version) const {
38 if (version == kLatest) {
39 int max_version = -1;
40 for (const auto& registration : library_registry_) {
41 if ((registration.name_ == name || registration.alias_ == name) &&
42 registration.version_ > max_version) {
43 max_version = registration.version_;
44 }
45 }
46 if (max_version == -1) {
47 return absl::NotFoundError(
48 absl::StrCat("CompilerLibrary not registered: ", name));
49 }
50 version = max_version;
51 }
52 for (const auto& registration : library_registry_) {
53 if ((registration.name_ == name || registration.alias_ == name) &&
54 registration.version_ == version) {
55 return registration.GetLibrary();
56 }
57 }
58
59 return absl::NotFoundError(
60 absl::StrCat("CompilerLibrary not registered: ", name, "#", version));
61}
62} // namespace env_internal
63} // namespace cel

Callers 1

TESTFunction · 0.80

Calls 1

GetLibraryMethod · 0.80

Tested by 1

TESTFunction · 0.64