Commit cc318b13 authored by Skylot's avatar Skylot

ArgType refactoring, add generic parsing

parent d662b2c5
......@@ -94,10 +94,18 @@ public class InsnGen {
}
public String declareVar(RegisterArg arg) throws CodegenException {
String type = TypeGen.translate(mgen.getClassGen(), arg.getType());
String generic = arg.getType().getGeneric();
if (generic != null)
type += " /* " + generic + " */";
String type = useType(arg.getType());
ArgType[] generics = arg.getType().getGenericTypes();
if (generics != null) {
StringBuilder sb = new StringBuilder();
sb.append(type);
sb.append("/*<");
for (ArgType gt : generics) {
sb.append(useType(gt));
}
sb.append(">*/");
type = sb.toString();
}
return type + " " + arg(arg);
}
......
......@@ -28,7 +28,7 @@ public class LocalVarInfo extends RegisterArg {
private void init(String name, ArgType type, String sign) {
if (sign != null) {
type.setGeneric(sign);
type = ArgType.generic(type.getObject(), sign);
}
TypedVar tv = new TypedVar(type);
tv.setName(name);
......
......@@ -45,6 +45,6 @@ public enum PrimitiveType {
@Override
public String toString() {
return this.name().toLowerCase();
return longName;
}
}
......@@ -109,8 +109,6 @@ public class MethodNode extends AttrNode implements ILoadable {
return;
if (instructions != null) instructions.clear();
// if (blocks != null) blocks.clear();
// if (exitBlocks != null) exitBlocks.clear();
blocks = null;
exitBlocks = null;
if (exceptionHandlers != null) exceptionHandlers.clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment