Search in sources :

Example 6 with TryFinallyVisitor

use of lucee.transformer.bytecode.visitor.TryFinallyVisitor in project Lucee by lucee.

the class ExpressionUtil method writeOut.

public static void writeOut(final Statement s, BytecodeContext bc) throws TransformerException {
    if (ExpressionUtil.doLog(bc)) {
        final String id = CreateUniqueId.invoke();
        TryFinallyVisitor tfv = new TryFinallyVisitor(new OnFinally() {

            @Override
            public void _writeOut(BytecodeContext bc) {
                ExpressionUtil.callEndLog(bc, s, id);
            }
        }, null);
        tfv.visitTryBegin(bc);
        ExpressionUtil.callStartLog(bc, s, id);
        s.writeOut(bc);
        tfv.visitTryEnd(bc);
    } else
        s.writeOut(bc);
}
Also used : OnFinally(lucee.transformer.bytecode.visitor.OnFinally) LitString(lucee.transformer.expression.literal.LitString) ExprString(lucee.transformer.expression.ExprString) TryFinallyVisitor(lucee.transformer.bytecode.visitor.TryFinallyVisitor) BytecodeContext(lucee.transformer.bytecode.BytecodeContext)

Aggregations

BytecodeContext (lucee.transformer.bytecode.BytecodeContext)6 OnFinally (lucee.transformer.bytecode.visitor.OnFinally)6 TryFinallyVisitor (lucee.transformer.bytecode.visitor.TryFinallyVisitor)6 GeneratorAdapter (org.objectweb.asm.commons.GeneratorAdapter)5 Label (org.objectweb.asm.Label)4 TransformerException (lucee.transformer.TransformerException)2 DecisionIntVisitor (lucee.transformer.bytecode.visitor.DecisionIntVisitor)2 WhileVisitor (lucee.transformer.bytecode.visitor.WhileVisitor)2 LitString (lucee.transformer.expression.literal.LitString)2 ClassException (lucee.commons.lang.ClassException)1 ClassDefinition (lucee.runtime.db.ClassDefinition)1 MissingAttribute (lucee.runtime.tag.MissingAttribute)1 LiteralStringArray (lucee.transformer.bytecode.expression.type.LiteralStringArray)1 ArrayVisitor (lucee.transformer.bytecode.visitor.ArrayVisitor)1 DecisionObjectVisitor (lucee.transformer.bytecode.visitor.DecisionObjectVisitor)1 DoWhileVisitor (lucee.transformer.bytecode.visitor.DoWhileVisitor)1 ParseBodyVisitor (lucee.transformer.bytecode.visitor.ParseBodyVisitor)1 TryCatchFinallyVisitor (lucee.transformer.bytecode.visitor.TryCatchFinallyVisitor)1 ExprString (lucee.transformer.expression.ExprString)1 Expression (lucee.transformer.expression.Expression)1