transformMachineStates(machine, machineEndState, rethrowState,
                         enclosingFinallyState) {

    let cases = [];

    for (let i = 0; i < machine.states.length; i++) {
      let state = machine.states[i];
      let stateCase = state.transformMachineState(
          enclosingFinallyState[state.id],
          machineEndState, this.reporter);
      if (stateCase !== null) {
        cases.push(stateCase);
      }
    }

    // add finally fallthrough dispatch states
    this.addFinallyFallThroughDispatches(null, machine.exceptionBlocks, cases);

    cases.push(createDefaultClause(parseStatements `return $ctx.end()`));

    return cases;
  }
Transforms all the machine states into a list of case clauses. Adds a
rethrow clause if the machine has any try blocks. Also adds a 'default'
clause which indicates a compiler bug in the state machine generation.
@param {StateMachine} machine
@param {number} machineEndState
@param {number} rethrowState
@param {Object} enclosingFinallyState
@return {Array.<ParseTree>}