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

Method Evaluate

eval/eval/ternary_step.cc:93–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 right_(std::move(right)) {}
92
93 absl::Status Evaluate(ExecutionFrameBase& frame, cel::Value& result,
94 AttributeTrail& attribute) const override {
95 cel::Value condition;
96
97 AttributeTrail condition_attr;
98
99 CEL_RETURN_IF_ERROR(condition_->Evaluate(frame, condition, condition_attr));
100
101 if (condition.IsError() || condition.IsUnknown()) {
102 result = std::move(condition);
103 attribute = std::move(condition_attr);
104 return absl::OkStatus();
105 }
106
107 if (!condition.IsBool()) {
108 result = cel::ErrorValue(CreateNoMatchingOverloadError(kTernary));
109 return absl::OkStatus();
110 }
111
112 if (condition.GetBool().NativeValue()) {
113 return left_->Evaluate(frame, result, attribute);
114 }
115 return right_->Evaluate(frame, result, attribute);
116 }
117
118 private:
119 std::unique_ptr<DirectExpressionStep> condition_;

Callers

nothing calls this directly

Calls 8

ErrorValueFunction · 0.85
EvaluateMethod · 0.45
IsErrorMethod · 0.45
IsUnknownMethod · 0.45
IsBoolMethod · 0.45
NativeValueMethod · 0.45
GetBoolMethod · 0.45

Tested by

no test coverage detected