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

Function AddSignednessDecls

extensions/math_ext_decls.cc:128–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128absl::Status AddSignednessDecls(TypeCheckerBuilder& builder) {
129 const Type kNumerics[] = {IntType(), DoubleType(), UintType()};
130
131 FunctionDecl sign_decl;
132 sign_decl.set_name("math.sign");
133
134 FunctionDecl abs_decl;
135 abs_decl.set_name("math.abs");
136
137 for (const Type& type : kNumerics) {
138 CEL_RETURN_IF_ERROR(sign_decl.AddOverload(MakeOverloadDecl(
139 absl::StrCat("math_sign_", OverloadTypeName(type)), type, type)));
140 CEL_RETURN_IF_ERROR(abs_decl.AddOverload(MakeOverloadDecl(
141 absl::StrCat("math_abs_", OverloadTypeName(type)), type, type)));
142 }
143
144 CEL_RETURN_IF_ERROR(builder.AddFunction(sign_decl));
145 CEL_RETURN_IF_ERROR(builder.AddFunction(abs_decl));
146
147 return absl::OkStatus();
148}
149
150absl::Status AddSqrtDecls(TypeCheckerBuilder& builder) {
151 const Type kNumerics[] = {IntType(), DoubleType(), UintType()};

Callers 1

Calls 8

MakeOverloadDeclFunction · 0.85
OverloadTypeNameFunction · 0.85
AddOverloadMethod · 0.80
IntTypeClass · 0.50
DoubleTypeClass · 0.50
UintTypeClass · 0.50
set_nameMethod · 0.45
AddFunctionMethod · 0.45

Tested by

no test coverage detected