Search in sources :

Example 1 with IFunction

use of lucee.transformer.bytecode.statement.IFunction in project Lucee by lucee.

the class SourceLastModifiedClassAdapter method writeOutCallBody.

private void writeOutCallBody(BytecodeContext bc, Body body, int pageType) throws TransformerException {
    List<IFunction> funcs = new ArrayList<IFunction>();
    extractFunctions(bc, body, funcs, pageType);
    writeUDFProperties(bc, funcs, pageType);
    if (pageType == IFunction.PAGE_TYPE_COMPONENT) {
        GeneratorAdapter adapter = bc.getAdapter();
        adapter.loadArg(1);
        adapter.loadArg(0);
        adapter.visitVarInsn(Opcodes.ALOAD, 0);
        adapter.invokeVirtual(Types.COMPONENT_IMPL, CHECK_INTERFACE);
    }
    if (pageType != IFunction.PAGE_TYPE_INTERFACE) {
        int rtn = -1;
        if (bc.returnValue()) {
            rtn = bc.getAdapter().newLocal(Types.OBJECT);
            bc.setReturn(rtn);
            // make sure we have a value
            ASMConstants.NULL(bc.getAdapter());
            bc.getAdapter().storeLocal(rtn);
        }
        BodyBase.writeOut(bc, body);
        if (rtn != -1)
            bc.getAdapter().loadLocal(rtn);
        else
            ASMConstants.NULL(bc.getAdapter());
    }
}
Also used : ArrayList(java.util.ArrayList) GeneratorAdapter(org.objectweb.asm.commons.GeneratorAdapter) IFunction(lucee.transformer.bytecode.statement.IFunction)

Aggregations

ArrayList (java.util.ArrayList)1 IFunction (lucee.transformer.bytecode.statement.IFunction)1 GeneratorAdapter (org.objectweb.asm.commons.GeneratorAdapter)1