/**
   * @see
   *     railo.transformer.bytecode.statement.StatementBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter)
   */
  public void _writeOut(BytecodeContext bc) throws BytecodeException {
    GeneratorAdapter adapter = bc.getAdapter();

    adapter.visitLabel(begin);

    // Reference ref=null;
    final int lRef = adapter.newLocal(Types.REFERENCE);
    adapter.visitInsn(Opcodes.ACONST_NULL);
    adapter.storeLocal(lRef);

    // has no try body, if there is no try body, no catches are executed, only finally
    if (!tryBody.hasStatements()) {
      if (finallyBody != null) finallyBody.writeOut(bc);
      return;
    }

    TryCatchFinallyVisitor tcfv =
        new TryCatchFinallyVisitor(
            new OnFinally() {

              public void writeOut(BytecodeContext bc) throws BytecodeException {
                _writeOutFinally(bc, lRef);
              }
            },
            getFlowControlFinal());

    // try
    tcfv.visitTryBegin(bc);
    tryBody.writeOut(bc);
    int lThrow = tcfv.visitTryEndCatchBeging(bc);
    _writeOutCatch(bc, lRef, lThrow);
    tcfv.visitCatchEnd(bc);
  }
  private void _writeOutFinally(BytecodeContext bc, int lRef) throws BytecodeException {
    // ref.remove(pc);
    // Reference r=null;
    GeneratorAdapter adapter = bc.getAdapter();

    // if(fcf!=null &&
    // fcf.getAfterFinalGOTOLabel()!=null)ASMUtil.visitLabel(adapter,fcf.getFinalEntryLabel());
    ExpressionUtil.visitLine(bc, finallyLine);

    // if (reference != null)
    //    reference.removeEL(pagecontext);
    Label removeEnd = new Label();
    adapter.loadLocal(lRef);
    adapter.ifNull(removeEnd);
    adapter.loadLocal(lRef);
    adapter.loadArg(0);
    adapter.invokeInterface(Types.REFERENCE, REMOVE_EL);
    adapter.pop();
    adapter.visitLabel(removeEnd);

    if (finallyBody != null) finallyBody.writeOut(bc); // finally
    /*if(fcf!=null){
    	Label l = fcf.getAfterFinalGOTOLabel();
    	if(l!=null)adapter.visitJumpInsn(Opcodes.GOTO, l);
    }*/
  }