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.
36 lines
707 B
36 lines
707 B
package jode;
|
|
import sun.tools.java.*;
|
|
|
|
public class ArrayLengthOperator extends Operator {
|
|
|
|
Type arrayType;
|
|
|
|
public ArrayLengthOperator() {
|
|
super(Type.tInt, 0);
|
|
arrayType = Type.tArray(MyType.tUnknown);
|
|
}
|
|
|
|
public int getPriority() {
|
|
return 950;
|
|
}
|
|
|
|
public int getOperandCount() {
|
|
return 1;
|
|
}
|
|
|
|
public int getOperandPriority(int i) {
|
|
return 900;
|
|
}
|
|
|
|
public Type getOperandType(int i) {
|
|
return arrayType;
|
|
}
|
|
|
|
public void setOperandType(Type[] types) {
|
|
arrayType = MyType.intersection(arrayType,types[0]);
|
|
}
|
|
|
|
public String toString(String[] operands) {
|
|
return operands[0] + ".length";
|
|
}
|
|
}
|
|
|