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
 	public final JavaClass cls;
13
 	public final JavaClass cls;
14
 	public final String name;
14
 	public final String name;
15
 	public final String descriptor;
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
 	public JavaField(JavaClass cls, String name, String descriptor) {
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
 		this.cls = cls;
23
 		this.cls = cls;
20
 		this.name = name;
24
 		this.name = name;
21
 		this.descriptor = descriptor;
25
 		this.descriptor = descriptor;
26
+		this.signature = signature;
22
 	}
27
 	}
23
 	
28
 	
24
 	public String getMapping(JavaClass definition) {
29
 	public String getMapping(JavaClass definition) {

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

76
 			System.out.println("Class " + cls.fullName + " not empty because of const " + member.name);
76
 			System.out.println("Class " + cls.fullName + " not empty because of const " + member.name);
77
 		
77
 		
78
 		cls.empty = false;
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
 		return null;
80
 		return null;
81
 	}
81
 	}
82
 	
82
 	
83
 	@Override
83
 	@Override
84
 	public Void visitField(FieldMember member) {
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
 		module.setFieldInfo(member, field);
86
 		module.setFieldInfo(member, field);
87
 		if (member.hasAutoGetter()) {
87
 		if (member.hasAutoGetter()) {
88
 			visitGetter(member.autoGetter);
88
 			visitGetter(member.autoGetter);

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

61
 	
61
 	
62
 	@Override
62
 	@Override
63
 	public Void visitConst(ConstMember member) {
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
 		module.setFieldInfo(member, field);
65
 		module.setFieldInfo(member, field);
66
 		
66
 		
67
 		if (DEBUG_EMPTY && cls.empty)
67
 		if (DEBUG_EMPTY && cls.empty)
74
 	@Override
74
 	@Override
75
 	public Void visitField(FieldMember member) {
75
 	public Void visitField(FieldMember member) {
76
 		// TODO: expansion fields
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
 		module.setFieldInfo(member, field);
78
 		module.setFieldInfo(member, field);
79
 		
79
 		
80
 		if (member.hasAutoGetter() || member.hasAutoSetter())
80
 		if (member.hasAutoGetter() || member.hasAutoSetter())

Loading…
Cancel
Save