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

Function AppendList

runtime/standard/container_functions.cc:86–97  ·  view source on GitHub ↗

AppendList will append the elements in value2 to value1. This call will only be invoked within comprehensions where `value1` is an intermediate result which cannot be directly assigned or co-mingled with a user-provided list.

Source from the content-addressed store, hash-verified

84// intermediate result which cannot be directly assigned or co-mingled with a
85// user-provided list.
86absl::StatusOr<ListValue> AppendList(ListValue value1, const Value& value2) {
87 // The `value1` object cannot be directly addressed and is an intermediate
88 // variable. Once the comprehension completes this value will in effect be
89 // treated as immutable.
90 if (auto mutable_list_value =
91 cel::common_internal::AsMutableListValue(value1);
92 mutable_list_value) {
93 CEL_RETURN_IF_ERROR(mutable_list_value->Append(value2));
94 return value1;
95 }
96 return absl::InvalidArgumentError("Unexpected call to runtime list append.");
97}
98} // namespace
99
100absl::Status RegisterContainerFunctions(FunctionRegistry& registry,

Callers 1

AppendExprMethod · 0.85

Calls 1

AppendMethod · 0.45

Tested by

no test coverage detected