Mirror of the JODE repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
jode/jode/jode/expr/ArrayStoreOperator.java

57 lines
1.6 KiB

package jode;
import sun.tools.java.Type;
import sun.tools.java.ArrayType;
public class ArrayStoreOperator extends StoreInstruction {
Type indexType;
public ArrayStoreOperator(int addr, int length, Type type) {
super(addr,length, type);
indexType = UnknownType.tUIndex;
}
public ArrayStoreOperator(int addr, int length, Type type, int operator) {
super(addr,length, type, operator);
indexType = UnknownType.tUIndex;
}
public boolean matches(Operator loadop) {
return loadop instanceof ArrayLoadOperator;
}
public int getLValueOperandCount() {
return 2;
}
public int getLValueOperandPriority(int i) {
if (i == 0)
return 950;
else
return 0;
}
public Type getLValueOperandType(int i) {
if (i == 0)
return Type.tArray(lvalueType);
else
return indexType;
}
public void setLValueOperandType(Type[] t) {
indexType = UnknownType.commonType(indexType, t[1]);
Type arraytype =
UnknownType.commonType(t[0], Type.tArray(lvalueType));
System.err.println("lvot: "+t[0]+","+Type.tArray(lvalueType)+
" -> "+arraytype);
if (arraytype instanceof ArrayType)
lvalueType = arraytype.getElementType();
else {
System.err.println("no array: "+arraytype);
lvalueType = Type.tError;
}
}
public String getLValueString(CodeAnalyzer ca, String[] operands) {
return operands[0]+"["+operands[1]+"]";
}
}