}
public WeaselInstructionList compile(WeaselCompiler compiler, WeaselKeyWordCompilerHelper compilerHelper, WeaselGenericClass arrayClass) throws WeaselCompilerException {
arrayClass = new WeaselGenericClass(arrayClass.getBaseClass().getArrayClass(), arrayClass.getGenerics());
WeaselInstructionList instructions = new WeaselInstructionList();
instructions.add(token.line, new WeaselInstructionLoadConstInteger(indexes.size()));
instructions.add(token.line, new WeaselInstructionNewArray(arrayClass.getBaseClass().getByteName(), 1));
for(int i=0; i<indexes.size(); i++){
Object o = indexes.get(i);
if(o instanceof WeaselArrayInit){
instructions.addAll(((WeaselArrayInit)o).compile(compiler, compilerHelper, arrayClass));
}else{
WeaselCompilerReturn wcr = ((WeaselTree)o).compile(compiler, compilerHelper, null, arrayClass, null, false);
if(!wcr.getReturnType().canCastTo(arrayClass))
throw new WeaselCompilerException(token.line, "Can't cast %s to %s", wcr.getReturnType(), arrayClass);
instructions.addAll(wcr.getInstructions());
}
instructions.add(token.line, new WeaselInstructionPush(2));
instructions.add(token.line, new WeaselInstructionLoadConstInteger(i));
instructions.add(token.line, new WeaselInstructionWriteIndex(WeaselPrimitive.getPrimitiveID(arrayClass.getBaseClass())));
}
return instructions;
}