return new WeaselInstructionList();
}
int primitiveID = WeaselPrimitive.getUnwrapped(weaselGenericClass.getBaseClass());
if(primitiveID==WeaselPrimitive.getPrimitiveID(returnType.getBaseClass())){
if(WeaselPrimitive.getPrimitiveID(weaselGenericClass.getBaseClass())==0){
instructionList.addWithoutLine(new WeaselInstructionCast(weaselGenericClass.getBaseClass().getByteName()));
}
returnType = weaselGenericClass;
return instructionList;
}
WeaselInstructionList instructionList = new WeaselInstructionList();
int line = this.instructionList.getLine();
try{
switch(primitiveID){
case WeaselPrimitive.BOOLEAN:
instructionList.add(line, new WeaselInstructionLoadConstBoolean(WeaselPrimitive.getBoolean(constant)));
break;
case WeaselPrimitive.CHAR:
instructionList.add(line, new WeaselInstructionLoadConstChar(WeaselPrimitive.getChar(constant)));
break;
case WeaselPrimitive.BYTE:
instructionList.add(line, new WeaselInstructionLoadConstByte(WeaselPrimitive.getByte(constant)));
break;
case WeaselPrimitive.SHORT:
instructionList.add(line, new WeaselInstructionLoadConstShort(WeaselPrimitive.getShort(constant)));
break;
case WeaselPrimitive.INT:
instructionList.add(line, new WeaselInstructionLoadConstInteger(WeaselPrimitive.getInteger(constant)));
break;
case WeaselPrimitive.LONG:
instructionList.add(line, new WeaselInstructionLoadConstLong(WeaselPrimitive.getLong(constant)));
break;
case WeaselPrimitive.FLOAT:
instructionList.add(line, new WeaselInstructionLoadConstFloat(WeaselPrimitive.getFloat(constant)));
break;
case WeaselPrimitive.DOUBLE:
instructionList.add(line, new WeaselInstructionLoadConstDouble(WeaselPrimitive.getDouble(constant)));
break;
}
}catch(WeaselNativeException e){
throw new WeaselCompilerException(this.instructionList.getLine(), e.getMessage());
}
if(WeaselPrimitive.getPrimitiveID(weaselGenericClass.getBaseClass())==0){
instructionList.addWithoutLine(new WeaselInstructionCast(weaselGenericClass.getBaseClass().getByteName()));
}
returnType = weaselGenericClass;
this.instructionList = instructionList;
return instructionList;
}