use of lucee.transformer.bytecode.visitor.ArrayVisitor 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;
}
Aggregations