* @see railo.transformer.bytecode.statement.tag.TagBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter)
*/
public void _writeOut(BytecodeContext bc) throws BytecodeException {
GeneratorAdapter adapter = bc.getAdapter();
adapter.visitLabel(begin);
Body tryBody=new BodyBase();
List<Tag> catches=new ArrayList<Tag>();
Tag tmpFinal=null;
tryBody.setParent(getBody().getParent());
List<Statement> statements = getBody().getStatements();
Statement stat;
Tag tag;
{
Iterator<Statement> it = statements.iterator();
while(it.hasNext()) {
stat= it.next();
if(stat instanceof Tag) {
tag=(Tag) stat;
if(tag.getTagLibTag().getTagClassName().equals("railo.runtime.tag.Catch")) {
catches.add(tag);
continue;
}
else if(tag.getTagLibTag().getTagClassName().equals("railo.runtime.tag.Finally")) {
tmpFinal=tag;
continue;
}
}
tryBody.addStatement(stat);
};
}
final Tag _finally=tmpFinal;
// has no try body, if there is no try body, no catches are executed, only finally
if(!tryBody.hasStatements()) {
if(_finally!=null && _finally.getBody()!=null)_finally.getBody().writeOut(bc);
return;
}
TryCatchFinallyVisitor tcfv=new TryCatchFinallyVisitor(new OnFinally() {
public void writeOut(BytecodeContext bc) throws BytecodeException {
/*GeneratorAdapter ga = bc.getAdapter();
if(fcf!=null && fcf.getAfterFinalGOTOLabel()!=null)
ASMUtil.visitLabel(ga,fcf.getFinalEntryLabel());
*/
if(_finally!=null) {
ExpressionUtil.visitLine(bc, _finally.getStart());
_finally.getBody().writeOut(bc);
}
/*if(fcf!=null){
Label l=fcf.getAfterFinalGOTOLabel();
if(l!=null)ga.visitJumpInsn(Opcodes.GOTO, l);
}*/
}
},getFlowControlFinal());
// Try
tcfv.visitTryBegin(bc);
tryBody.writeOut(bc);
int e=tcfv.visitTryEndCatchBeging(bc);
// if(e instanceof railo.runtime.exp.Abort) throw e;
Label abortEnd=new Label();
adapter.loadLocal(e);
// Abort.isAbort(t);