return level.get(operators.size()).compile(compiler, compilerHelper, write, expect, elementParent, isVariable);
WeaselToken operator = operators.get(i);
Properties oper = (Properties)operator.param;
WeaselInstructionList instructions = new WeaselInstructionList();
WeaselCompilerReturn wcr;
WeaselGenericClass ret;
WeaselGenericClass wgc;
if(oper==WeaselOperator.COMMA){
wcr = level.get(i).compile(compiler, compilerHelper, null, expect, null, false);
instructions.addAll(wcr.getInstructions());
ret = wcr.getReturnType();
wcr = compileInfixOperator(compiler, compilerHelper, null, new WeaselGenericClass(compiler.baseTypes.voidClass), null, false, i+1);
instructions.addAll(wcr.getInstructions());
if(wcr.getReturnType().getBaseClass()!=compiler.baseTypes.voidClass){
instructions.add(operator.line, new WeaselInstructionPop());
}
}else if(oper==WeaselOperator.ASSIGN){
WeaselCompilerReturn wcr2 = compileInfixOperator(compiler, compilerHelper, null, expect, null, false, i+1);
wcr = level.get(i).compile(compiler, compilerHelper, wcr2.getReturnType(), expect, null, false);
instructions.addAll(wcr.getInstructions());
instructions.replacePlaceHolderWith(wcr2.getInstructions());
ret = wcr.getReturnType();
}else if(oper==WeaselOperator.LOGICAL_OR || oper==WeaselOperator.LOGICAL_AND || oper==WeaselOperator.BITWISE_OR || oper==WeaselOperator.BITWISE_AND
|| oper==WeaselOperator.BITWISE_XOR || oper==WeaselOperator.LESS || oper==WeaselOperator.GREATER
|| oper==WeaselOperator.LESS_EQUAL || oper==WeaselOperator.GREATER_EQUAL
|| oper==WeaselOperator.PLUS || oper==WeaselOperator.MINUS || oper==WeaselOperator.TIMES || oper==WeaselOperator.DIVIDE
|| oper==WeaselOperator.REMAINDER){
wcr = compileInfixOperator(compiler, compilerHelper, null, expect, null, false, i-1);
instructions.addAll(wcr.getInstructions());
wgc = wcr.getReturnType();
wcr = level.get(i+1).compile(compiler, compilerHelper, null, expect, null, false);
ret = wcr.getReturnType();
wgc = WeaselTree.autoCast(compiler, wgc, ret, operator.line, instructions, false);
instructions.addAll(wcr.getInstructions());
ret = WeaselTree.autoCast(compiler, ret, wgc, operator.line, instructions, true);
ret = WeaselGenericClass.getSmallestSame(wgc, ret);
int primitiveID = WeaselPrimitive.getPrimitiveID(ret.getBaseClass());
if(oper==WeaselOperator.LOGICAL_OR||oper==WeaselOperator.LOGICAL_AND){
if(primitiveID!=WeaselPrimitive.BOOLEAN){
throw new WeaselCompilerException(operator.line, "Operator %s is only usable with boolean, not with %s %s", oper, wgc, ret);
}
}else if(oper==WeaselOperator.BITWISE_OR || oper==WeaselOperator.BITWISE_AND || oper==WeaselOperator.BITWISE_XOR){
if(primitiveID!=WeaselPrimitive.BOOLEAN && primitiveID!=WeaselPrimitive.CHAR && primitiveID!=WeaselPrimitive.BYTE &&
primitiveID!=WeaselPrimitive.SHORT && primitiveID!=WeaselPrimitive.INT && primitiveID!=WeaselPrimitive.LONG){
throw new WeaselCompilerException(operator.line, "Operator %s is only usable with boolean, char, byte, short, int, long, not with %s %s", oper, wgc, ret);
}
}else if(oper==WeaselOperator.LESS || oper==WeaselOperator.GREATER || oper==WeaselOperator.LESS_EQUAL
|| oper==WeaselOperator.GREATER_EQUAL){
if(primitiveID!=WeaselPrimitive.CHAR && primitiveID!=WeaselPrimitive.BYTE && primitiveID!=WeaselPrimitive.SHORT
&& primitiveID!=WeaselPrimitive.INT && primitiveID!=WeaselPrimitive.LONG
&& primitiveID!=WeaselPrimitive.FLOAT && primitiveID!=WeaselPrimitive.DOUBLE){
throw new WeaselCompilerException(operator.line, "Operator %s is only usable with char, byte, short, int, long, float, double, not with %s %s", oper, wgc, ret);
}
ret = new WeaselGenericClass(compiler.baseTypes.booleanClass);
}else if(oper==WeaselOperator.PLUS || oper==WeaselOperator.MINUS || oper==WeaselOperator.TIMES || oper==WeaselOperator.DIVIDE
|| oper==WeaselOperator.REMAINDER){
if(primitiveID!=WeaselPrimitive.CHAR && primitiveID!=WeaselPrimitive.BYTE && primitiveID!=WeaselPrimitive.SHORT
&& primitiveID!=WeaselPrimitive.INT && primitiveID!=WeaselPrimitive.LONG
&& primitiveID!=WeaselPrimitive.FLOAT && primitiveID!=WeaselPrimitive.DOUBLE){
throw new WeaselCompilerException(operator.line, "Operator %s is only usable with char, byte, short, int, long, float, double, not with %s %s", oper, wgc, ret);
}
}
if(oper==WeaselOperator.LOGICAL_OR){
instructions.add(operator.line, new WeaselInstructionLogicalOr(primitiveID));
}else if(oper==WeaselOperator.LOGICAL_AND){
instructions.add(operator.line, new WeaselInstructionLogicalAnd(primitiveID));
}else if(oper==WeaselOperator.BITWISE_OR){
instructions.add(operator.line, new WeaselInstructionBitwiseOr(primitiveID));
}else if(oper==WeaselOperator.BITWISE_AND){
instructions.add(operator.line, new WeaselInstructionBitwiseAnd(primitiveID));
}else if(oper==WeaselOperator.BITWISE_XOR){
instructions.add(operator.line, new WeaselInstructionBitwiseXor(primitiveID));
}else if(oper==WeaselOperator.LESS){
instructions.add(operator.line, new WeaselInstructionLess(primitiveID));
}else if(oper==WeaselOperator.GREATER){
instructions.add(operator.line, new WeaselInstructionGreater(primitiveID));
}else if(oper==WeaselOperator.LESS_EQUAL){
instructions.add(operator.line, new WeaselInstructionLessEqual(primitiveID));
}else if(oper==WeaselOperator.GREATER_EQUAL){
instructions.add(operator.line, new WeaselInstructionGreaterEqual(primitiveID));
}else if(oper==WeaselOperator.PLUS){
instructions.add(operator.line, new WeaselInstructionAdd(primitiveID));
}else if(oper==WeaselOperator.MINUS){
instructions.add(operator.line, new WeaselInstructionSub(primitiveID));
}else if(oper==WeaselOperator.TIMES){
instructions.add(operator.line, new WeaselInstructionMul(primitiveID));
}else if(oper==WeaselOperator.DIVIDE){
instructions.add(operator.line, new WeaselInstructionDiv(primitiveID));
}else if(oper==WeaselOperator.REMAINDER){
instructions.add(operator.line, new WeaselInstructionMod(primitiveID));
}
}else if(oper==WeaselOperator.RSHIFT || oper==WeaselOperator.LSHIFT){
wcr = compileInfixOperator(compiler, compilerHelper, null, expect, null, false, i-1);
instructions.addAll(wcr.getInstructions());
ret = wcr.getReturnType();
wcr = level.get(i+1).compile(compiler, compilerHelper, null, expect, null, false);
wgc = wcr.getReturnType();
instructions.addAll(wcr.getInstructions());
WeaselTree.autoCast(compiler, wgc, new WeaselGenericClass(compiler.baseTypes.intClass), operator.line, instructions, true);
int primitiveID = WeaselPrimitive.getPrimitiveID(ret.getBaseClass());
if(oper==WeaselOperator.RSHIFT||oper==WeaselOperator.LSHIFT){
if(primitiveID!=WeaselPrimitive.CHAR && primitiveID!=WeaselPrimitive.BYTE && primitiveID!=WeaselPrimitive.SHORT
&& primitiveID!=WeaselPrimitive.INT && primitiveID!=WeaselPrimitive.LONG){
throw new WeaselCompilerException(operator.line, "Operator %s is only usable with char, byte, short, int, long, not with %s", oper, ret);
}
}
if(oper==WeaselOperator.RSHIFT){
instructions.add(operator.line, new WeaselInstructionRShift(primitiveID));
}else if(oper==WeaselOperator.LSHIFT){
instructions.add(operator.line, new WeaselInstructionLShift(primitiveID));
}
}else if(oper==WeaselOperator.VERY_SAME || oper==WeaselOperator.NOT_VERY_SAME
|| oper==WeaselOperator.EQUAL || oper==WeaselOperator.NOT_EQUAL){
wcr = compileInfixOperator(compiler, compilerHelper, null, expect, null, false, i-1);
instructions.addAll(wcr.getInstructions());
wgc = wcr.getReturnType();
wcr = level.get(i+1).compile(compiler, compilerHelper, null, expect, null, false);
ret = wcr.getReturnType();
if(wgc.getBaseClass().isPrimitive()||ret.getBaseClass().isPrimitive())
wgc = WeaselTree.autoCast(compiler, wgc, ret, operator.line, instructions, false);
instructions.addAll(wcr.getInstructions());
if(wgc.getBaseClass().isPrimitive()||ret.getBaseClass().isPrimitive())
ret = WeaselTree.autoCast(compiler, ret, wgc, operator.line, instructions, true);
int primitiveID = WeaselPrimitive.getPrimitiveID(ret.getBaseClass());
if(oper==WeaselOperator.VERY_SAME){
instructions.add(operator.line, new WeaselInstructionVerySame(primitiveID));
}else if(oper==WeaselOperator.NOT_VERY_SAME){
instructions.add(operator.line, new WeaselInstructionNotVerySame(primitiveID));
}else if(oper==WeaselOperator.EQUAL){
instructions.add(operator.line, new WeaselInstructionEqual(primitiveID));
}else if(oper==WeaselOperator.NOT_EQUAL){
instructions.add(operator.line, new WeaselInstructionNotEqual(primitiveID));
}
ret = new WeaselGenericClass(compiler.baseTypes.booleanClass);
}else if(oper==WeaselOperator.ELEMENT){
wcr = compileInfixOperator(compiler, compilerHelper, null, null, null, false, i-1);
instructions.addAll(wcr.getInstructions());
wgc = wcr.getReturnType();
wcr = level.get(i+1).compile(compiler, compilerHelper, write, expect, wgc, !wcr.isClassAccess());