ClassEnt(String s) { this(); this.utf8 = (Utf8Ent) addUtf8(s); }
void dump(DataOutput o) throws IOException { super.dump(o); o.writeShort(utf8.n); }
Type.Class getTypeClass() { return (Type.Class) key(); }
- Object _key() { return Type.Class.instance(utf8.s); }
+ Object _key() {
+ return Type.fromDescriptor(utf8.s.startsWith("[") ? utf8.s : "L" + utf8.s + ";");
+ }
void unref() { utf8.unref(); super.unref(); }
public String toString() { return "[Class: " + utf8.s + "]"; }
}
public NewArray(Type.Array t, Expr[] dims) { this.t = t; this.dims = dims; }
public NewArray(Type.Array t, Expr dim) { this(t,new Expr[]{dim}); }
public Type getType() { return t; }
+ public String _toString() {
+ Type base = t;
+ int totalDims = 0;
+ while(base.isArray()) {
+ totalDims++;
+ base = base.asArray().getElementType();
+ }
+ StringBuffer sb = new StringBuffer("new " + base);
+ for(int i=0;i<totalDims;i++)
+ sb.append("[" + (i < dims.length ? dims[i].toString() : "") + "]");
+ return sb.toString();
+ }
}
public class Return extends Op {
public class ArrayPut extends Op {
final Expr e, i, v;
- public ArrayPut(Expr e, Expr i, Expr v) { this.e = e; this.i = i; this.v = v; }
+ public ArrayPut(Expr v, Expr i, Expr e) { this.e = e; this.i = i; this.v = v; }
+ public String toString() { return e + "[" + i + "] := " + v; }
}
public class ArrayGet extends Expr {
final Expr e, i;
- public ArrayGet(Expr e, Expr i) { this.e = e; this.i = i; }
+ public ArrayGet(Expr i, Expr e) { this.e = e; this.i = i; }
public Type getType() { return e.getType().asArray().getElementType(); }
+ public String _toString() { return e + "[" + i + "]"; }
}
public class ArrayLength extends Expr {
public Type.Array asArray() { return this; }
public boolean isArray() { return true; }
public String toString() { return base.toString() + "[]"; }
- public Type getElementType() { return Type.fromDescriptor(getDescriptor().substring(0, getDescriptor().length()-1)); }
+ public Type getElementType() { return base; }
}
public static class Class extends Type.Ref {
return p == -1 ? descriptor.substring(1,descriptor.length()-1) : descriptor.substring(p+1,descriptor.length()-1);
}
private static String _initHelper(String s) {
- if (!s.startsWith("L") || !s.endsWith(";")) throw new Error("invalid");
+ if (!s.startsWith("L") || !s.endsWith(";")) throw new Error("invalid: " + s);
return s;
}
String[] components() {