isInterpreterControlFlowSignal function
Whether e is one of the exceptions the interpreter uses to unwind its own
stack, rather than a failure a script or a native callee produced.
These four implement Exception because that is how a Dart exception
travels, not because a host was ever meant to see one. execute()'s
boundary lets every other Error and Exception out unchanged, so a caller
can catch by the type the script actually raised; these are the exception
to that rule. One arriving at a host means the interpreter lost track of a
return, break or continue — an interpreter bug, which is the case the
"Unexpected error" wording was written for.
InternalInterpreterD4rtException is deliberately absent. It carries a value interpreted code threw rather than a jump, and the boundary unwraps it one clause earlier so the host receives that value itself.
Implementation
bool isInterpreterControlFlowSignal(Object e) =>
e is ReturnException ||
e is BreakException ||
e is ContinueException ||
e is ContinueSwitchLabel;