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

Method JumpTo

eval/eval/evaluator_core.h:353–366  ·  view source on GitHub ↗

Intended for use in builtin shortcutting operations. Offset applies after normal pc increment. For example, JumpTo(0) is a no-op, JumpTo(1) skips the expected next step.

Source from the content-addressed store, hash-verified

351 // Offset applies after normal pc increment. For example, JumpTo(0) is a
352 // no-op, JumpTo(1) skips the expected next step.
353 absl::Status JumpTo(int offset) {
354 ABSL_DCHECK_LE(offset, static_cast<int>(execution_path_.size()));
355 ABSL_DCHECK_GE(offset, -static_cast<int>(pc_));
356
357 int new_pc = static_cast<int>(pc_) + offset;
358 if (new_pc < 0 || new_pc > static_cast<int>(execution_path_.size())) {
359 return absl::Status(absl::StatusCode::kInternal,
360 absl::StrCat("Jump address out of range: position: ",
361 pc_, ", offset: ", offset,
362 ", range: ", execution_path_.size()));
363 }
364 pc_ = static_cast<size_t>(new_pc);
365 return absl::OkStatus();
366 }
367
368 // Move pc to a subexpression.
369 //

Callers 4

JumpMethod · 0.80
EvaluateMethod · 0.80
Evaluate1Method · 0.80
Evaluate2Method · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected