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

Method FindVariable

runtime/activation.cc:39–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37namespace cel {
38
39absl::StatusOr<bool> Activation::FindVariable(
40 absl::string_view name,
41 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
42 google::protobuf::MessageFactory* absl_nonnull message_factory,
43 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
44 ABSL_DCHECK(descriptor_pool != nullptr);
45 ABSL_DCHECK(message_factory != nullptr);
46 ABSL_DCHECK(result != nullptr);
47
48 auto iter = values_.find(name);
49 if (iter == values_.end()) {
50 return false;
51 }
52
53 const ValueEntry& entry = iter->second;
54 if (entry.provider.has_value()) {
55 return ProvideValue(name, descriptor_pool, message_factory, arena, result);
56 }
57 if (entry.value.has_value()) {
58 *result = *entry.value;
59 return true;
60 }
61 return false;
62}
63
64absl::StatusOr<bool> Activation::ProvideValue(
65 absl::string_view name,

Callers 1

TEST_FFunction · 0.45

Calls 2

endMethod · 0.45
has_valueMethod · 0.45

Tested by 1

TEST_FFunction · 0.36