use of com.taobao.android.dx.rop.type.Type in project atlas by alibaba.
the class Rops method opNewArray.
/**
* Returns the appropriate {@code new-array} rop for the given
* type. The result is a shared instance.
*
* @param arrayType {@code non-null;} array type of array being created
* @return {@code non-null;} an appropriate instance
*/
public static Rop opNewArray(TypeBearer arrayType) {
Type type = arrayType.getType();
Type elementType = type.getComponentType();
switch(elementType.getBasicType()) {
case Type.BT_INT:
return NEW_ARRAY_INT;
case Type.BT_LONG:
return NEW_ARRAY_LONG;
case Type.BT_FLOAT:
return NEW_ARRAY_FLOAT;
case Type.BT_DOUBLE:
return NEW_ARRAY_DOUBLE;
case Type.BT_BOOLEAN:
return NEW_ARRAY_BOOLEAN;
case Type.BT_BYTE:
return NEW_ARRAY_BYTE;
case Type.BT_CHAR:
return NEW_ARRAY_CHAR;
case Type.BT_SHORT:
return NEW_ARRAY_SHORT;
case Type.BT_OBJECT:
{
return new Rop(RegOps.NEW_ARRAY, type, StdTypeList.INT, Exceptions.LIST_Error_NegativeArraySizeException, "new-array-object");
}
}
return throwBadType(type);
}
use of com.taobao.android.dx.rop.type.Type in project atlas by alibaba.
the class CstBaseMethodRef method getPrototype.
/**
* Gets the prototype of this method as either a
* {@code static} or instance method. In the case of a
* {@code static} method, this is the same as the raw
* prototype. In the case of an instance method, this has an
* appropriately-typed {@code this} argument as the first
* one.
*
* @param isStatic whether the method should be considered static
* @return {@code non-null;} the method prototype
*/
public final Prototype getPrototype(boolean isStatic) {
if (isStatic) {
return prototype;
} else {
if (instancePrototype == null) {
Type thisType = getDefiningClass().getClassType();
instancePrototype = prototype.withFirstParameter(thisType);
}
return instancePrototype;
}
}
use of com.taobao.android.dx.rop.type.Type in project atlas by alibaba.
the class TypeIdsSection method intern.
/**
* Interns an element into this instance.
*
* @param type {@code non-null;} the type to intern
* @return {@code non-null;} the interned reference
*/
public synchronized TypeIdItem intern(CstType type) {
if (type == null) {
throw new NullPointerException("type == null");
}
throwIfPrepared();
Type typePerSe = type.getClassType();
if (typePerSe.getDescriptor().equals("L;")) {
System.out.println("xxxxxx");
}
TypeIdItem result = typeIds.get(typePerSe);
if (result == null) {
result = new TypeIdItem(type);
typeIds.put(typePerSe, result);
}
return result;
}
Aggregations