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

Method Evaluate

eval/eval/jump_step.cc:94–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 : JumpStepBase(jump_offset, expr_id) {}
93
94 absl::Status Evaluate(ExecutionFrame* frame) const override {
95 // Peek the top value
96 if (!frame->value_stack().HasEnough(1)) {
97 return absl::Status(absl::StatusCode::kInternal, "Value stack underflow");
98 }
99
100 const Value& value = frame->value_stack().Peek();
101
102 if (value->Is<BoolValue>()) {
103 return absl::OkStatus();
104 }
105
106 if (value->Is<ErrorValue>() || value->Is<UnknownValue>()) {
107 return Jump(frame);
108 }
109
110 // Neither bool, error, nor unknown set.
111 Value error_value =
112 cel::ErrorValue(CreateNoMatchingOverloadError("<jump_condition>"));
113
114 frame->value_stack().PopAndPush(std::move(error_value));
115 return Jump(frame);
116
117 return absl::OkStatus();
118 }
119};
120
121} // namespace

Callers

nothing calls this directly

Calls 6

JumpClass · 0.85
ErrorValueFunction · 0.85
HasEnoughMethod · 0.80
PopAndPushMethod · 0.80
PeekMethod · 0.45

Tested by

no test coverage detected