| 396 | } |
| 397 | |
| 398 | absl::Status AddContainerOps(TypeCheckerBuilder& builder) { |
| 399 | FunctionDecl index; |
| 400 | index.set_name(StandardFunctions::kIndex); |
| 401 | CEL_RETURN_IF_ERROR(index.AddOverload(MakeOverloadDecl( |
| 402 | StandardOverloadIds::kIndexList, TypeParamA(), ListOfA(), IntType()))); |
| 403 | CEL_RETURN_IF_ERROR(index.AddOverload(MakeOverloadDecl( |
| 404 | StandardOverloadIds::kIndexMap, TypeParamB(), MapOfAB(), TypeParamA()))); |
| 405 | CEL_RETURN_IF_ERROR(builder.MergeFunction(std::move(index))); |
| 406 | |
| 407 | FunctionDecl in_op; |
| 408 | in_op.set_name(StandardFunctions::kIn); |
| 409 | CEL_RETURN_IF_ERROR(in_op.AddOverload(MakeOverloadDecl( |
| 410 | StandardOverloadIds::kInList, BoolType(), TypeParamA(), ListOfA()))); |
| 411 | CEL_RETURN_IF_ERROR(in_op.AddOverload(MakeOverloadDecl( |
| 412 | StandardOverloadIds::kInMap, BoolType(), TypeParamA(), MapOfAB()))); |
| 413 | CEL_RETURN_IF_ERROR(builder.AddFunction(std::move(in_op))); |
| 414 | |
| 415 | FunctionDecl in_function_deprecated; |
| 416 | in_function_deprecated.set_name(StandardFunctions::kInFunction); |
| 417 | CEL_RETURN_IF_ERROR(in_function_deprecated.AddOverload(MakeOverloadDecl( |
| 418 | StandardOverloadIds::kInList, BoolType(), TypeParamA(), ListOfA()))); |
| 419 | CEL_RETURN_IF_ERROR(in_function_deprecated.AddOverload(MakeOverloadDecl( |
| 420 | StandardOverloadIds::kInMap, BoolType(), TypeParamA(), MapOfAB()))); |
| 421 | CEL_RETURN_IF_ERROR(builder.AddFunction(std::move(in_function_deprecated))); |
| 422 | |
| 423 | FunctionDecl in_op_deprecated; |
| 424 | in_op_deprecated.set_name(StandardFunctions::kInDeprecated); |
| 425 | CEL_RETURN_IF_ERROR(in_op_deprecated.AddOverload(MakeOverloadDecl( |
| 426 | StandardOverloadIds::kInList, BoolType(), TypeParamA(), ListOfA()))); |
| 427 | CEL_RETURN_IF_ERROR(in_op_deprecated.AddOverload(MakeOverloadDecl( |
| 428 | StandardOverloadIds::kInMap, BoolType(), TypeParamA(), MapOfAB()))); |
| 429 | CEL_RETURN_IF_ERROR(builder.AddFunction(std::move(in_op_deprecated))); |
| 430 | |
| 431 | FunctionDecl size; |
| 432 | size.set_name(StandardFunctions::kSize); |
| 433 | CEL_RETURN_IF_ERROR(size.AddOverload( |
| 434 | MakeOverloadDecl(StandardOverloadIds::kSizeList, IntType(), ListOfA()))); |
| 435 | CEL_RETURN_IF_ERROR(size.AddOverload(MakeMemberOverloadDecl( |
| 436 | StandardOverloadIds::kSizeListMember, IntType(), ListOfA()))); |
| 437 | CEL_RETURN_IF_ERROR(size.AddOverload( |
| 438 | MakeOverloadDecl(StandardOverloadIds::kSizeMap, IntType(), MapOfAB()))); |
| 439 | CEL_RETURN_IF_ERROR(size.AddOverload(MakeMemberOverloadDecl( |
| 440 | StandardOverloadIds::kSizeMapMember, IntType(), MapOfAB()))); |
| 441 | CEL_RETURN_IF_ERROR(size.AddOverload(MakeOverloadDecl( |
| 442 | StandardOverloadIds::kSizeBytes, IntType(), BytesType()))); |
| 443 | CEL_RETURN_IF_ERROR(size.AddOverload(MakeMemberOverloadDecl( |
| 444 | StandardOverloadIds::kSizeBytesMember, IntType(), BytesType()))); |
| 445 | CEL_RETURN_IF_ERROR(size.AddOverload(MakeOverloadDecl( |
| 446 | StandardOverloadIds::kSizeString, IntType(), StringType()))); |
| 447 | CEL_RETURN_IF_ERROR(size.AddOverload(MakeMemberOverloadDecl( |
| 448 | StandardOverloadIds::kSizeStringMember, IntType(), StringType()))); |
| 449 | CEL_RETURN_IF_ERROR(builder.AddFunction(std::move(size))); |
| 450 | |
| 451 | return absl::OkStatus(); |
| 452 | } |
| 453 | |
| 454 | absl::Status AddRelationOps(TypeCheckerBuilder& builder) { |
| 455 | FunctionDecl less_op; |
no test coverage detected