function getThrowContext(state) {
  let context = state.tryContext;

  while (context) {
    if (
      context.position === 'try' ||
      (context.hasFinalizer && context.position === 'catch')
    ) {
      return context;
    }
    context = context.upper;
  }

  return state;
}
Gets a context for a `throw` statement.
@param {CodePathState} state A state to get.
@returns {TryContext|CodePathState} A context for a `throw` statement.