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

Function FunctionConfigToFunctionDecl

env/env.cc:96–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96absl::StatusOr<FunctionDecl> FunctionConfigToFunctionDecl(
97 const Config::FunctionConfig& function_config, google::protobuf::Arena* arena,
98 const google::protobuf::DescriptorPool* descriptor_pool) {
99 FunctionDecl function_decl;
100 function_decl.set_name(function_config.name);
101 for (const Config::FunctionOverloadConfig& overload_config :
102 function_config.overload_configs) {
103 OverloadDecl overload_decl;
104 overload_decl.set_id(overload_config.overload_id);
105 overload_decl.set_member(overload_config.is_member_function);
106 for (const Config::TypeInfo& parameter : overload_config.parameters) {
107 CEL_ASSIGN_OR_RETURN(Type parameter_type,
108 TypeInfoToType(parameter, descriptor_pool, arena));
109 overload_decl.mutable_args().push_back(parameter_type);
110 }
111 CEL_ASSIGN_OR_RETURN(
112 Type return_type,
113 TypeInfoToType(overload_config.return_type, descriptor_pool, arena));
114 overload_decl.set_result(return_type);
115 CEL_RETURN_IF_ERROR(function_decl.AddOverload(overload_decl));
116 }
117 return function_decl;
118}
119
120} // namespace
121

Callers

nothing calls this directly

Calls 5

set_memberMethod · 0.80
AddOverloadMethod · 0.80
set_nameMethod · 0.45
set_idMethod · 0.45
set_resultMethod · 0.45

Tested by

no test coverage detected