Search in sources :

Example 1 with DoWhileVisitor

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

the class TagLoop method _writeOut.

/**
 * @see lucee.transformer.bytecode.statement.tag.TagBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter)
 */
@Override
public void _writeOut(BytecodeContext bc) throws TransformerException {
    boolean old;
    switch(type) {
        case TYPE_STRUCT:
        case TYPE_COLLECTION:
            writeOutTypeCollection(bc);
            break;
        case TYPE_CONDITION:
            writeOutTypeCondition(bc);
            break;
        case TYPE_FILE:
            writeOutTypeFile(bc);
            break;
        case TYPE_FROM_TO:
            writeOutTypeFromTo(bc);
            break;
        case TYPE_LIST:
            writeOutTypeListArray(bc, false);
            break;
        case TYPE_ARRAY:
            writeOutTypeListArray(bc, true);
            break;
        case TYPE_QUERY:
            old = bc.changeDoSubFunctions(false);
            TagGroupUtil.writeOutTypeQuery(this, bc);
            bc.changeDoSubFunctions(old);
            // writeOutTypeQuery(bc);
            break;
        case TYPE_GROUP:
            old = bc.changeDoSubFunctions(false);
            TagGroupUtil.writeOutTypeGroup(this, bc);
            bc.changeDoSubFunctions(old);
            // writeOutTypeQuery(bc);
            break;
        case TYPE_INNER_GROUP:
            old = bc.changeDoSubFunctions(false);
            TagGroupUtil.writeOutTypeInnerGroup(this, bc);
            bc.changeDoSubFunctions(old);
            break;
        case TYPE_INNER_QUERY:
            old = bc.changeDoSubFunctions(false);
            TagGroupUtil.writeOutTypeInnerQuery(this, bc);
            bc.changeDoSubFunctions(old);
            break;
        case TYPE_TIMES:
            writeOutTypeTimes(bc);
            break;
        case TYPE_NOTHING:
            GeneratorAdapter a = bc.getAdapter();
            DoWhileVisitor dwv = new DoWhileVisitor();
            setLoopVisitor(dwv);
            dwv.visitBeginBody(a);
            getBody().writeOut(bc);
            dwv.visitEndBodyBeginExpr(a);
            a.push(false);
            dwv.visitEndExpr(a);
            break;
        default:
            throw new TransformerException("invalid type", getStart());
    }
}
Also used : DoWhileVisitor(lucee.transformer.bytecode.visitor.DoWhileVisitor) GeneratorAdapter(org.objectweb.asm.commons.GeneratorAdapter) TransformerException(lucee.transformer.TransformerException)

Aggregations

TransformerException (lucee.transformer.TransformerException)1 DoWhileVisitor (lucee.transformer.bytecode.visitor.DoWhileVisitor)1 GeneratorAdapter (org.objectweb.asm.commons.GeneratorAdapter)1