|
@@ -1,8 +1,10 @@
|
1
|
1
|
package org.openzen.zenscript.javabytecode.compiler;
|
2
|
2
|
|
3
|
3
|
import org.openzen.zenscript.codemodel.type.*;
|
|
4
|
+import org.openzen.zenscript.javabytecode.JavaClassInfo;
|
|
5
|
+import org.openzen.zenscript.shared.CompileException;
|
4
|
6
|
|
5
|
|
-public class JavaTypeVisitor implements ITypeVisitor<String> {
|
|
7
|
+public class JavaTypeSignatureVisitor implements ITypeVisitor<String> {
|
6
|
8
|
@Override
|
7
|
9
|
public String visitBasic(BasicTypeID basic) {
|
8
|
10
|
switch (basic) {
|
|
@@ -60,12 +62,16 @@ public class JavaTypeVisitor implements ITypeVisitor<String> {
|
60
|
62
|
|
61
|
63
|
@Override
|
62
|
64
|
public String visitDefinition(DefinitionTypeID definition) {
|
63
|
|
-
|
64
|
|
- return definition.definition.name.replaceAll("\"", "");
|
|
65
|
+ JavaClassInfo classInfo = definition.definition.getTag(JavaClassInfo.class);
|
|
66
|
+ if (classInfo == null)
|
|
67
|
+ throw CompileException.internalError("Definition is missing java class tag!");
|
|
68
|
+
|
|
69
|
+ return "L" + classInfo.internalClassName + ";";
|
65
|
70
|
}
|
66
|
71
|
|
67
|
72
|
@Override
|
68
|
73
|
public String visitGeneric(GenericTypeID generic) {
|
|
74
|
+ // TODO: type erasure
|
69
|
75
|
return null;
|
70
|
76
|
}
|
71
|
77
|
|
|
@@ -76,7 +82,7 @@ public class JavaTypeVisitor implements ITypeVisitor<String> {
|
76
|
82
|
|
77
|
83
|
@Override
|
78
|
84
|
public String visitConst(ConstTypeID type) {
|
79
|
|
- return null;
|
|
85
|
+ return type.baseType.accept(this);
|
80
|
86
|
}
|
81
|
87
|
|
82
|
88
|
@Override
|