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

Method Evaluate

eval/eval/jump_step.cc:57–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 leave_on_stack_(leave_on_stack) {}
56
57 absl::Status Evaluate(ExecutionFrame* frame) const override {
58 // Peek the top value
59 if (!frame->value_stack().HasEnough(1)) {
60 return absl::Status(absl::StatusCode::kInternal, "Value stack underflow");
61 }
62
63 const auto& value = frame->value_stack().Peek();
64 const auto should_jump = value.Is<BoolValue>() &&
65 jump_condition_ == value.GetBool().NativeValue();
66
67 if (!leave_on_stack_) {
68 frame->value_stack().Pop(1);
69 }
70
71 if (should_jump) {
72 return Jump(frame);
73 }
74
75 return absl::OkStatus();
76 }
77
78 private:
79 const bool jump_condition_;

Callers

nothing calls this directly

Calls 6

JumpClass · 0.85
HasEnoughMethod · 0.80
PeekMethod · 0.45
NativeValueMethod · 0.45
GetBoolMethod · 0.45
PopMethod · 0.45

Tested by

no test coverage detected