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

Function AddOverloadInternal

common/decl.cc:110–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109template <typename Overload>
110void AddOverloadInternal(std::string_view function_name,
111 std::vector<OverloadDecl>& insertion_order,
112 OverloadDeclHashSet& overloads, Overload&& overload,
113 absl::Status& status) {
114 if (!status.ok()) {
115 return;
116 }
117
118 if (overload.id().empty()) {
119 OverloadDecl overload_decl = overload;
120 absl::StatusOr<std::string> overload_id =
121 common_internal::MakeOverloadSignature(
122 function_name, overload_decl.args(), overload_decl.member());
123 if (!overload_id.ok()) {
124 status = overload_id.status();
125 return;
126 }
127 overload_decl.set_id(*overload_id);
128 AddOverloadInternal(function_name, insertion_order, overloads,
129 std::move(overload_decl), status);
130 return;
131 }
132
133 if (auto it = overloads.find(overload.id()); it != overloads.end()) {
134 status = absl::AlreadyExistsError(
135 absl::StrCat("overload already exists: ", overload.id()));
136 return;
137 }
138 for (const auto& existing : overloads) {
139 if (SignaturesOverlap(overload, existing)) {
140 status = absl::InvalidArgumentError(
141 absl::StrCat("overload signature collision: ", existing.id(),
142 " collides with ", overload.id()));
143 return;
144 }
145 }
146 const auto inserted = overloads.insert(std::forward<Overload>(overload));
147 ABSL_DCHECK(inserted.second);
148 insertion_order.push_back(*inserted.first);
149}
150
151void CollectTypeParams(absl::flat_hash_set<std::string>& type_params,
152 const Type& type) {

Callers 1

AddOverloadImplMethod · 0.85

Calls 9

MakeOverloadSignatureFunction · 0.85
SignaturesOverlapFunction · 0.85
argsMethod · 0.80
memberMethod · 0.80
okMethod · 0.45
emptyMethod · 0.45
idMethod · 0.45
set_idMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected