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

Method ValidateNonStrictOverload

runtime/function_registry.cc:241–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241bool FunctionRegistry::ValidateNonStrictOverload(
242 const cel::FunctionDescriptor& descriptor) const {
243 auto overloads = functions_.find(descriptor.name());
244 if (overloads == functions_.end()) {
245 return true;
246 }
247 const RegistryEntry& entry = overloads->second;
248 if (!descriptor.is_strict()) {
249 // If the newly added overload is a non-strict function, we require that
250 // there are no other overloads, which is not possible here.
251 return false;
252 }
253 // If the newly added overload is a strict function, we need to make sure
254 // that no previous overloads are registered non-strict. If the list of
255 // overload is not empty, we only need to check the first overload. This is
256 // because if the first overload is strict, other overloads must also be
257 // strict by the rule.
258 return (entry.static_overloads.empty() ||
259 entry.static_overloads[0].descriptor->is_strict()) &&
260 (entry.lazy_overloads.empty() ||
261 entry.lazy_overloads[0].descriptor->is_strict());
262}
263
264} // namespace cel

Callers

nothing calls this directly

Calls 4

is_strictMethod · 0.80
nameMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected