pushActiveVisitor static method

InterpreterVisitor? pushActiveVisitor(
  1. InterpreterVisitor visitor
)

Sets visitor as the active visitor and returns the previously-active one.

Hot-path companion to withActiveVisitor for callers that already own a try/finally — most importantly InterpretedFunction.call, which runs on every interpreted function call. Pairing pushActiveVisitor with popActiveVisitor gives identical save/set/restore semantics (nesting included) without allocating the T Function() closure that withActiveVisitor requires per invocation.

Implementation

static InterpreterVisitor? pushActiveVisitor(InterpreterVisitor visitor) {
  final previous = _activeVisitor;
  _activeVisitor = visitor;
  return previous;
}