Browse Source

Added Signature to JavaField constructor

Was an instance field all along, but always set to null
kindlich 4 years ago
parent
commit
4ad3331928
No known key found for this signature in database

+ 6
- 1
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaField.java View File

@@ -13,12 +13,17 @@ public class JavaField {
13 13
 	public final JavaClass cls;
14 14
 	public final String name;
15 15
 	public final String descriptor;
16
-	public final String signature = null; // TODO: calculate signature too
16
+	public final String signature; // TODO: calculate signature too
17 17
 	
18 18
 	public JavaField(JavaClass cls, String name, String descriptor) {
19
+		this(cls, name, descriptor, null);
20
+	}
21
+
22
+	public JavaField(JavaClass cls, String name, String descriptor, String signature) {
19 23
 		this.cls = cls;
20 24
 		this.name = name;
21 25
 		this.descriptor = descriptor;
26
+		this.signature = signature;
22 27
 	}
23 28
 	
24 29
 	public String getMapping(JavaClass definition) {

+ 2
- 2
JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareClassMethodVisitor.java View File

@@ -76,13 +76,13 @@ public class JavaPrepareClassMethodVisitor implements MemberVisitor<Void> {
76 76
 			System.out.println("Class " + cls.fullName + " not empty because of const " + member.name);
77 77
 		
78 78
 		cls.empty = false;
79
-		module.setFieldInfo(member, new JavaField(cls, member.name, context.getDescriptor(member.getType())));
79
+		module.setFieldInfo(member, new JavaField(cls, member.name, context.getDescriptor(member.getType()), context.getSignature(member.getType())));
80 80
 		return null;
81 81
 	}
82 82
 	
83 83
 	@Override
84 84
 	public Void visitField(FieldMember member) {
85
-		JavaField field = new JavaField(cls, member.name, context.getDescriptor(member.getType()));
85
+		JavaField field = new JavaField(cls, member.name, context.getDescriptor(member.getType()), context.getSignature(member.getType()));
86 86
 		module.setFieldInfo(member, field);
87 87
 		if (member.hasAutoGetter()) {
88 88
 			visitGetter(member.autoGetter);

+ 2
- 2
JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareExpansionMethodVisitor.java View File

@@ -61,7 +61,7 @@ public class JavaPrepareExpansionMethodVisitor implements MemberVisitor<Void> {
61 61
 	
62 62
 	@Override
63 63
 	public Void visitConst(ConstMember member) {
64
-		JavaField field = new JavaField(cls, member.name, context.getDescriptor(member.getType()));
64
+		JavaField field = new JavaField(cls, member.name, context.getDescriptor(member.getType()), context.getSignature(member.getType()));
65 65
 		module.setFieldInfo(member, field);
66 66
 		
67 67
 		if (DEBUG_EMPTY && cls.empty)
@@ -74,7 +74,7 @@ public class JavaPrepareExpansionMethodVisitor implements MemberVisitor<Void> {
74 74
 	@Override
75 75
 	public Void visitField(FieldMember member) {
76 76
 		// TODO: expansion fields
77
-		JavaField field = new JavaField(cls, member.name, context.getDescriptor(member.getType()));
77
+		JavaField field = new JavaField(cls, member.name, context.getDescriptor(member.getType()), context.getSignature(member.getType()));
78 78
 		module.setFieldInfo(member, field);
79 79
 		
80 80
 		if (member.hasAutoGetter() || member.hasAutoSetter())

Loading…
Cancel
Save