Search in sources :

Example 6 with RefInteger

use of lucee.commons.lang.types.RefInteger in project Lucee by lucee.

the class VT method _writeOutCallerUtil.

private Type _writeOutCallerUtil(BytecodeContext bc, int mode) throws TransformerException {
    GeneratorAdapter adapter = bc.getAdapter();
    final int count = countFM + countDM;
    // count 0
    if (count == 0)
        return _writeOutEmpty(bc);
    // pc
    adapter.loadArg(0);
    // collection
    RefInteger startIndex = new RefIntegerImpl();
    _writeOutFirst(bc, (members.get(0)), mode, count == 1, true, defaultValue, startIndex);
    // keys
    Iterator<Member> it = members.iterator();
    ArrayVisitor av = new ArrayVisitor();
    av.visitBegin(adapter, Types.COLLECTION_KEY, countDM - startIndex.toInt());
    int index = 0, i = 0;
    while (it.hasNext()) {
        DataMember member = (DataMember) it.next();
        if (i++ < startIndex.toInt())
            continue;
        av.visitBeginItem(adapter, index++);
        getFactory().registerKey(bc, member.getName(), false);
        av.visitEndItem(bc.getAdapter());
    }
    av.visitEnd();
    // defaultValue
    defaultValue.writeOut(bc, MODE_REF);
    bc.getAdapter().invokeStatic(Types.CALLER_UTIL, CALLER_UTIL_GET);
    return Types.OBJECT;
}
Also used : RefInteger(lucee.commons.lang.types.RefInteger) DataMember(lucee.transformer.expression.var.DataMember) GeneratorAdapter(org.objectweb.asm.commons.GeneratorAdapter) ArrayVisitor(lucee.transformer.bytecode.visitor.ArrayVisitor) RefIntegerImpl(lucee.commons.lang.types.RefIntegerImpl) DataMember(lucee.transformer.expression.var.DataMember) Member(lucee.transformer.expression.var.Member)

Aggregations

RefInteger (lucee.commons.lang.types.RefInteger)6 RefIntegerImpl (lucee.commons.lang.types.RefIntegerImpl)4 PageException (lucee.runtime.exp.PageException)2 Constructor (java.lang.reflect.Constructor)1 Method (java.lang.reflect.Method)1 ConstructorInstance (lucee.runtime.reflection.pairs.ConstructorInstance)1 MethodInstance (lucee.runtime.reflection.pairs.MethodInstance)1 ArrayVisitor (lucee.transformer.bytecode.visitor.ArrayVisitor)1 DataMember (lucee.transformer.expression.var.DataMember)1 Member (lucee.transformer.expression.var.Member)1 GeneratorAdapter (org.objectweb.asm.commons.GeneratorAdapter)1