more constants
This commit is contained in:
parent
82aed08301
commit
87ab39613d
|
@ -47,28 +47,28 @@ public final class Definition {
|
||||||
public static final Definition INSTANCE = new Definition(new Definition());
|
public static final Definition INSTANCE = new Definition(new Definition());
|
||||||
|
|
||||||
/** Some native types as constants: */
|
/** Some native types as constants: */
|
||||||
|
public static final Type voidType = INSTANCE.getType("void");
|
||||||
public static final Type booleanType = INSTANCE.getType("boolean");
|
public static final Type booleanType = INSTANCE.getType("boolean");
|
||||||
public static final Type objectType = INSTANCE.getType("Object");
|
|
||||||
public static final Type defType = INSTANCE.getType("def");
|
|
||||||
public static final Type booleanobjType = INSTANCE.getType("Boolean");
|
public static final Type booleanobjType = INSTANCE.getType("Boolean");
|
||||||
public static final Type byteType = INSTANCE.getType("byte");
|
public static final Type byteType = INSTANCE.getType("byte");
|
||||||
public static final Type shortType = INSTANCE.getType("short");
|
|
||||||
public static final Type intType = INSTANCE.getType("int");
|
|
||||||
public static final Type charType = INSTANCE.getType("char");
|
|
||||||
public static final Type longType = INSTANCE.getType("long");
|
|
||||||
public static final Type floatType = INSTANCE.getType("float");
|
|
||||||
public static final Type doubleType = INSTANCE.getType("double");
|
|
||||||
public static final Type numberType = INSTANCE.getType("Number");
|
|
||||||
public static final Type byteobjType = INSTANCE.getType("Byte");
|
public static final Type byteobjType = INSTANCE.getType("Byte");
|
||||||
|
public static final Type shortType = INSTANCE.getType("short");
|
||||||
public static final Type shortobjType = INSTANCE.getType("Short");
|
public static final Type shortobjType = INSTANCE.getType("Short");
|
||||||
public static final Type charobjType = INSTANCE.getType("Character");
|
public static final Type intType = INSTANCE.getType("int");
|
||||||
public static final Type intobjType = INSTANCE.getType("Integer");
|
public static final Type intobjType = INSTANCE.getType("Integer");
|
||||||
|
public static final Type longType = INSTANCE.getType("long");
|
||||||
public static final Type longobjType = INSTANCE.getType("Long");
|
public static final Type longobjType = INSTANCE.getType("Long");
|
||||||
|
public static final Type floatType = INSTANCE.getType("float");
|
||||||
public static final Type floatobjType = INSTANCE.getType("Float");
|
public static final Type floatobjType = INSTANCE.getType("Float");
|
||||||
|
public static final Type doubleType = INSTANCE.getType("double");
|
||||||
public static final Type doubleobjType = INSTANCE.getType("Double");
|
public static final Type doubleobjType = INSTANCE.getType("Double");
|
||||||
|
public static final Type charType = INSTANCE.getType("char");
|
||||||
|
public static final Type charobjType = INSTANCE.getType("Character");
|
||||||
|
public static final Type objectType = INSTANCE.getType("Object");
|
||||||
|
public static final Type defType = INSTANCE.getType("def");
|
||||||
|
public static final Type defobjType = INSTANCE.getType("Def");
|
||||||
public static final Type stringType = INSTANCE.getType("String");
|
public static final Type stringType = INSTANCE.getType("String");
|
||||||
public static final Type exceptionType = INSTANCE.getType("Exception");
|
public static final Type exceptionType = INSTANCE.getType("Exception");
|
||||||
public static final Type voidType = INSTANCE.getType("void");
|
|
||||||
|
|
||||||
public enum Sort {
|
public enum Sort {
|
||||||
VOID( void.class , 0 , true , false , false , false ),
|
VOID( void.class , 0 , true , false , false , false ),
|
||||||
|
|
|
@ -214,17 +214,17 @@ public final class MethodWriter extends GeneratorAdapter {
|
||||||
|
|
||||||
if (sort == Sort.DEF) {
|
if (sort == Sort.DEF) {
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case MUL: invokeStatic(definition.getType("Def").type, DEF_MUL_CALL); break;
|
case MUL: invokeStatic(Definition.defobjType.type, DEF_MUL_CALL); break;
|
||||||
case DIV: invokeStatic(definition.getType("Def").type, DEF_DIV_CALL); break;
|
case DIV: invokeStatic(Definition.defobjType.type, DEF_DIV_CALL); break;
|
||||||
case REM: invokeStatic(definition.getType("Def").type, DEF_REM_CALL); break;
|
case REM: invokeStatic(Definition.defobjType.type, DEF_REM_CALL); break;
|
||||||
case ADD: invokeStatic(definition.getType("Def").type, DEF_ADD_CALL); break;
|
case ADD: invokeStatic(Definition.defobjType.type, DEF_ADD_CALL); break;
|
||||||
case SUB: invokeStatic(definition.getType("Def").type, DEF_SUB_CALL); break;
|
case SUB: invokeStatic(Definition.defobjType.type, DEF_SUB_CALL); break;
|
||||||
case LSH: invokeStatic(definition.getType("Def").type, DEF_LSH_CALL); break;
|
case LSH: invokeStatic(Definition.defobjType.type, DEF_LSH_CALL); break;
|
||||||
case USH: invokeStatic(definition.getType("Def").type, DEF_RSH_CALL); break;
|
case USH: invokeStatic(Definition.defobjType.type, DEF_RSH_CALL); break;
|
||||||
case RSH: invokeStatic(definition.getType("Def").type, DEF_USH_CALL); break;
|
case RSH: invokeStatic(Definition.defobjType.type, DEF_USH_CALL); break;
|
||||||
case BWAND: invokeStatic(definition.getType("Def").type, DEF_AND_CALL); break;
|
case BWAND: invokeStatic(Definition.defobjType.type, DEF_AND_CALL); break;
|
||||||
case XOR: invokeStatic(definition.getType("Def").type, DEF_XOR_CALL); break;
|
case XOR: invokeStatic(Definition.defobjType.type, DEF_XOR_CALL); break;
|
||||||
case BWOR: invokeStatic(definition.getType("Def").type, DEF_OR_CALL); break;
|
case BWOR: invokeStatic(Definition.defobjType.type, DEF_OR_CALL); break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Error " + location + ": Illegal tree structure.");
|
throw new IllegalStateException("Error " + location + ": Illegal tree structure.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,7 +456,7 @@ public final class EComp extends AExpression {
|
||||||
if (right.isNull) {
|
if (right.isNull) {
|
||||||
adapter.ifNull(jump);
|
adapter.ifNull(jump);
|
||||||
} else if (!left.isNull && operation == Operation.EQ) {
|
} else if (!left.isNull && operation == Operation.EQ) {
|
||||||
adapter.invokeStatic(definition.getType("Def").type, DEF_EQ_CALL);
|
adapter.invokeStatic(Definition.defobjType.type, DEF_EQ_CALL);
|
||||||
} else {
|
} else {
|
||||||
adapter.ifCmp(rtype, MethodWriter.EQ, jump);
|
adapter.ifCmp(rtype, MethodWriter.EQ, jump);
|
||||||
}
|
}
|
||||||
|
@ -464,19 +464,19 @@ public final class EComp extends AExpression {
|
||||||
if (right.isNull) {
|
if (right.isNull) {
|
||||||
adapter.ifNonNull(jump);
|
adapter.ifNonNull(jump);
|
||||||
} else if (!left.isNull && operation == Operation.NE) {
|
} else if (!left.isNull && operation == Operation.NE) {
|
||||||
adapter.invokeStatic(definition.getType("Def").type, DEF_EQ_CALL);
|
adapter.invokeStatic(Definition.defobjType.type, DEF_EQ_CALL);
|
||||||
adapter.ifZCmp(MethodWriter.EQ, jump);
|
adapter.ifZCmp(MethodWriter.EQ, jump);
|
||||||
} else {
|
} else {
|
||||||
adapter.ifCmp(rtype, MethodWriter.NE, jump);
|
adapter.ifCmp(rtype, MethodWriter.NE, jump);
|
||||||
}
|
}
|
||||||
} else if (lt) {
|
} else if (lt) {
|
||||||
adapter.invokeStatic(definition.getType("Def").type, DEF_LT_CALL);
|
adapter.invokeStatic(Definition.defobjType.type, DEF_LT_CALL);
|
||||||
} else if (lte) {
|
} else if (lte) {
|
||||||
adapter.invokeStatic(definition.getType("Def").type, DEF_LTE_CALL);
|
adapter.invokeStatic(Definition.defobjType.type, DEF_LTE_CALL);
|
||||||
} else if (gt) {
|
} else if (gt) {
|
||||||
adapter.invokeStatic(definition.getType("Def").type, DEF_GT_CALL);
|
adapter.invokeStatic(Definition.defobjType.type, DEF_GT_CALL);
|
||||||
} else if (gte) {
|
} else if (gte) {
|
||||||
adapter.invokeStatic(definition.getType("Def").type, DEF_GTE_CALL);
|
adapter.invokeStatic(Definition.defobjType.type, DEF_GTE_CALL);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(error("Illegal tree structure."));
|
throw new IllegalStateException(error("Illegal tree structure."));
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ public final class EUnary extends AExpression {
|
||||||
|
|
||||||
if (operation == Operation.BWNOT) {
|
if (operation == Operation.BWNOT) {
|
||||||
if (sort == Sort.DEF) {
|
if (sort == Sort.DEF) {
|
||||||
adapter.invokeStatic(definition.getType("Def").type, DEF_NOT_CALL);
|
adapter.invokeStatic(Definition.defobjType.type, DEF_NOT_CALL);
|
||||||
} else {
|
} else {
|
||||||
if (sort == Sort.INT) {
|
if (sort == Sort.INT) {
|
||||||
adapter.push(-1);
|
adapter.push(-1);
|
||||||
|
@ -205,7 +205,7 @@ public final class EUnary extends AExpression {
|
||||||
}
|
}
|
||||||
} else if (operation == Operation.SUB) {
|
} else if (operation == Operation.SUB) {
|
||||||
if (sort == Sort.DEF) {
|
if (sort == Sort.DEF) {
|
||||||
adapter.invokeStatic(definition.getType("Def").type, DEF_NEG_CALL);
|
adapter.invokeStatic(Definition.defobjType.type, DEF_NEG_CALL);
|
||||||
} else {
|
} else {
|
||||||
adapter.math(MethodWriter.NEG, type);
|
adapter.math(MethodWriter.NEG, type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue