mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-18 22:30:00 +00:00
Simplify some logic
This commit is contained in:
@@ -4,6 +4,7 @@ import java.util.Optional;
|
|||||||
|
|
||||||
|
|
||||||
// TODO - Make not enum
|
// TODO - Make not enum
|
||||||
|
// TODO - Add integer type
|
||||||
public enum Type {
|
public enum Type {
|
||||||
NUMBER,
|
NUMBER,
|
||||||
STRING,
|
STRING,
|
||||||
|
|||||||
@@ -504,8 +504,7 @@ public class TerraScriptClassGenerator {
|
|||||||
jumpIf(INTEGERS_NOT_EQUAL, exit);
|
jumpIf(INTEGERS_NOT_EQUAL, exit);
|
||||||
|
|
||||||
} else if (binaryOperandsSameType(Type.NUMBER, binaryCondition)) { // Operands assumed doubles
|
} else if (binaryOperandsSameType(Type.NUMBER, binaryCondition)) { // Operands assumed doubles
|
||||||
pushBinaryOperands(binaryCondition);
|
binaryInsn(binaryCondition, Opcodes.DCMPG);
|
||||||
method.visitInsn(Opcodes.DCMPG);
|
|
||||||
jumpIf(CMP_NOT_EQUALS, exit);
|
jumpIf(CMP_NOT_EQUALS, exit);
|
||||||
|
|
||||||
} else if (binaryOperandsSameType(Type.STRING, binaryCondition)) {
|
} else if (binaryOperandsSameType(Type.STRING, binaryCondition)) {
|
||||||
@@ -520,8 +519,7 @@ public class TerraScriptClassGenerator {
|
|||||||
jumpIf(INTEGERS_EQUAL, exit);
|
jumpIf(INTEGERS_EQUAL, exit);
|
||||||
|
|
||||||
} else if (binaryOperandsSameType(Type.NUMBER, binaryCondition)) { // Operands assumed doubles
|
} else if (binaryOperandsSameType(Type.NUMBER, binaryCondition)) { // Operands assumed doubles
|
||||||
pushBinaryOperands(binaryCondition);
|
binaryInsn(binaryCondition, Opcodes.DCMPG);
|
||||||
method.visitInsn(Opcodes.DCMPG);
|
|
||||||
jumpIf(CMP_EQUALS, exit);
|
jumpIf(CMP_EQUALS, exit);
|
||||||
|
|
||||||
} else if (binaryOperandsSameType(Type.STRING, binaryCondition)) { // Operands assumed references
|
} else if (binaryOperandsSameType(Type.STRING, binaryCondition)) { // Operands assumed references
|
||||||
@@ -533,9 +531,7 @@ public class TerraScriptClassGenerator {
|
|||||||
}
|
}
|
||||||
case GREATER, GREATER_EQUALS, LESS, LESS_EQUALS -> {
|
case GREATER, GREATER_EQUALS, LESS, LESS_EQUALS -> {
|
||||||
// Left and right assumed double
|
// Left and right assumed double
|
||||||
pushBinaryOperands(binaryCondition);
|
binaryInsn(binaryCondition, switch(binaryCondition.operator) {
|
||||||
|
|
||||||
method.visitInsn(switch(binaryCondition.operator) {
|
|
||||||
case GREATER, GREATER_EQUALS -> Opcodes.DCMPL;
|
case GREATER, GREATER_EQUALS -> Opcodes.DCMPL;
|
||||||
case LESS, LESS_EQUALS -> Opcodes.DCMPG;
|
case LESS, LESS_EQUALS -> Opcodes.DCMPG;
|
||||||
default -> throw new IllegalStateException();
|
default -> throw new IllegalStateException();
|
||||||
|
|||||||
Reference in New Issue
Block a user