Explorar el Código

- Minor code cleanup.

- WIP on map files (used to link zencode to already compiled classes, and to define native methods)
Stan Hebben hace 6 años
padre
commit
6eca301d7c
Se han modificado 74 ficheros con 776 adiciones y 863 borrados
  1. 6
    41
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionHeader.java
  2. 6
    9
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/HighLevelDefinition.java
  3. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/ModuleProcessor.java
  4. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/OperatorType.java
  5. 14
    14
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/AnnotationDefinition.java
  6. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/DefinitionAnnotation.java
  7. 12
    12
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidAnnotationDefinition.java
  8. 3
    7
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidMemberAnnotation.java
  9. 7
    7
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/MemberAnnotation.java
  10. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/ParameterAnnotation.java
  11. 8
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/PreconditionForMethod.java
  12. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/StatementAnnotation.java
  13. 8
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/DefinitionVisitor.java
  14. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/EnumConstantExpression.java
  15. 8
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/Expression.java
  16. 0
    72
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionBuilder.java
  17. 0
    18
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionContext.java
  18. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionSymbol.java
  19. 70
    70
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionVisitor.java
  20. 71
    71
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionVisitorWithContext.java
  21. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/FunctionExpression.java
  22. 1
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetterExpression.java
  23. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NewExpression.java
  24. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/switchvalue/SwitchValue.java
  25. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/switchvalue/SwitchValueVisitor.java
  26. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/switchvalue/SwitchValueVisitorWithContext.java
  27. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/GenericParameterBoundVisitor.java
  28. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/GenericParameterBoundVisitorWithContext.java
  29. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/ParameterSuperBound.java
  30. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/ParameterTypeBound.java
  31. 2
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/TypeParameter.java
  32. 8
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/TypeParameterBound.java
  33. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ConstructorMember.java
  34. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FieldMember.java
  35. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/GetterMember.java
  36. 13
    13
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/IDefinitionMember.java
  37. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ImplementationMember.java
  38. 14
    14
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/MemberVisitor.java
  39. 14
    14
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/MemberVisitorWithContext.java
  40. 0
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialStaticMemberGroupExpression.java
  41. 16
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialTypeExpression.java
  42. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/processor/InterfaceProcessor.java
  43. 1
    17
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/DefinitionScope.java
  44. 1
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/ExpressionScope.java
  45. 0
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/FunctionScope.java
  46. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/GlobalScriptScope.java
  47. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/LambdaScope.java
  48. 15
    15
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/StatementVisitor.java
  49. 15
    15
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/StatementVisitorWithContext.java
  50. 1
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/AssocTypeID.java
  51. 0
    7
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/DefinitionTypeID.java
  52. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/ISymbol.java
  53. 1
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/OptionalTypeID.java
  54. 1
    158
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/StoredType.java
  55. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeID.java
  56. 0
    92
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeParameterCollector.java
  57. 12
    12
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeVisitor.java
  58. 3
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMember.java
  59. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberBuilder.java
  60. 3
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberGroup.java
  61. 9
    16
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMembers.java
  62. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/storage/StorageType.java
  63. 16
    0
      Constructor/src/main/java/org/openzen/zenscript/constructor/ConstructorRegistry.java
  64. 0
    15
      JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaBaseCompiler.java
  65. 2
    2
      JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaCompileSpace.java
  66. 22
    0
      JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaCompiledModule.java
  67. 12
    0
      JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaField.java
  68. 306
    0
      JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaMappingWriter.java
  69. 14
    0
      JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaMethod.java
  70. 2
    1
      JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaNativeTranslation.java
  71. 8
    8
      Parser/src/main/java/org/openzen/zenscript/lexer/ZSTokenType.java
  72. 2
    3
      Parser/src/main/java/org/openzen/zenscript/parser/definitions/BaseParsedDefinition.java
  73. 1
    1
      Parser/src/main/java/org/openzen/zenscript/parser/definitions/ParsedAlias.java
  74. 3
    2
      Parser/src/main/java/org/openzen/zenscript/parser/definitions/ParsedFunctionParameter.java

+ 6
- 41
CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionHeader.java Ver fichero

@@ -18,6 +18,7 @@ import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
18 18
 import org.openzen.zenscript.codemodel.scope.TypeScope;
19 19
 import org.openzen.zenscript.codemodel.type.StoredType;
20 20
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
21
+import org.openzen.zenscript.codemodel.type.storage.AutoStorageTag;
21 22
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
22 23
 
23 24
 /**
@@ -207,7 +208,7 @@ public class FunctionHeader {
207 208
 		return true;
208 209
 	}
209 210
 	
210
-	public String getCanonical() {
211
+	public String getCanonicalWithoutReturnType() {
211 212
 		StringBuilder result = new StringBuilder();
212 213
 		if (getNumberOfTypeParameters() > 0) {
213 214
 			result.append('<');
@@ -218,8 +219,8 @@ public class FunctionHeader {
218 219
 			}
219 220
 			result.append('>');
220 221
 		}
221
-		if (storage != null)
222
-			result.append(storage);
222
+		if (storage != null && storage != AutoStorageTag.INSTANCE)
223
+			result.append('`').append(storage);
223 224
 		result.append('(');
224 225
 		for (int i = 0; i < parameters.length; i++) {
225 226
 			if (i > 0)
@@ -230,44 +231,8 @@ public class FunctionHeader {
230 231
 		return result.toString();
231 232
 	}
232 233
 	
233
-	public StoredType[] inferTypes(LocalMemberCache cache, CallArguments arguments, List<StoredType> resultHint) {
234
-		if (arguments.arguments.length != this.parameters.length)
235
-			return null;
236
-		
237
-		Map<TypeParameter, StoredType> mapping = new HashMap<>();
238
-		if (!resultHint.isEmpty()) {
239
-			for (StoredType hint : resultHint) {
240
-				Map<TypeParameter, StoredType> temp = returnType.inferTypeParameters(cache, hint);
241
-				if (temp != null) {
242
-					mapping = temp;
243
-					break;
244
-				}
245
-			}
246
-		}
247
-		
248
-		// TODO: lambda header inference
249
-		for (int i = 0; i < parameters.length; i++) {
250
-			Map<TypeParameter, StoredType> forParameter = parameters[i].type.inferTypeParameters(cache, arguments.arguments[i].type);
251
-			if (forParameter == null)
252
-				return null;
253
-			
254
-			mapping.putAll(forParameter);
255
-		}
256
-		
257
-		if (mapping.size() > typeParameters.length)
258
-			return null;
259
-		
260
-		StoredType[] result = new StoredType[typeParameters.length];
261
-		for (int i = 0; i < typeParameters.length; i++) {
262
-			TypeParameter typeParameter = typeParameters[i];
263
-			if (!mapping.containsKey(typeParameter)) {
264
-				return null;
265
-			} else {
266
-				result[i] = mapping.get(typeParameter);
267
-			}
268
-		}
269
-		
270
-		return result;
234
+	public String getCanonical() {
235
+		return getCanonicalWithoutReturnType() + returnType.type.toString();
271 236
 	}
272 237
 	
273 238
 	public boolean hasInferenceBlockingTypeParameters(TypeParameter[] parameters) {

+ 6
- 9
CodeModel/src/main/java/org/openzen/zenscript/codemodel/HighLevelDefinition.java Ver fichero

@@ -64,13 +64,6 @@ public abstract class HighLevelDefinition extends Taggable {
64 64
 			pkg.register(this);
65 65
 	}
66 66
 	
67
-	public HighLevelDefinition getOutermost() {
68
-		HighLevelDefinition result = this;
69
-		while (result.outerDefinition != null)
70
-			result = result.outerDefinition;
71
-		return result;
72
-	}
73
-	
74 67
 	public String getFullName() {
75 68
 		return pkg.fullName + '.' + name;
76 69
 	}
@@ -102,7 +95,11 @@ public abstract class HighLevelDefinition extends Taggable {
102 95
 	public void setOuterDefinition(HighLevelDefinition outerDefinition) {
103 96
 		this.outerDefinition = outerDefinition;
104 97
 	}
105
-	
98
+
99
+	public boolean isExpansion() {
100
+		return this instanceof ExpansionDefinition;
101
+	}
102
+
106 103
 	public boolean isInnerDefinition() {
107 104
 		return outerDefinition != null;
108 105
 	}
@@ -187,7 +184,7 @@ public abstract class HighLevelDefinition extends Taggable {
187 184
 	
188 185
 	public void normalize(TypeScope scope) {
189 186
 		DestructorMember destructor = null;
190
-		List<FieldMember> fields = new ArrayList();
187
+		List<FieldMember> fields = new ArrayList<>();
191 188
 		
192 189
 		for (IDefinitionMember member : members) {
193 190
 			member.normalize(scope);

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/ModuleProcessor.java Ver fichero

@@ -10,7 +10,7 @@ package org.openzen.zenscript.codemodel;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface ModuleProcessor {
13
-	public ScriptBlock process(ScriptBlock block);
13
+	ScriptBlock process(ScriptBlock block);
14 14
 	
15
-	public void process(HighLevelDefinition definition);
15
+	void process(HighLevelDefinition definition);
16 16
 }

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/OperatorType.java Ver fichero

@@ -59,13 +59,13 @@ public enum OperatorType {
59 59
 	public final String operator;
60 60
 	public final String compiledName;
61 61
 	
62
-	private OperatorType(String operator, String compiledName) {
62
+	OperatorType(String operator, String compiledName) {
63 63
 		this.operator = operator;
64 64
 		this.compiledName = compiledName;
65 65
 		assignOperatorFor = null;
66 66
 	}
67 67
 	
68
-	private OperatorType(String operator, String compiledName, OperatorType assignOperatorFor) {
68
+	OperatorType(String operator, String compiledName, OperatorType assignOperatorFor) {
69 69
 		this.operator = operator;
70 70
 		this.compiledName = compiledName;
71 71
 		this.assignOperatorFor = assignOperatorFor;

+ 14
- 14
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/AnnotationDefinition.java Ver fichero

@@ -25,31 +25,31 @@ import org.openzen.zenscript.codemodel.statement.Statement;
25 25
  * @author Hoofdgebruiker
26 26
  */
27 27
 public interface AnnotationDefinition {
28
-	public String getAnnotationName();
28
+	String getAnnotationName();
29 29
 	
30
-	public List<FunctionHeader> getInitializers(BaseScope scope);
30
+	List<FunctionHeader> getInitializers(BaseScope scope);
31 31
 	
32
-	public ExpressionScope getScopeForMember(IDefinitionMember member, BaseScope scope);
32
+	ExpressionScope getScopeForMember(IDefinitionMember member, BaseScope scope);
33 33
 	
34
-	public ExpressionScope getScopeForType(HighLevelDefinition definition, BaseScope scope);
34
+	ExpressionScope getScopeForType(HighLevelDefinition definition, BaseScope scope);
35 35
 	
36
-	public ExpressionScope getScopeForStatement(Statement statement, StatementScope scope);
36
+	ExpressionScope getScopeForStatement(Statement statement, StatementScope scope);
37 37
 	
38
-	public ExpressionScope getScopeForParameter(FunctionHeader header, FunctionParameter parameter, BaseScope scope);
38
+	ExpressionScope getScopeForParameter(FunctionHeader header, FunctionParameter parameter, BaseScope scope);
39 39
 	
40
-	public MemberAnnotation createForMember(CodePosition position, CallArguments arguments);
40
+	MemberAnnotation createForMember(CodePosition position, CallArguments arguments);
41 41
 	
42
-	public DefinitionAnnotation createForDefinition(CodePosition position, CallArguments arguments);
42
+	DefinitionAnnotation createForDefinition(CodePosition position, CallArguments arguments);
43 43
 	
44
-	public StatementAnnotation createForStatement(CodePosition position, CallArguments arguments);
44
+	StatementAnnotation createForStatement(CodePosition position, CallArguments arguments);
45 45
 	
46
-	public ParameterAnnotation createForParameter(CodePosition position, CallArguments arguments);
46
+	ParameterAnnotation createForParameter(CodePosition position, CallArguments arguments);
47 47
 	
48
-	public MemberAnnotation deserializeForMember(CodeSerializationInput input, TypeContext context, IDefinitionMember member);
48
+	MemberAnnotation deserializeForMember(CodeSerializationInput input, TypeContext context, IDefinitionMember member);
49 49
 	
50
-	public DefinitionAnnotation deserializeForDefinition(CodeSerializationInput input, TypeContext context);
50
+	DefinitionAnnotation deserializeForDefinition(CodeSerializationInput input, TypeContext context);
51 51
 	
52
-	public StatementAnnotation deserializeForStatement(CodeSerializationInput input, StatementContext context);
52
+	StatementAnnotation deserializeForStatement(CodeSerializationInput input, StatementContext context);
53 53
 	
54
-	public ParameterAnnotation deserializeForParameter(CodeSerializationInput input, TypeContext context);
54
+	ParameterAnnotation deserializeForParameter(CodeSerializationInput input, TypeContext context);
55 55
 }

+ 5
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/DefinitionAnnotation.java Ver fichero

@@ -15,13 +15,13 @@ import org.openzen.zenscript.codemodel.serialization.CodeSerializationOutput;
15 15
  * @author Hoofdgebruiker
16 16
  */
17 17
 public interface DefinitionAnnotation {
18
-	public static final DefinitionAnnotation[] NONE = new DefinitionAnnotation[0];
18
+	DefinitionAnnotation[] NONE = new DefinitionAnnotation[0];
19 19
 	
20
-	public AnnotationDefinition getDefinition();
20
+	AnnotationDefinition getDefinition();
21 21
 	
22
-	public void apply(HighLevelDefinition definition, BaseScope scope);
22
+	void apply(HighLevelDefinition definition, BaseScope scope);
23 23
 	
24
-	public void applyOnSubtype(HighLevelDefinition definition, BaseScope scope);
24
+	void applyOnSubtype(HighLevelDefinition definition, BaseScope scope);
25 25
 	
26
-	public void serialize(CodeSerializationOutput output, HighLevelDefinition definition, TypeContext context);
26
+	void serialize(CodeSerializationOutput output, HighLevelDefinition definition, TypeContext context);
27 27
 }

+ 12
- 12
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidAnnotationDefinition.java Ver fichero

@@ -42,61 +42,61 @@ public class InvalidAnnotationDefinition implements AnnotationDefinition {
42 42
 
43 43
 	@Override
44 44
 	public ExpressionScope getScopeForMember(IDefinitionMember member, BaseScope scope) {
45
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
45
+		throw new UnsupportedOperationException("Not a valid annotation");
46 46
 	}
47 47
 
48 48
 	@Override
49 49
 	public ExpressionScope getScopeForType(HighLevelDefinition definition, BaseScope scope) {
50
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
50
+		throw new UnsupportedOperationException("Not a valid annotation");
51 51
 	}
52 52
 
53 53
 	@Override
54 54
 	public ExpressionScope getScopeForStatement(Statement statement, StatementScope scope) {
55
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
55
+		throw new UnsupportedOperationException("Not a valid annotation");
56 56
 	}
57 57
 
58 58
 	@Override
59 59
 	public ExpressionScope getScopeForParameter(FunctionHeader header, FunctionParameter parameter, BaseScope scope) {
60
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
60
+		throw new UnsupportedOperationException("Not a valid annotation");
61 61
 	}
62 62
 
63 63
 	@Override
64 64
 	public MemberAnnotation createForMember(CodePosition position, CallArguments arguments) {
65
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
65
+		throw new UnsupportedOperationException("Not a valid annotation");
66 66
 	}
67 67
 
68 68
 	@Override
69 69
 	public DefinitionAnnotation createForDefinition(CodePosition position, CallArguments arguments) {
70
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
70
+		throw new UnsupportedOperationException("Not a valid annotation");
71 71
 	}
72 72
 
73 73
 	@Override
74 74
 	public StatementAnnotation createForStatement(CodePosition position, CallArguments arguments) {
75
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
75
+		throw new UnsupportedOperationException("Not a valid annotation");
76 76
 	}
77 77
 
78 78
 	@Override
79 79
 	public ParameterAnnotation createForParameter(CodePosition position, CallArguments arguments) {
80
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
80
+		throw new UnsupportedOperationException("Not a valid annotation");
81 81
 	}
82 82
 
83 83
 	@Override
84 84
 	public MemberAnnotation deserializeForMember(CodeSerializationInput input, TypeContext context, IDefinitionMember member) {
85
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
85
+		throw new UnsupportedOperationException("Not a valid annotation");
86 86
 	}
87 87
 
88 88
 	@Override
89 89
 	public DefinitionAnnotation deserializeForDefinition(CodeSerializationInput input, TypeContext context) {
90
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
90
+		throw new UnsupportedOperationException("Not a valid annotation");
91 91
 	}
92 92
 
93 93
 	@Override
94 94
 	public StatementAnnotation deserializeForStatement(CodeSerializationInput input, StatementContext context) {
95
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
95
+		throw new UnsupportedOperationException("Not a valid annotation");
96 96
 	}
97 97
 
98 98
 	@Override
99 99
 	public ParameterAnnotation deserializeForParameter(CodeSerializationInput input, TypeContext context) {
100
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
100
+		throw new UnsupportedOperationException("Not a valid annotation");
101 101
 	}
102 102
 }

+ 3
- 7
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidMemberAnnotation.java Ver fichero

@@ -26,12 +26,6 @@ public class InvalidMemberAnnotation implements MemberAnnotation {
26 26
 	public final CompileExceptionCode code;
27 27
 	public final String message;
28 28
 	
29
-	public InvalidMemberAnnotation(CodePosition position, CompileExceptionCode code, String message) {
30
-		this.position = position;
31
-		this.code = code;
32
-		this.message = message;
33
-	}
34
-	
35 29
 	public InvalidMemberAnnotation(CompileException ex) {
36 30
 		this.position = ex.position;
37 31
 		this.code = ex.code;
@@ -65,6 +59,8 @@ public class InvalidMemberAnnotation implements MemberAnnotation {
65 59
 
66 60
 	@Override
67 61
 	public void serialize(CodeSerializationOutput output, IDefinitionMember member, TypeContext context) {
68
-		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
62
+		output.serialize(position);
63
+		output.writeUInt(code.ordinal());
64
+		output.writeString(message);
69 65
 	}
70 66
 }

+ 7
- 7
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/MemberAnnotation.java Ver fichero

@@ -18,17 +18,17 @@ import org.openzen.zenscript.codemodel.serialization.CodeSerializationOutput;
18 18
  * @author Hoofdgebruiker
19 19
  */
20 20
 public interface MemberAnnotation {
21
-	public static final MemberAnnotation[] NONE = new MemberAnnotation[0];
21
+	MemberAnnotation[] NONE = new MemberAnnotation[0];
22 22
 	
23
-	public AnnotationDefinition getDefinition();
23
+	AnnotationDefinition getDefinition();
24 24
 	
25
-	public void apply(IDefinitionMember member, BaseScope scope);
25
+	void apply(IDefinitionMember member, BaseScope scope);
26 26
 	
27
-	public void applyOnOverridingMethod(FunctionalMember member, BaseScope scope);
27
+	void applyOnOverridingMethod(FunctionalMember member, BaseScope scope);
28 28
 	
29
-	public void applyOnOverridingGetter(GetterMember member, BaseScope scope);
29
+	void applyOnOverridingGetter(GetterMember member, BaseScope scope);
30 30
 	
31
-	public void applyOnOverridingSetter(SetterMember member, BaseScope scope);
31
+	void applyOnOverridingSetter(SetterMember member, BaseScope scope);
32 32
 	
33
-	public void serialize(CodeSerializationOutput output, IDefinitionMember member, TypeContext context);
33
+	void serialize(CodeSerializationOutput output, IDefinitionMember member, TypeContext context);
34 34
 }

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/ParameterAnnotation.java Ver fichero

@@ -10,9 +10,9 @@ package org.openzen.zenscript.codemodel.annotations;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface ParameterAnnotation {
13
-	public static final ParameterAnnotation[] NONE = new ParameterAnnotation[0];
13
+	ParameterAnnotation[] NONE = new ParameterAnnotation[0];
14 14
 	
15
-	public AnnotationDefinition getDefinition();
15
+	AnnotationDefinition getDefinition();
16 16
 	
17
-	public void apply();
17
+	void apply();
18 18
 }

+ 8
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/PreconditionForMethod.java Ver fichero

@@ -10,23 +10,24 @@ import java.util.Arrays;
10 10
 import java.util.List;
11 11
 import org.openzen.zencode.shared.CodePosition;
12 12
 import org.openzen.zencode.shared.CompileException;
13
+import org.openzen.zenscript.codemodel.OperatorType;
13 14
 import org.openzen.zenscript.codemodel.context.StatementContext;
14 15
 import org.openzen.zenscript.codemodel.context.TypeContext;
16
+import org.openzen.zenscript.codemodel.expression.CallArguments;
15 17
 import org.openzen.zenscript.codemodel.expression.Expression;
16
-import org.openzen.zenscript.codemodel.expression.ExpressionBuilder;
17 18
 import org.openzen.zenscript.codemodel.expression.PanicExpression;
18 19
 import org.openzen.zenscript.codemodel.member.FunctionalMember;
19 20
 import org.openzen.zenscript.codemodel.member.GetterMember;
20 21
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
21 22
 import org.openzen.zenscript.codemodel.member.SetterMember;
22 23
 import org.openzen.zenscript.codemodel.scope.BaseScope;
23
-import org.openzen.zenscript.codemodel.scope.ExpressionScope;
24 24
 import org.openzen.zenscript.codemodel.serialization.CodeSerializationOutput;
25 25
 import org.openzen.zenscript.codemodel.statement.BlockStatement;
26 26
 import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
27 27
 import org.openzen.zenscript.codemodel.statement.IfStatement;
28 28
 import org.openzen.zenscript.codemodel.statement.Statement;
29 29
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
30
+import org.openzen.zenscript.codemodel.type.member.TypeMembers;
30 31
 
31 32
 /**
32 33
  *
@@ -85,11 +86,12 @@ public class PreconditionForMethod implements MemberAnnotation {
85 86
 			return body;
86 87
 		
87 88
 		try {
88
-			ExpressionScope expressionScope = new ExpressionScope(scope, BasicTypeID.BOOL.stored);
89
-			List<Statement> statements = new ArrayList<>();
90
-			ExpressionBuilder expressionBuilder = new ExpressionBuilder(position, expressionScope);
91
-			Expression inverseCondition = expressionBuilder.not(condition);
89
+			TypeMembers members = scope.getTypeMembers(condition.type);
90
+			Expression inverseCondition = members.getGroup(OperatorType.NOT)
91
+					.call(position, scope, condition, CallArguments.EMPTY, false);
92
+
92 93
 			Statement throwStatement = new ExpressionStatement(position, new PanicExpression(position, BasicTypeID.VOID.stored, message));
94
+			List<Statement> statements = new ArrayList<>();
93 95
 			statements.add(new IfStatement(position, inverseCondition, throwStatement, null));
94 96
 
95 97
 			if (body instanceof BlockStatement) {

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/StatementAnnotation.java Ver fichero

@@ -13,9 +13,9 @@ import org.openzen.zenscript.codemodel.statement.Statement;
13 13
  * @author Hoofdgebruiker
14 14
  */
15 15
 public interface StatementAnnotation {
16
-	public static final StatementAnnotation[] NONE = new StatementAnnotation[0];
16
+	StatementAnnotation[] NONE = new StatementAnnotation[0];
17 17
 	
18
-	public AnnotationDefinition getDefinition();
18
+	AnnotationDefinition getDefinition();
19 19
 	
20
-	public Statement apply(Statement statement, StatementScope scope);
20
+	Statement apply(Statement statement, StatementScope scope);
21 21
 }

+ 8
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/DefinitionVisitor.java Ver fichero

@@ -10,19 +10,19 @@ package org.openzen.zenscript.codemodel.definition;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface DefinitionVisitor<T> {
13
-	public T visitClass(ClassDefinition definition);
13
+	T visitClass(ClassDefinition definition);
14 14
 	
15
-	public T visitInterface(InterfaceDefinition definition);
15
+	T visitInterface(InterfaceDefinition definition);
16 16
 	
17
-	public T visitEnum(EnumDefinition definition);
17
+	T visitEnum(EnumDefinition definition);
18 18
 	
19
-	public T visitStruct(StructDefinition definition);
19
+	T visitStruct(StructDefinition definition);
20 20
 	
21
-	public T visitFunction(FunctionDefinition definition);
21
+	T visitFunction(FunctionDefinition definition);
22 22
 	
23
-	public T visitExpansion(ExpansionDefinition definition);
23
+	T visitExpansion(ExpansionDefinition definition);
24 24
 	
25
-	public T visitAlias(AliasDefinition definition);
25
+	T visitAlias(AliasDefinition definition);
26 26
 	
27
-	public T visitVariant(VariantDefinition variant);
27
+	T visitVariant(VariantDefinition variant);
28 28
 }

+ 0
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/EnumConstantExpression.java Ver fichero

@@ -11,7 +11,6 @@ import org.openzen.zenscript.codemodel.member.EnumConstantMember;
11 11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
12 12
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
13 13
 import org.openzen.zenscript.codemodel.type.TypeID;
14
-import org.openzen.zenscript.codemodel.type.storage.ValueStorageTag;
15 14
 
16 15
 /**
17 16
  *

+ 8
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/Expression.java Ver fichero

@@ -18,6 +18,7 @@ import org.openzen.zenscript.codemodel.OperatorType;
18 18
 import org.openzen.zenscript.codemodel.member.EnumConstantMember;
19 19
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
20 20
 import org.openzen.zenscript.codemodel.GenericName;
21
+import org.openzen.zenscript.codemodel.type.member.TypeMemberGroup;
21 22
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
22 23
 import org.openzen.zenscript.codemodel.scope.TypeScope;
23 24
 import org.openzen.zenscript.codemodel.statement.Statement;
@@ -102,22 +103,23 @@ public abstract class Expression implements IPartialExpression {
102 103
 	
103 104
 	@Override
104 105
 	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) {
105
-		return scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CALL).predictCallTypes(position, scope, hints, arguments);
106
+		TypeMemberGroup group = scope.getTypeMembers(type).getGroup(OperatorType.CALL);
107
+		return group.predictCallTypes(position, scope, hints, arguments);
106 108
 	}
107 109
 	
108 110
 	@Override
109 111
 	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) {
110
-		return scope.getTypeMembers(type)
111
-				.getOrCreateGroup(OperatorType.CALL)
112
-				.getMethodMembers().stream()
113
-				.filter(method -> method.member.getHeader().parameters.length == arguments && !method.member.isStatic())
112
+		TypeMemberGroup group = scope.getTypeMembers(type).getGroup(OperatorType.CALL);
113
+		return group.getMethodMembers().stream()
114
+				.filter(method -> method.member.getHeader().accepts(arguments) && !method.member.isStatic())
114 115
 				.map(method -> method.member.getHeader())
115 116
 				.collect(Collectors.toList());
116 117
 	}
117 118
 	
118 119
 	@Override
119 120
 	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException {
120
-		return scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CALL).call(position, scope, this, arguments, false);
121
+		TypeMemberGroup group = scope.getTypeMembers(type).getGroup(OperatorType.CALL);
122
+		return group.call(position, scope, this, arguments, false);
121 123
 	}
122 124
 	
123 125
 	@Override

+ 0
- 72
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionBuilder.java Ver fichero

@@ -1,72 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.zenscript.codemodel.expression;
7
-
8
-import java.util.ArrayList;
9
-import java.util.List;
10
-import org.openzen.zencode.shared.CodePosition;
11
-import org.openzen.zencode.shared.CompileException;
12
-import org.openzen.zencode.shared.CompileExceptionCode;
13
-import org.openzen.zenscript.codemodel.OperatorType;
14
-import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
15
-import org.openzen.zenscript.codemodel.scope.ExpressionScope;
16
-import org.openzen.zenscript.codemodel.GenericName;
17
-import org.openzen.zenscript.codemodel.type.StoredType;
18
-import org.openzen.zenscript.codemodel.type.TypeID;
19
-import org.openzen.zenscript.codemodel.type.member.TypeMemberGroup;
20
-import org.openzen.zenscript.codemodel.type.member.TypeMembers;
21
-import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
22
-import stdlib.Strings;
23
-
24
-/**
25
- *
26
- * @author Hoofdgebruiker
27
- */
28
-public class ExpressionBuilder {
29
-	public final CodePosition position;
30
-	public final ExpressionScope scope;
31
-	
32
-	public ExpressionBuilder(CodePosition position, ExpressionScope scope) {
33
-		this.position = position;
34
-		this.scope = scope;
35
-	}
36
-	
37
-	public Expression constructNew(CodePosition position, String typename, Expression... arguments) throws CompileException {
38
-		String[] nameParts = Strings.split(typename, '.');
39
-		List<GenericName> name = new ArrayList<>();
40
-		for (String namePart : nameParts)
41
-			name.add(new GenericName(namePart));
42
-		TypeID type = scope.getType(position, name);
43
-		if (type == null)
44
-			throw new CompileException(position, CompileExceptionCode.NO_SUCH_TYPE, "No such type: " + typename);
45
-		
46
-		return constructNew(position, type.stored(UniqueStorageTag.INSTANCE), arguments);
47
-	}
48
-	
49
-	public Expression constructNew(CodePosition position, StoredType type, Expression... arguments) throws CompileException {
50
-		TypeMemberGroup constructors = scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CONSTRUCTOR);
51
-		List<StoredType>[] predictedTypes = constructors.predictCallTypes(position, scope, scope.hints, arguments.length);
52
-		CallArguments compiledArguments = new CallArguments(arguments);
53
-		FunctionalMemberRef member = constructors.selectMethod(position, scope, compiledArguments, true, true);
54
-		if (member == null)
55
-			throw new CompileException(position, CompileExceptionCode.CALL_NO_VALID_METHOD, "No matching constructor found");
56
-		if (!member.isConstructor())
57
-			throw new CompileException(position, CompileExceptionCode.INTERNAL_ERROR, "COMPILER BUG: constructor is not a constructor");
58
-		
59
-		return new NewExpression(
60
-				position,
61
-				type,
62
-				member,
63
-				compiledArguments,
64
-				compiledArguments.getNumberOfTypeArguments() == 0 ? member.getHeader() : member.getHeader().fillGenericArguments(CodePosition.BUILTIN, scope, compiledArguments.typeArguments));
65
-	}
66
-	
67
-	public Expression not(Expression value) throws CompileException {
68
-		TypeMembers members = scope.getTypeMembers(value.type);
69
-		return members.getOrCreateGroup(OperatorType.NOT)
70
-				.call(position, scope, value, CallArguments.EMPTY, false);
71
-	}
72
-}

+ 0
- 18
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionContext.java Ver fichero

@@ -1,18 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.zenscript.codemodel.expression;
7
-
8
-import org.openzen.zenscript.codemodel.statement.Statement;
9
-
10
-/**
11
- *
12
- * @author Hoofdgebruiker
13
- */
14
-public interface ExpressionContext {
15
-	void addStatementBefore(Statement statement);
16
-	
17
-	void addStatementAfter(Statement statement);
18
-}

+ 0
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionSymbol.java Ver fichero

@@ -6,7 +6,6 @@
6 6
 package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import java.util.function.BiFunction;
9
-import java.util.function.Function;
10 9
 import org.openzen.zencode.shared.CodePosition;
11 10
 import org.openzen.zenscript.codemodel.context.TypeResolutionContext;
12 11
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;

+ 70
- 70
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionVisitor.java Ver fichero

@@ -10,145 +10,145 @@ package org.openzen.zenscript.codemodel.expression;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface ExpressionVisitor<T> {
13
-	public T visitAndAnd(AndAndExpression expression);
13
+	T visitAndAnd(AndAndExpression expression);
14 14
 	
15
-	public T visitArray(ArrayExpression expression);
15
+	T visitArray(ArrayExpression expression);
16 16
 	
17
-	public T visitCompare(CompareExpression expression);
17
+	T visitCompare(CompareExpression expression);
18 18
 	
19
-	public T visitCall(CallExpression expression);
19
+	T visitCall(CallExpression expression);
20 20
 	
21
-	public T visitCallStatic(CallStaticExpression expression);
21
+	T visitCallStatic(CallStaticExpression expression);
22 22
 	
23
-	public T visitCapturedClosure(CapturedClosureExpression expression);
23
+	T visitCapturedClosure(CapturedClosureExpression expression);
24 24
 	
25
-	public T visitCapturedDirect(CapturedDirectExpression expression);
25
+	T visitCapturedDirect(CapturedDirectExpression expression);
26 26
 	
27
-	public T visitCapturedLocalVariable(CapturedLocalVariableExpression expression);
27
+	T visitCapturedLocalVariable(CapturedLocalVariableExpression expression);
28 28
 	
29
-	public T visitCapturedParameter(CapturedParameterExpression expression);
29
+	T visitCapturedParameter(CapturedParameterExpression expression);
30 30
 	
31
-	public T visitCapturedThis(CapturedThisExpression expression);
31
+	T visitCapturedThis(CapturedThisExpression expression);
32 32
 	
33
-	public T visitCast(CastExpression expression);
33
+	T visitCast(CastExpression expression);
34 34
 	
35
-	public T visitCheckNull(CheckNullExpression expression);
35
+	T visitCheckNull(CheckNullExpression expression);
36 36
 	
37
-	public T visitCoalesce(CoalesceExpression expression);
37
+	T visitCoalesce(CoalesceExpression expression);
38 38
 	
39
-	public T visitConditional(ConditionalExpression expression);
39
+	T visitConditional(ConditionalExpression expression);
40 40
 	
41
-	public T visitConst(ConstExpression expression);
41
+	T visitConst(ConstExpression expression);
42 42
 	
43
-	public T visitConstantBool(ConstantBoolExpression expression);
43
+	T visitConstantBool(ConstantBoolExpression expression);
44 44
 	
45
-	public T visitConstantByte(ConstantByteExpression expression);
45
+	T visitConstantByte(ConstantByteExpression expression);
46 46
 	
47
-	public T visitConstantChar(ConstantCharExpression expression);
47
+	T visitConstantChar(ConstantCharExpression expression);
48 48
 	
49
-	public T visitConstantDouble(ConstantDoubleExpression expression);
49
+	T visitConstantDouble(ConstantDoubleExpression expression);
50 50
 	
51
-	public T visitConstantFloat(ConstantFloatExpression expression);
51
+	T visitConstantFloat(ConstantFloatExpression expression);
52 52
 	
53
-	public T visitConstantInt(ConstantIntExpression expression);
53
+	T visitConstantInt(ConstantIntExpression expression);
54 54
 	
55
-	public T visitConstantLong(ConstantLongExpression expression);
55
+	T visitConstantLong(ConstantLongExpression expression);
56 56
 	
57
-	public T visitConstantSByte(ConstantSByteExpression expression);
57
+	T visitConstantSByte(ConstantSByteExpression expression);
58 58
 	
59
-	public T visitConstantShort(ConstantShortExpression expression);
59
+	T visitConstantShort(ConstantShortExpression expression);
60 60
 	
61
-	public T visitConstantString(ConstantStringExpression expression);
61
+	T visitConstantString(ConstantStringExpression expression);
62 62
 	
63
-	public T visitConstantUInt(ConstantUIntExpression expression);
63
+	T visitConstantUInt(ConstantUIntExpression expression);
64 64
 	
65
-	public T visitConstantULong(ConstantULongExpression expression);
65
+	T visitConstantULong(ConstantULongExpression expression);
66 66
 	
67
-	public T visitConstantUShort(ConstantUShortExpression expression);
67
+	T visitConstantUShort(ConstantUShortExpression expression);
68 68
 	
69
-	public T visitConstantUSize(ConstantUSizeExpression expression);
69
+	T visitConstantUSize(ConstantUSizeExpression expression);
70 70
 	
71
-	public T visitConstructorThisCall(ConstructorThisCallExpression expression);
71
+	T visitConstructorThisCall(ConstructorThisCallExpression expression);
72 72
 	
73
-	public T visitConstructorSuperCall(ConstructorSuperCallExpression expression);
73
+	T visitConstructorSuperCall(ConstructorSuperCallExpression expression);
74 74
 	
75
-	public T visitEnumConstant(EnumConstantExpression expression);
75
+	T visitEnumConstant(EnumConstantExpression expression);
76 76
 	
77
-	public T visitFunction(FunctionExpression expression);
77
+	T visitFunction(FunctionExpression expression);
78 78
 	
79
-	public T visitGetField(GetFieldExpression expression);
79
+	T visitGetField(GetFieldExpression expression);
80 80
 	
81
-	public T visitGetFunctionParameter(GetFunctionParameterExpression expression);
81
+	T visitGetFunctionParameter(GetFunctionParameterExpression expression);
82 82
 	
83
-	public T visitGetLocalVariable(GetLocalVariableExpression expression);
83
+	T visitGetLocalVariable(GetLocalVariableExpression expression);
84 84
 	
85
-	public T visitGetMatchingVariantField(GetMatchingVariantField expression);
85
+	T visitGetMatchingVariantField(GetMatchingVariantField expression);
86 86
 	
87
-	public T visitGetStaticField(GetStaticFieldExpression expression);
87
+	T visitGetStaticField(GetStaticFieldExpression expression);
88 88
 	
89
-	public T visitGetter(GetterExpression expression);
89
+	T visitGetter(GetterExpression expression);
90 90
 	
91
-	public T visitGlobal(GlobalExpression expression);
91
+	T visitGlobal(GlobalExpression expression);
92 92
 	
93
-	public T visitGlobalCall(GlobalCallExpression expression);
93
+	T visitGlobalCall(GlobalCallExpression expression);
94 94
 	
95
-	public T visitInterfaceCast(InterfaceCastExpression expression);
95
+	T visitInterfaceCast(InterfaceCastExpression expression);
96 96
 	
97
-	public default T visitInvalid(InvalidExpression expression) {
97
+	default T visitInvalid(InvalidExpression expression) {
98 98
 		throw new RuntimeException("Invalid expression");
99 99
 	}
100 100
 	
101
-	public T visitIs(IsExpression expression);
101
+	T visitIs(IsExpression expression);
102 102
 	
103
-	public T visitMakeConst(MakeConstExpression expression);
103
+	T visitMakeConst(MakeConstExpression expression);
104 104
 	
105
-	public T visitMap(MapExpression expression);
105
+	T visitMap(MapExpression expression);
106 106
 	
107
-	public T visitMatch(MatchExpression expression);
107
+	T visitMatch(MatchExpression expression);
108 108
 	
109
-	public T visitNew(NewExpression expression);
109
+	T visitNew(NewExpression expression);
110 110
 	
111
-	public T visitNull(NullExpression expression);
111
+	T visitNull(NullExpression expression);
112 112
 	
113
-	public T visitOrOr(OrOrExpression expression);
113
+	T visitOrOr(OrOrExpression expression);
114 114
 	
115
-	public T visitPanic(PanicExpression expression);
115
+	T visitPanic(PanicExpression expression);
116 116
 	
117
-	public T visitPostCall(PostCallExpression expression);
117
+	T visitPostCall(PostCallExpression expression);
118 118
 	
119
-	public T visitRange(RangeExpression expression);
119
+	T visitRange(RangeExpression expression);
120 120
 	
121
-	public T visitSameObject(SameObjectExpression expression);
121
+	T visitSameObject(SameObjectExpression expression);
122 122
 	
123
-	public T visitSetField(SetFieldExpression expression);
123
+	T visitSetField(SetFieldExpression expression);
124 124
 	
125
-	public T visitSetFunctionParameter(SetFunctionParameterExpression expression);
125
+	T visitSetFunctionParameter(SetFunctionParameterExpression expression);
126 126
 	
127
-	public T visitSetLocalVariable(SetLocalVariableExpression expression);
127
+	T visitSetLocalVariable(SetLocalVariableExpression expression);
128 128
 	
129
-	public T visitSetStaticField(SetStaticFieldExpression expression);
129
+	T visitSetStaticField(SetStaticFieldExpression expression);
130 130
 	
131
-	public T visitSetter(SetterExpression expression);
131
+	T visitSetter(SetterExpression expression);
132 132
 	
133
-	public T visitStaticGetter(StaticGetterExpression expression);
133
+	T visitStaticGetter(StaticGetterExpression expression);
134 134
 	
135
-	public T visitStaticSetter(StaticSetterExpression expression);
135
+	T visitStaticSetter(StaticSetterExpression expression);
136 136
 	
137
-	public T visitStorageCast(StorageCastExpression expression);
137
+	T visitStorageCast(StorageCastExpression expression);
138 138
 	
139
-	public T visitSupertypeCast(SupertypeCastExpression expression);
139
+	T visitSupertypeCast(SupertypeCastExpression expression);
140 140
 	
141
-	public T visitThis(ThisExpression expression);
141
+	T visitThis(ThisExpression expression);
142 142
 	
143
-	public T visitThrow(ThrowExpression expression);
143
+	T visitThrow(ThrowExpression expression);
144 144
 	
145
-	public T visitTryConvert(TryConvertExpression expression);
145
+	T visitTryConvert(TryConvertExpression expression);
146 146
 	
147
-	public T visitTryRethrowAsException(TryRethrowAsExceptionExpression expression);
147
+	T visitTryRethrowAsException(TryRethrowAsExceptionExpression expression);
148 148
 	
149
-	public T visitTryRethrowAsResult(TryRethrowAsResultExpression expression);
149
+	T visitTryRethrowAsResult(TryRethrowAsResultExpression expression);
150 150
 	
151
-	public T visitVariantValue(VariantValueExpression expression);
151
+	T visitVariantValue(VariantValueExpression expression);
152 152
 	
153
-	public T visitWrapOptional(WrapOptionalExpression expression);
153
+	T visitWrapOptional(WrapOptionalExpression expression);
154 154
 }

+ 71
- 71
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionVisitorWithContext.java Ver fichero

@@ -10,143 +10,143 @@ package org.openzen.zenscript.codemodel.expression;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface ExpressionVisitorWithContext<C, R> {
13
-	public R visitAndAnd(C context, AndAndExpression expression);
13
+	R visitAndAnd(C context, AndAndExpression expression);
14 14
 	
15
-	public R visitArray(C context, ArrayExpression expression);
15
+	R visitArray(C context, ArrayExpression expression);
16 16
 	
17
-	public R visitCompare(C context, CompareExpression expression);
17
+	R visitCompare(C context, CompareExpression expression);
18 18
 	
19
-	public R visitCall(C context, CallExpression expression);
19
+	R visitCall(C context, CallExpression expression);
20 20
 	
21
-	public R visitCallStatic(C context, CallStaticExpression expression);
21
+	R visitCallStatic(C context, CallStaticExpression expression);
22 22
 	
23
-	public R visitCapturedClosure(C context, CapturedClosureExpression expression);
23
+	R visitCapturedClosure(C context, CapturedClosureExpression expression);
24 24
 	
25
-	public R visitCapturedDirect(C context, CapturedDirectExpression expression);
25
+	R visitCapturedDirect(C context, CapturedDirectExpression expression);
26 26
 	
27
-	public R visitCapturedLocalVariable(C context, CapturedLocalVariableExpression expression);
27
+	R visitCapturedLocalVariable(C context, CapturedLocalVariableExpression expression);
28 28
 	
29
-	public R visitCapturedParameter(C context, CapturedParameterExpression expression);
29
+	R visitCapturedParameter(C context, CapturedParameterExpression expression);
30 30
 	
31
-	public R visitCapturedThis(C context, CapturedThisExpression expression);
31
+	R visitCapturedThis(C context, CapturedThisExpression expression);
32 32
 	
33
-	public R visitCast(C context, CastExpression expression);
33
+	R visitCast(C context, CastExpression expression);
34 34
 	
35
-	public R visitCheckNull(C context, CheckNullExpression expression);
35
+	R visitCheckNull(C context, CheckNullExpression expression);
36 36
 	
37
-	public R visitCoalesce(C context, CoalesceExpression expression);
37
+	R visitCoalesce(C context, CoalesceExpression expression);
38 38
 	
39
-	public R visitConditional(C context, ConditionalExpression expression);
39
+	R visitConditional(C context, ConditionalExpression expression);
40 40
 	
41
-	public R visitConst(C context, ConstExpression expression);
41
+	R visitConst(C context, ConstExpression expression);
42 42
 	
43
-	public R visitConstantBool(C context, ConstantBoolExpression expression);
43
+	R visitConstantBool(C context, ConstantBoolExpression expression);
44 44
 	
45
-	public R visitConstantByte(C context, ConstantByteExpression expression);
45
+	R visitConstantByte(C context, ConstantByteExpression expression);
46 46
 	
47
-	public R visitConstantChar(C context, ConstantCharExpression expression);
47
+	R visitConstantChar(C context, ConstantCharExpression expression);
48 48
 	
49
-	public R visitConstantDouble(C context, ConstantDoubleExpression expression);
49
+	R visitConstantDouble(C context, ConstantDoubleExpression expression);
50 50
 	
51
-	public R visitConstantFloat(C context, ConstantFloatExpression expression);
51
+	R visitConstantFloat(C context, ConstantFloatExpression expression);
52 52
 	
53
-	public R visitConstantInt(C context, ConstantIntExpression expression);
54
-	
55
-	public R visitConstantLong(C context, ConstantLongExpression expression);
53
+	R visitConstantInt(C context, ConstantIntExpression expression);
54
+
55
+	R visitConstantLong(C context, ConstantLongExpression expression);
56 56
 	
57
-	public R visitConstantSByte(C context, ConstantSByteExpression expression);
57
+	R visitConstantSByte(C context, ConstantSByteExpression expression);
58 58
 	
59
-	public R visitConstantShort(C context, ConstantShortExpression expression);
59
+	R visitConstantShort(C context, ConstantShortExpression expression);
60 60
 	
61
-	public R visitConstantString(C context, ConstantStringExpression expression);
61
+	R visitConstantString(C context, ConstantStringExpression expression);
62 62
 	
63
-	public R visitConstantUInt(C context, ConstantUIntExpression expression);
63
+	R visitConstantUInt(C context, ConstantUIntExpression expression);
64 64
 	
65
-	public R visitConstantULong(C context, ConstantULongExpression expression);
65
+	R visitConstantULong(C context, ConstantULongExpression expression);
66 66
 	
67
-	public R visitConstantUShort(C context, ConstantUShortExpression expression);
67
+	R visitConstantUShort(C context, ConstantUShortExpression expression);
68 68
 	
69
-	public R visitConstantUSize(C context, ConstantUSizeExpression expression);
69
+	R visitConstantUSize(C context, ConstantUSizeExpression expression);
70 70
 	
71
-	public R visitConstructorThisCall(C context, ConstructorThisCallExpression expression);
71
+	R visitConstructorThisCall(C context, ConstructorThisCallExpression expression);
72 72
 	
73
-	public R visitConstructorSuperCall(C context, ConstructorSuperCallExpression expression);
73
+	R visitConstructorSuperCall(C context, ConstructorSuperCallExpression expression);
74 74
 	
75
-	public R visitEnumConstant(C context, EnumConstantExpression expression);
75
+	R visitEnumConstant(C context, EnumConstantExpression expression);
76 76
 	
77
-	public R visitFunction(C context, FunctionExpression expression);
77
+	R visitFunction(C context, FunctionExpression expression);
78 78
 	
79
-	public R visitGetField(C context, GetFieldExpression expression);
79
+	R visitGetField(C context, GetFieldExpression expression);
80 80
 	
81
-	public R visitGetFunctionParameter(C context, GetFunctionParameterExpression expression);
81
+	R visitGetFunctionParameter(C context, GetFunctionParameterExpression expression);
82 82
 	
83
-	public R visitGetLocalVariable(C context, GetLocalVariableExpression expression);
83
+	R visitGetLocalVariable(C context, GetLocalVariableExpression expression);
84 84
 	
85
-	public R visitGetMatchingVariantField(C context, GetMatchingVariantField expression);
85
+	R visitGetMatchingVariantField(C context, GetMatchingVariantField expression);
86 86
 	
87
-	public R visitGetStaticField(C context, GetStaticFieldExpression expression);
87
+	R visitGetStaticField(C context, GetStaticFieldExpression expression);
88 88
 	
89
-	public R visitGetter(C context, GetterExpression expression);
89
+	R visitGetter(C context, GetterExpression expression);
90 90
 	
91
-	public R visitGlobal(C context, GlobalExpression expression);
91
+	R visitGlobal(C context, GlobalExpression expression);
92 92
 	
93
-	public R visitGlobalCall(C context, GlobalCallExpression expression);
93
+	R visitGlobalCall(C context, GlobalCallExpression expression);
94 94
 	
95
-	public R visitInterfaceCast(C context, InterfaceCastExpression expression);
95
+	R visitInterfaceCast(C context, InterfaceCastExpression expression);
96 96
 	
97
-	public R visitInvalid(C context, InvalidExpression expression);
97
+	R visitInvalid(C context, InvalidExpression expression);
98 98
 	
99
-	public R visitIs(C context, IsExpression expression);
99
+	R visitIs(C context, IsExpression expression);
100 100
 	
101
-	public R visitMakeConst(C context, MakeConstExpression expression);
101
+	R visitMakeConst(C context, MakeConstExpression expression);
102 102
 	
103
-	public R visitMap(C context, MapExpression expression);
103
+	R visitMap(C context, MapExpression expression);
104 104
 	
105
-	public R visitMatch(C context, MatchExpression expression);
105
+	R visitMatch(C context, MatchExpression expression);
106 106
 	
107
-	public R visitNew(C context, NewExpression expression);
107
+	R visitNew(C context, NewExpression expression);
108 108
 	
109
-	public R visitNull(C context, NullExpression expression);
109
+	R visitNull(C context, NullExpression expression);
110 110
 	
111
-	public R visitOrOr(C context, OrOrExpression expression);
111
+	R visitOrOr(C context, OrOrExpression expression);
112 112
 	
113
-	public R visitPanic(C context, PanicExpression expression);
113
+	R visitPanic(C context, PanicExpression expression);
114 114
 	
115
-	public R visitPostCall(C context, PostCallExpression expression);
115
+	R visitPostCall(C context, PostCallExpression expression);
116 116
 	
117
-	public R visitRange(C context, RangeExpression expression);
117
+	R visitRange(C context, RangeExpression expression);
118 118
 	
119
-	public R visitSameObject(C context, SameObjectExpression expression);
119
+	R visitSameObject(C context, SameObjectExpression expression);
120 120
 	
121
-	public R visitSetField(C context, SetFieldExpression expression);
121
+	R visitSetField(C context, SetFieldExpression expression);
122 122
 	
123
-	public R visitSetFunctionParameter(C context, SetFunctionParameterExpression expression);
123
+	R visitSetFunctionParameter(C context, SetFunctionParameterExpression expression);
124 124
 	
125
-	public R visitSetLocalVariable(C context, SetLocalVariableExpression expression);
125
+	R visitSetLocalVariable(C context, SetLocalVariableExpression expression);
126 126
 	
127
-	public R visitSetStaticField(C context, SetStaticFieldExpression expression);
127
+	R visitSetStaticField(C context, SetStaticFieldExpression expression);
128 128
 	
129
-	public R visitSetter(C context, SetterExpression expression);
129
+	R visitSetter(C context, SetterExpression expression);
130 130
 	
131
-	public R visitStaticGetter(C context, StaticGetterExpression expression);
131
+	R visitStaticGetter(C context, StaticGetterExpression expression);
132 132
 	
133
-	public R visitStaticSetter(C context, StaticSetterExpression expression);
133
+	R visitStaticSetter(C context, StaticSetterExpression expression);
134 134
 	
135
-	public R visitStorageCast(C context, StorageCastExpression expression);
135
+	R visitStorageCast(C context, StorageCastExpression expression);
136 136
 	
137
-	public R visitSupertypeCast(C context, SupertypeCastExpression expression);
137
+	R visitSupertypeCast(C context, SupertypeCastExpression expression);
138 138
 	
139
-	public R visitThis(C context, ThisExpression expression);
139
+	R visitThis(C context, ThisExpression expression);
140 140
 	
141
-	public R visitThrow(C context, ThrowExpression expression);
141
+	R visitThrow(C context, ThrowExpression expression);
142 142
 	
143
-	public R visitTryConvert(C context, TryConvertExpression expression);
143
+	R visitTryConvert(C context, TryConvertExpression expression);
144 144
 	
145
-	public R visitTryRethrowAsException(C context, TryRethrowAsExceptionExpression expression);
145
+	R visitTryRethrowAsException(C context, TryRethrowAsExceptionExpression expression);
146 146
 	
147
-	public R visitTryRethrowAsResult(C context, TryRethrowAsResultExpression expression);
147
+	R visitTryRethrowAsResult(C context, TryRethrowAsResultExpression expression);
148 148
 	
149
-	public R visitVariantValue(C context, VariantValueExpression expression);
149
+	R visitVariantValue(C context, VariantValueExpression expression);
150 150
 	
151
-	public R visitWrapOptional(C context, WrapOptionalExpression expression);
151
+	R visitWrapOptional(C context, WrapOptionalExpression expression);
152 152
 }

+ 0
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/FunctionExpression.java Ver fichero

@@ -17,7 +17,6 @@ import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
17 17
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
18 18
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
19 19
 import org.openzen.zenscript.codemodel.statement.Statement;
20
-import org.openzen.zenscript.codemodel.type.FunctionTypeID;
21 20
 import org.openzen.zenscript.codemodel.type.StoredType;
22 21
 
23 22
 /**

+ 1
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetterExpression.java Ver fichero

@@ -9,7 +9,6 @@ import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zencode.shared.CompileException;
10 10
 import org.openzen.zenscript.codemodel.member.ref.GetterMemberRef;
11 11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
12
-import org.openzen.zenscript.codemodel.type.member.TypeMembers;
13 12
 
14 13
 /**
15 14
  *
@@ -50,7 +49,7 @@ public class GetterExpression extends Expression {
50 49
 	@Override
51 50
 	public Expression assign(CodePosition position, TypeScope scope, Expression value) throws CompileException {
52 51
 		return scope.getTypeMembers(getter.getOwnerType())
53
-				.getOrCreateGroup(getter.member.name, false)
52
+				.getGroup(getter.member.name)
54 53
 				.setter(position, scope, target, value, false);
55 54
 	}
56 55
 }

+ 0
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NewExpression.java Ver fichero

@@ -10,7 +10,6 @@ import org.openzen.zenscript.codemodel.FunctionHeader;
10 10
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
11 11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
12 12
 import org.openzen.zenscript.codemodel.type.StoredType;
13
-import org.openzen.zenscript.codemodel.type.member.BuiltinID;
14 13
 
15 14
 /**
16 15
  *

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/switchvalue/SwitchValue.java Ver fichero

@@ -10,7 +10,7 @@ package org.openzen.zenscript.codemodel.expression.switchvalue;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface SwitchValue {
13
-	public <T> T accept(SwitchValueVisitor<T> visitor);
13
+	<T> T accept(SwitchValueVisitor<T> visitor);
14 14
 	
15
-	public <C, R> R accept(C context, SwitchValueVisitorWithContext<C, R> visitor);
15
+	<C, R> R accept(C context, SwitchValueVisitorWithContext<C, R> visitor);
16 16
 }

+ 5
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/switchvalue/SwitchValueVisitor.java Ver fichero

@@ -10,13 +10,13 @@ package org.openzen.zenscript.codemodel.expression.switchvalue;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface SwitchValueVisitor <T> {
13
-	public T acceptInt(IntSwitchValue value);
13
+	T acceptInt(IntSwitchValue value);
14 14
 	
15
-	public T acceptChar(CharSwitchValue value);
15
+	T acceptChar(CharSwitchValue value);
16 16
 	
17
-	public T acceptString(StringSwitchValue value);
17
+	T acceptString(StringSwitchValue value);
18 18
 	
19
-	public T acceptEnumConstant(EnumConstantSwitchValue value);
19
+	T acceptEnumConstant(EnumConstantSwitchValue value);
20 20
 	
21
-	public T acceptVariantOption(VariantOptionSwitchValue value);
21
+	T acceptVariantOption(VariantOptionSwitchValue value);
22 22
 }

+ 5
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/switchvalue/SwitchValueVisitorWithContext.java Ver fichero

@@ -10,13 +10,13 @@ package org.openzen.zenscript.codemodel.expression.switchvalue;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface SwitchValueVisitorWithContext <C, R> {
13
-	public R acceptInt(C context, IntSwitchValue value);
13
+	R acceptInt(C context, IntSwitchValue value);
14 14
 	
15
-	public R acceptChar(C context, CharSwitchValue value);
15
+	R acceptChar(C context, CharSwitchValue value);
16 16
 	
17
-	public R acceptString(C context, StringSwitchValue value);
17
+	R acceptString(C context, StringSwitchValue value);
18 18
 	
19
-	public R acceptEnumConstant(C context, EnumConstantSwitchValue value);
19
+	R acceptEnumConstant(C context, EnumConstantSwitchValue value);
20 20
 	
21
-	public R acceptVariantOption(C context, VariantOptionSwitchValue value);
21
+	R acceptVariantOption(C context, VariantOptionSwitchValue value);
22 22
 }

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/GenericParameterBoundVisitor.java Ver fichero

@@ -10,7 +10,7 @@ package org.openzen.zenscript.codemodel.generic;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface GenericParameterBoundVisitor<T> {
13
-	public T visitSuper(ParameterSuperBound bound);
13
+	T visitSuper(ParameterSuperBound bound);
14 14
 	
15
-	public T visitType(ParameterTypeBound bound);
15
+	T visitType(ParameterTypeBound bound);
16 16
 }

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/GenericParameterBoundVisitorWithContext.java Ver fichero

@@ -10,7 +10,7 @@ package org.openzen.zenscript.codemodel.generic;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface GenericParameterBoundVisitorWithContext<C, R> {
13
-	public R visitSuper(C context, ParameterSuperBound bound);
13
+	R visitSuper(C context, ParameterSuperBound bound);
14 14
 	
15
-	public R visitType(C context, ParameterTypeBound bound);
15
+	R visitType(C context, ParameterTypeBound bound);
16 16
 }

+ 1
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/ParameterSuperBound.java Ver fichero

@@ -15,7 +15,7 @@ import org.openzen.zenscript.codemodel.type.storage.BorrowStorageTag;
15 15
  *
16 16
  * @author Hoofdgebruiker
17 17
  */
18
-public class ParameterSuperBound extends TypeParameterBound {
18
+public final class ParameterSuperBound implements TypeParameterBound {
19 19
 	public final TypeID type;
20 20
 	
21 21
 	public ParameterSuperBound(TypeID type) {

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/ParameterTypeBound.java Ver fichero

@@ -17,7 +17,7 @@ import org.openzen.zenscript.codemodel.type.storage.BorrowStorageTag;
17 17
  *
18 18
  * @author Hoofdgebruiker
19 19
  */
20
-public class ParameterTypeBound extends TypeParameterBound {
20
+public final class ParameterTypeBound implements TypeParameterBound {
21 21
 	public final CodePosition position;
22 22
 	public final TypeID type;
23 23
 	
@@ -33,8 +33,8 @@ public class ParameterTypeBound extends TypeParameterBound {
33 33
 
34 34
 	@Override
35 35
 	public void registerMembers(LocalMemberCache cache, TypeMembers members) {
36
-		cache.get(this.type.stored(members.type.getSpecifiedStorage()))
37
-				.copyMembersTo(position, members, TypeMemberPriority.FROM_TYPE_BOUNDS);
36
+		cache.get(type.stored(members.type.getSpecifiedStorage()))
37
+				.copyMembersTo(members, TypeMemberPriority.FROM_TYPE_BOUNDS);
38 38
 	}
39 39
 
40 40
 	@Override

+ 2
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/TypeParameter.java Ver fichero

@@ -30,21 +30,15 @@ public class TypeParameter extends Taggable {
30 30
 		this.name = name;
31 31
 	}
32 32
 	
33
-	private TypeParameter(CodePosition position, String name, List<TypeParameterBound> bounds) {
34
-		this.position = position;
35
-		this.name = name;
36
-		bounds.addAll(bounds);
37
-	}
38
-	
39 33
 	public void addBound(TypeParameterBound bound) {
40 34
 		bounds.add(bound);
41 35
 	}
42
-	
36
+
43 37
 	public boolean isObjectType() {
44 38
 		for (TypeParameterBound bound : bounds)
45 39
 			if (bound.isObjectType())
46 40
 				return true;
47
-		
41
+
48 42
 		return false;
49 43
 	}
50 44
 	

+ 8
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/TypeParameterBound.java Ver fichero

@@ -14,18 +14,18 @@ import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
14 14
  *
15 15
  * @author Hoofdgebruiker
16 16
  */
17
-public abstract class TypeParameterBound {
18
-	public abstract boolean isObjectType();
17
+public interface TypeParameterBound {
18
+	boolean isObjectType();
19 19
 	
20
-	public abstract <T> T accept(GenericParameterBoundVisitor<T> visitor);
20
+	<T> T accept(GenericParameterBoundVisitor<T> visitor);
21 21
 	
22
-	public abstract <C, R> R accept(C context, GenericParameterBoundVisitorWithContext<C, R> visitor);
22
+	<C, R> R accept(C context, GenericParameterBoundVisitorWithContext<C, R> visitor);
23 23
 	
24
-	public abstract void registerMembers(LocalMemberCache cache, TypeMembers type);
24
+	void registerMembers(LocalMemberCache cache, TypeMembers type);
25 25
 	
26
-	public abstract boolean matches(LocalMemberCache cache, TypeID type);
26
+	boolean matches(LocalMemberCache cache, TypeID type);
27 27
 	
28
-	public abstract TypeParameterBound instance(GenericMapper mapper);
28
+	TypeParameterBound instance(GenericMapper mapper);
29 29
 	
30
-	public abstract String getCanonical();
30
+	String getCanonical();
31 31
 }

+ 0
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ConstructorMember.java Ver fichero

@@ -14,7 +14,6 @@ import org.openzen.zenscript.codemodel.definition.EnumDefinition;
14 14
 import org.openzen.zenscript.codemodel.expression.ConstructorSuperCallExpression;
15 15
 import org.openzen.zenscript.codemodel.expression.ConstructorThisCallExpression;
16 16
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
17
-import org.openzen.zenscript.codemodel.scope.TypeScope;
18 17
 import org.openzen.zenscript.codemodel.statement.BlockStatement;
19 18
 import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
20 19
 import org.openzen.zenscript.codemodel.type.BasicTypeID;

+ 0
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FieldMember.java Ver fichero

@@ -10,7 +10,6 @@ import org.openzen.zencode.shared.CodePosition;
10 10
 import org.openzen.zenscript.codemodel.FunctionHeader;
11 11
 import org.openzen.zenscript.codemodel.GenericMapper;
12 12
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
13
-import org.openzen.zenscript.codemodel.Modifiers;
14 13
 import org.openzen.zenscript.codemodel.expression.Expression;
15 14
 import org.openzen.zenscript.codemodel.expression.GetFieldExpression;
16 15
 import org.openzen.zenscript.codemodel.expression.GetFunctionParameterExpression;

+ 0
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/GetterMember.java Ver fichero

@@ -11,7 +11,6 @@ import org.openzen.zenscript.codemodel.FunctionHeader;
11 11
 import org.openzen.zenscript.codemodel.GenericMapper;
12 12
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
13 13
 import org.openzen.zenscript.codemodel.Modifiers;
14
-import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
15 14
 import org.openzen.zenscript.codemodel.member.ref.GetterMemberRef;
16 15
 import org.openzen.zenscript.codemodel.scope.TypeScope;
17 16
 import org.openzen.zenscript.codemodel.statement.LoopStatement;

+ 13
- 13
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/IDefinitionMember.java Ver fichero

@@ -24,35 +24,35 @@ import org.openzen.zenscript.codemodel.type.member.TypeMembers;
24 24
  * @author Hoofdgebruiker
25 25
  */
26 26
 public interface IDefinitionMember {
27
-	public CodePosition getPosition();
27
+	CodePosition getPosition();
28 28
 	
29
-	public int getSpecifiedModifiers();
29
+	int getSpecifiedModifiers();
30 30
 	
31
-	public int getEffectiveModifiers();
31
+	int getEffectiveModifiers();
32 32
 	
33
-	public MemberAnnotation[] getAnnotations();
33
+	MemberAnnotation[] getAnnotations();
34 34
 	
35
-	public HighLevelDefinition getDefinition();
35
+	HighLevelDefinition getDefinition();
36 36
 	
37
-	public String describe();
37
+	String describe();
38 38
 	
39
-	public BuiltinID getBuiltin();
39
+	BuiltinID getBuiltin();
40 40
 	
41
-	public void registerTo(TypeMembers type, TypeMemberPriority priority, GenericMapper mapper);
41
+	void registerTo(TypeMembers type, TypeMemberPriority priority, GenericMapper mapper);
42 42
 	
43
-	public <T> T accept(MemberVisitor<T> visitor);
43
+	<T> T accept(MemberVisitor<T> visitor);
44 44
 	
45
-	public <C, R> R accept(C context, MemberVisitorWithContext<C, R> visitor);
45
+	<C, R> R accept(C context, MemberVisitorWithContext<C, R> visitor);
46 46
 	
47
-	public <T extends Tag> T getTag(Class<T> tag);
47
+	<T extends Tag> T getTag(Class<T> tag);
48 48
 	
49
-	public <T extends Tag> void setTag(Class<T> tag, T value);
49
+	<T extends Tag> void setTag(Class<T> tag, T value);
50 50
 
51 51
 	<T extends Tag> boolean hasTag(Class<T> tag);
52 52
 	
53 53
 	DefinitionMemberRef getOverrides();
54 54
 
55
-	public void normalize(TypeScope scope);
55
+	void normalize(TypeScope scope);
56 56
 	
57 57
 	boolean isAbstract();
58 58
 	

+ 1
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ImplementationMember.java Ver fichero

@@ -45,7 +45,7 @@ public class ImplementationMember extends DefinitionMember {
45 45
 		members.addImplementation(new ImplementationMemberRef(this, members.type, instancedType.stored(members.type.getSpecifiedStorage())), priority);
46 46
 		
47 47
 		TypeMembers interfaceTypeMembers = members.getMemberCache().get(instancedType.stored(members.type.getActualStorage()));
48
-		interfaceTypeMembers.copyMembersTo(position, members, TypeMemberPriority.INTERFACE);
48
+		interfaceTypeMembers.copyMembersTo(members, TypeMemberPriority.INTERFACE);
49 49
 	}
50 50
 
51 51
 	@Override

+ 14
- 14
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/MemberVisitor.java Ver fichero

@@ -10,31 +10,31 @@ package org.openzen.zenscript.codemodel.member;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface MemberVisitor<T> {
13
-	public T visitConst(ConstMember member);
13
+	T visitConst(ConstMember member);
14 14
 	
15
-	public T visitField(FieldMember member);
15
+	T visitField(FieldMember member);
16 16
 	
17
-	public T visitConstructor(ConstructorMember member);
17
+	T visitConstructor(ConstructorMember member);
18 18
 	
19
-	public T visitDestructor(DestructorMember member);
19
+	T visitDestructor(DestructorMember member);
20 20
 	
21
-	public T visitMethod(MethodMember member);
21
+	T visitMethod(MethodMember member);
22 22
 	
23
-	public T visitGetter(GetterMember member);
23
+	T visitGetter(GetterMember member);
24 24
 	
25
-	public T visitSetter(SetterMember member);
25
+	T visitSetter(SetterMember member);
26 26
 	
27
-	public T visitOperator(OperatorMember member);
27
+	T visitOperator(OperatorMember member);
28 28
 	
29
-	public T visitCaster(CasterMember member);
29
+	T visitCaster(CasterMember member);
30 30
 	
31
-	public T visitCustomIterator(IteratorMember member);
31
+	T visitCustomIterator(IteratorMember member);
32 32
 	
33
-	public T visitCaller(CallerMember member);
33
+	T visitCaller(CallerMember member);
34 34
 	
35
-	public T visitImplementation(ImplementationMember member);
35
+	T visitImplementation(ImplementationMember member);
36 36
 	
37
-	public T visitInnerDefinition(InnerDefinitionMember member);
37
+	T visitInnerDefinition(InnerDefinitionMember member);
38 38
 	
39
-	public T visitStaticInitializer(StaticInitializerMember member);
39
+	T visitStaticInitializer(StaticInitializerMember member);
40 40
 }

+ 14
- 14
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/MemberVisitorWithContext.java Ver fichero

@@ -10,31 +10,31 @@ package org.openzen.zenscript.codemodel.member;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface MemberVisitorWithContext<C, R> {
13
-	public R visitConst(C context, ConstMember member);
13
+	R visitConst(C context, ConstMember member);
14 14
 	
15
-	public R visitField(C context, FieldMember member);
15
+	R visitField(C context, FieldMember member);
16 16
 	
17
-	public R visitConstructor(C context, ConstructorMember member);
17
+	R visitConstructor(C context, ConstructorMember member);
18 18
 	
19
-	public R visitDestructor(C context, DestructorMember member);
19
+	R visitDestructor(C context, DestructorMember member);
20 20
 	
21
-	public R visitMethod(C context, MethodMember member);
21
+	R visitMethod(C context, MethodMember member);
22 22
 	
23
-	public R visitGetter(C context, GetterMember member);
23
+	R visitGetter(C context, GetterMember member);
24 24
 	
25
-	public R visitSetter(C context, SetterMember member);
25
+	R visitSetter(C context, SetterMember member);
26 26
 	
27
-	public R visitOperator(C context, OperatorMember member);
27
+	R visitOperator(C context, OperatorMember member);
28 28
 	
29
-	public R visitCaster(C context, CasterMember member);
29
+	R visitCaster(C context, CasterMember member);
30 30
 	
31
-	public R visitIterator(C context, IteratorMember member);
31
+	R visitIterator(C context, IteratorMember member);
32 32
 	
33
-	public R visitCaller(C context, CallerMember member);
33
+	R visitCaller(C context, CallerMember member);
34 34
 	
35
-	public R visitImplementation(C context, ImplementationMember member);
35
+	R visitImplementation(C context, ImplementationMember member);
36 36
 	
37
-	public R visitInnerDefinition(C context, InnerDefinitionMember member);
37
+	R visitInnerDefinition(C context, InnerDefinitionMember member);
38 38
 	
39
-	public R visitStaticInitializer(C context, StaticInitializerMember member);
39
+	R visitStaticInitializer(C context, StaticInitializerMember member);
40 40
 }

+ 0
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialStaticMemberGroupExpression.java Ver fichero

@@ -26,12 +26,6 @@ import org.openzen.zenscript.codemodel.type.TypeID;
26 26
  * @author Hoofdgebruiker
27 27
  */
28 28
 public class PartialStaticMemberGroupExpression implements IPartialExpression {
29
-	public static PartialStaticMemberGroupExpression forMethod(CodePosition position, TypeScope scope, String name, TypeID target, FunctionalMemberRef method, StoredType[] typeArguments) {
30
-		TypeMemberGroup group = new TypeMemberGroup(true, name);
31
-		group.addMethod(method, TypeMemberPriority.SPECIFIED);
32
-		return new PartialStaticMemberGroupExpression(position, scope, target, group, typeArguments);
33
-	}
34
-	
35 29
 	private final CodePosition position;
36 30
 	private final TypeScope scope;
37 31
 	private final TypeID target;

+ 16
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialTypeExpression.java Ver fichero

@@ -5,6 +5,7 @@
5 5
  */
6 6
 package org.openzen.zenscript.codemodel.partial;
7 7
 
8
+import java.util.Collections;
8 9
 import java.util.List;
9 10
 import java.util.stream.Collectors;
10 11
 import org.openzen.zencode.shared.CodePosition;
@@ -20,6 +21,7 @@ import org.openzen.zenscript.codemodel.GenericName;
20 21
 import org.openzen.zenscript.codemodel.scope.TypeScope;
21 22
 import org.openzen.zenscript.codemodel.type.StoredType;
22 23
 import org.openzen.zenscript.codemodel.type.TypeID;
24
+import org.openzen.zenscript.codemodel.type.member.TypeMemberGroup;
23 25
 import org.openzen.zenscript.codemodel.type.storage.StaticExpressionStorageTag;
24 26
 
25 27
 /**
@@ -44,15 +46,19 @@ public class PartialTypeExpression implements IPartialExpression {
44 46
 
45 47
 	@Override
46 48
 	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) {
47
-		return scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CALL).predictCallTypes(position, scope, hints, arguments);
49
+		TypeMemberGroup group = scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CALL);
50
+		if (group == null)
51
+			return new List[0];
52
+
53
+		return group.predictCallTypes(position, scope, hints, arguments);
48 54
 	}
49 55
 	
50 56
 	@Override
51 57
 	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) {
52
-		return scope.getTypeMembers(type)
53
-				.getOrCreateGroup(OperatorType.CALL)
58
+		TypeMemberGroup group = scope.getTypeMembers(type).getGroup(OperatorType.CALL);
59
+		return group
54 60
 				.getMethodMembers().stream()
55
-				.filter(method -> method.member.getHeader().parameters.length == arguments && method.member.isStatic())
61
+				.filter(method -> method.member.getHeader().accepts(arguments) && method.member.isStatic())
56 62
 				.map(method -> method.member.getHeader())
57 63
 				.collect(Collectors.toList());
58 64
 	}
@@ -66,8 +72,12 @@ public class PartialTypeExpression implements IPartialExpression {
66 72
 	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException {
67 73
 		if (arguments.getNumberOfTypeArguments() == 0 && (typeArguments != null && typeArguments.length > 0))
68 74
 			arguments = new CallArguments(typeArguments, arguments.arguments);
69
-		
70
-		return scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CALL).callStatic(position, type.type, scope, arguments);
75
+
76
+		TypeMemberGroup group = scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CALL);
77
+		if (group == null)
78
+			throw new CompileException(position, CompileExceptionCode.NO_SUCH_MEMBER, "This type has not call operator");
79
+
80
+		return group.callStatic(position, type.type, scope, arguments);
71 81
 	}
72 82
 
73 83
 	@Override

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/processor/InterfaceProcessor.java Ver fichero

@@ -13,7 +13,7 @@ import org.openzen.zenscript.codemodel.member.ImplementationMember;
13 13
  * @author Hoofdgebruiker
14 14
  */
15 15
 public interface InterfaceProcessor {
16
-	public void apply(ImplementationMember implementation);
16
+	void apply(ImplementationMember implementation);
17 17
 
18
-	public void applyOnSubclass(HighLevelDefinition definition, ImplementationMember implementation);
18
+	void applyOnSubclass(HighLevelDefinition definition, ImplementationMember implementation);
19 19
 }

+ 1
- 17
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/DefinitionScope.java Ver fichero

@@ -10,7 +10,6 @@ import java.util.Arrays;
10 10
 import java.util.HashMap;
11 11
 import java.util.List;
12 12
 import java.util.Map;
13
-import java.util.function.Supplier;
14 13
 import org.openzen.zencode.shared.CodePosition;
15 14
 import org.openzen.zencode.shared.CompileException;
16 15
 import org.openzen.zencode.shared.CompileExceptionCode;
@@ -47,7 +46,6 @@ public class DefinitionScope extends BaseScope {
47 46
 	private final StoredType type;
48 47
 	private final TypeMembers members;
49 48
 	private final TypeParameter[] typeParameters;
50
-	private final Map<String, Supplier<HighLevelDefinition>> innerTypes = new HashMap<>();
51 49
 	private final GenericMapper typeParameterMap;
52 50
 	
53 51
 	public DefinitionScope(BaseScope outer, HighLevelDefinition definition) {
@@ -82,10 +80,6 @@ public class DefinitionScope extends BaseScope {
82 80
 		typeParameterMap = outer.getLocalTypeParameters().getInner(definition.position, getTypeRegistry(), typeParameters);
83 81
 	}
84 82
 	
85
-	public void addInnerType(String name, Supplier<HighLevelDefinition> innerType) {
86
-		innerTypes.put(name, innerType);
87
-	}
88
-	
89 83
 	@Override
90 84
 	public ZSPackage getRootPackage() {
91 85
 		return outer.getRootPackage();
@@ -103,8 +97,6 @@ public class DefinitionScope extends BaseScope {
103 97
 				return new PartialTypeExpression(position, members.getInnerType(position, name), name.arguments);
104 98
 			if (members.hasMember(name.name) && !name.hasArguments())
105 99
 				return members.getMemberExpression(position, this, new ThisExpression(position, type), name, true);
106
-		} else if (innerTypes.containsKey(name.name)) {
107
-			return new PartialTypeExpression(position, getTypeRegistry().getForDefinition(innerTypes.get(name).get(), name.arguments), name.arguments);
108 100
 		}
109 101
 		if (!name.hasArguments()) {
110 102
 			for (TypeParameter parameter : typeParameters)
@@ -129,15 +121,7 @@ public class DefinitionScope extends BaseScope {
129 121
 			for (TypeParameter parameter : typeParameters)
130 122
 				if (parameter.name.equals(name.get(0).name))
131 123
 					return getTypeRegistry().getGeneric(parameter);
132
-		
133
-		if (innerTypes.containsKey(name.get(0).name)) {
134
-			TypeID result = getTypeRegistry().getForDefinition(innerTypes.get(name.get(0).name).get(), name.get(0).arguments);
135
-			for (int i = 1; i < name.size(); i++) {
136
-				result = getTypeMembers(result.stored(StaticExpressionStorageTag.INSTANCE)).getInnerType(position, name.get(i));
137
-			}
138
-			return result;
139
-		}
140
-		
124
+
141 125
 		return outer.getType(position, name);
142 126
 	}
143 127
 

+ 1
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/ExpressionScope.java Ver fichero

@@ -42,7 +42,7 @@ public class ExpressionScope extends BaseScope {
42 42
 	
43 43
 	public final List<StoredType> hints;
44 44
 	public final Map<TypeParameter, StoredType> genericInferenceMap;
45
-	public final Map<String, Function<CodePosition, Expression>> innerVariables = new HashMap<>();
45
+	private final Map<String, Function<CodePosition, Expression>> innerVariables = new HashMap<>();
46 46
 	
47 47
 	public ExpressionScope(BaseScope outer) {
48 48
 		this.outer = outer;
@@ -78,10 +78,6 @@ public class ExpressionScope extends BaseScope {
78 78
 		this.innerVariables.putAll(innerVariables);
79 79
 	}
80 80
 	
81
-	public void addInnerVariable(VarStatement variable) {
82
-		innerVariables.put(variable.name, position -> new GetLocalVariableExpression(position, variable));
83
-	}
84
-	
85 81
 	public void addMatchingVariantOption(String name, int index, VariantOptionSwitchValue value) {
86 82
 		innerVariables.put(name, position -> new GetMatchingVariantField(position, value, index));
87 83
 	}

+ 0
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/FunctionScope.java Ver fichero

@@ -125,11 +125,6 @@ public class FunctionScope extends StatementScope {
125 125
 	@Override
126 126
 	public DollarEvaluator getDollar() {
127 127
 		return dollar;
128
-		/*for (FunctionParameter parameter : header.parameters)
129
-			if (parameter.name.equals("$"))
130
-				return position -> new GetFunctionParameterExpression(position, parameter);
131
-		
132
-		return null;*/
133 128
 	}
134 129
 	
135 130
 	@Override

+ 1
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/GlobalScriptScope.java Ver fichero

@@ -78,7 +78,7 @@ public class GlobalScriptScope extends StatementScope {
78 78
 
79 79
 	@Override
80 80
 	public DollarEvaluator getDollar() {
81
-		return null; // script arguments?
81
+		return null;
82 82
 	}
83 83
 
84 84
 	@Override

+ 0
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/LambdaScope.java Ver fichero

@@ -14,7 +14,6 @@ import org.openzen.zenscript.codemodel.FunctionHeader;
14 14
 import org.openzen.zenscript.codemodel.FunctionParameter;
15 15
 import org.openzen.zenscript.codemodel.GenericMapper;
16 16
 import org.openzen.zenscript.codemodel.expression.GetFunctionParameterExpression;
17
-import org.openzen.zenscript.codemodel.expression.InvalidExpression;
18 17
 import org.openzen.zenscript.codemodel.expression.LambdaClosure;
19 18
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
20 19
 import org.openzen.zenscript.codemodel.statement.LoopStatement;

+ 15
- 15
CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/StatementVisitor.java Ver fichero

@@ -10,37 +10,37 @@ package org.openzen.zenscript.codemodel.statement;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface StatementVisitor<T> {
13
-	public T visitBlock(BlockStatement statement);
13
+	T visitBlock(BlockStatement statement);
14 14
 	
15
-	public T visitBreak(BreakStatement statement);
15
+	T visitBreak(BreakStatement statement);
16 16
 	
17
-	public T visitContinue(ContinueStatement statement);
17
+	T visitContinue(ContinueStatement statement);
18 18
 	
19
-	public T visitDoWhile(DoWhileStatement statement);
19
+	T visitDoWhile(DoWhileStatement statement);
20 20
 	
21
-	public T visitEmpty(EmptyStatement statement);
21
+	T visitEmpty(EmptyStatement statement);
22 22
 	
23
-	public T visitExpression(ExpressionStatement statement);
23
+	T visitExpression(ExpressionStatement statement);
24 24
 	
25
-	public T visitForeach(ForeachStatement statement);
25
+	T visitForeach(ForeachStatement statement);
26 26
 	
27
-	public T visitIf(IfStatement statement);
27
+	T visitIf(IfStatement statement);
28 28
 	
29 29
 	default T visitInvalid(InvalidStatement statement) {
30 30
 		throw new UnsupportedOperationException("Invalid statement");
31 31
 	}
32 32
 	
33
-	public T visitLock(LockStatement statement);
33
+	T visitLock(LockStatement statement);
34 34
 	
35
-	public T visitReturn(ReturnStatement statement);
35
+	T visitReturn(ReturnStatement statement);
36 36
 	
37
-	public T visitSwitch(SwitchStatement statement);
37
+	T visitSwitch(SwitchStatement statement);
38 38
 	
39
-	public T visitThrow(ThrowStatement statement);
39
+	T visitThrow(ThrowStatement statement);
40 40
 	
41
-	public T visitTryCatch(TryCatchStatement statement);
41
+	T visitTryCatch(TryCatchStatement statement);
42 42
 	
43
-	public T visitVar(VarStatement statement);
43
+	T visitVar(VarStatement statement);
44 44
 	
45
-	public T visitWhile(WhileStatement statement);
45
+	T visitWhile(WhileStatement statement);
46 46
 }

+ 15
- 15
CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/StatementVisitorWithContext.java Ver fichero

@@ -10,37 +10,37 @@ package org.openzen.zenscript.codemodel.statement;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface StatementVisitorWithContext<C, R> {
13
-	public R visitBlock(C context, BlockStatement statement);
13
+	R visitBlock(C context, BlockStatement statement);
14 14
 	
15
-	public R visitBreak(C context, BreakStatement statement);
15
+	R visitBreak(C context, BreakStatement statement);
16 16
 	
17
-	public R visitContinue(C context, ContinueStatement statement);
17
+	R visitContinue(C context, ContinueStatement statement);
18 18
 	
19
-	public R visitDoWhile(C context, DoWhileStatement statement);
19
+	R visitDoWhile(C context, DoWhileStatement statement);
20 20
 	
21
-	public R visitEmpty(C context, EmptyStatement statement);
21
+	R visitEmpty(C context, EmptyStatement statement);
22 22
 	
23
-	public R visitExpression(C context, ExpressionStatement statement);
23
+	R visitExpression(C context, ExpressionStatement statement);
24 24
 	
25
-	public R visitForeach(C context, ForeachStatement statement);
25
+	R visitForeach(C context, ForeachStatement statement);
26 26
 	
27
-	public R visitIf(C context, IfStatement statement);
27
+	R visitIf(C context, IfStatement statement);
28 28
 	
29 29
 	default R visitInvalid(C context, InvalidStatement statement) {
30 30
 		throw new UnsupportedOperationException("Invalid statement");
31 31
 	}
32 32
 	
33
-	public R visitLock(C context, LockStatement statement);
33
+	R visitLock(C context, LockStatement statement);
34 34
 	
35
-	public R visitReturn(C context, ReturnStatement statement);
35
+	R visitReturn(C context, ReturnStatement statement);
36 36
 	
37
-	public R visitSwitch(C context, SwitchStatement statement);
37
+	R visitSwitch(C context, SwitchStatement statement);
38 38
 	
39
-	public R visitThrow(C context, ThrowStatement statement);
39
+	R visitThrow(C context, ThrowStatement statement);
40 40
 	
41
-	public R visitTryCatch(C context, TryCatchStatement statement);
41
+	R visitTryCatch(C context, TryCatchStatement statement);
42 42
 	
43
-	public R visitVar(C context, VarStatement statement);
43
+	R visitVar(C context, VarStatement statement);
44 44
 	
45
-	public R visitWhile(C context, WhileStatement statement);
45
+	R visitWhile(C context, WhileStatement statement);
46 46
 }

+ 1
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/AssocTypeID.java Ver fichero

@@ -115,11 +115,6 @@ public class AssocTypeID implements TypeID {
115 115
 	
116 116
 	@Override
117 117
 	public String toString() {
118
-		StringBuilder result = new StringBuilder();
119
-		result.append(valueType.toString());
120
-		result.append('[');
121
-		result.append(keyType.toString());
122
-		result.append(']');
123
-		return result.toString();
118
+		return valueType.toString() + '[' + keyType.toString() + ']';
124 119
 	}
125 120
 }

+ 0
- 7
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/DefinitionTypeID.java Ver fichero

@@ -26,13 +26,6 @@ import org.openzen.zenscript.codemodel.type.storage.StorageTag;
26 26
  * @author Hoofdgebruiker
27 27
  */
28 28
 public class DefinitionTypeID implements TypeID {
29
-	public static DefinitionTypeID forType(GlobalTypeRegistry registry, HighLevelDefinition definition) {
30
-		if (definition.typeParameters != null && definition.typeParameters.length > 0)
31
-			throw new IllegalArgumentException("Definition has type arguments!");
32
-		
33
-		return new DefinitionTypeID(registry, definition, StoredType.NONE);
34
-	}
35
-	
36 29
 	public final HighLevelDefinition definition;
37 30
 	public final StoredType[] typeArguments;
38 31
 	public final DefinitionTypeID outer;

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/ISymbol.java Ver fichero

@@ -15,7 +15,7 @@ import org.openzen.zenscript.codemodel.scope.BaseScope;
15 15
  * @author Hoofdgebruiker
16 16
  */
17 17
 public interface ISymbol {
18
-	public IPartialExpression getExpression(CodePosition position, BaseScope scope, StoredType[] typeArguments);
18
+	IPartialExpression getExpression(CodePosition position, BaseScope scope, StoredType[] typeArguments);
19 19
 	
20
-	public TypeID getType(CodePosition position, TypeResolutionContext context, StoredType[] typeArguments);
20
+	TypeID getType(CodePosition position, TypeResolutionContext context, StoredType[] typeArguments);
21 21
 }

+ 1
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/OptionalTypeID.java Ver fichero

@@ -20,11 +20,9 @@ import org.openzen.zenscript.codemodel.type.storage.StorageTag;
20 20
 public class OptionalTypeID implements TypeID {
21 21
 	public final TypeID baseType;
22 22
 	private final TypeID normalized;
23
-	private final GlobalTypeRegistry registry;
24 23
 	
25 24
 	public OptionalTypeID(GlobalTypeRegistry registry, TypeID baseType) {
26 25
 		this.baseType = baseType;
27
-		this.registry = registry;
28 26
 		
29 27
 		normalized = baseType.getNormalized() == baseType ? this : registry.getOptional(baseType.getNormalized());
30 28
 	}
@@ -116,9 +114,6 @@ public class OptionalTypeID implements TypeID {
116 114
 	
117 115
 	@Override
118 116
 	public String toString(StorageTag storage) {
119
-		StringBuilder result = new StringBuilder();
120
-		result.append(baseType.toString(storage));
121
-		result.append("?");
122
-		return result.toString();
117
+		return baseType.toString(storage) + '?';
123 118
 	}
124 119
 }

+ 1
- 158
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/StoredType.java Ver fichero

@@ -9,7 +9,6 @@ import java.util.HashMap;
9 9
 import java.util.Map;
10 10
 import java.util.Objects;
11 11
 import java.util.Set;
12
-import org.openzen.zencode.shared.CodePosition;
13 12
 import org.openzen.zenscript.codemodel.GenericMapper;
14 13
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
15 14
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
@@ -127,11 +126,7 @@ public class StoredType {
127 126
 	public boolean isEnum() {
128 127
 		return type.isEnum();
129 128
 	}
130
-	
131
-	public boolean isDefinition(HighLevelDefinition definition) {
132
-		return type.isDefinition(definition);
133
-	}
134
-	
129
+
135 130
 	public DefinitionTypeID asDefinition() {
136 131
 		return (DefinitionTypeID)type;
137 132
 	}
@@ -160,156 +155,4 @@ public class StoredType {
160 155
 	public String toString() {
161 156
 		return storage == null ? type.toString() : type.toString(storage);
162 157
 	}
163
-	
164
-	public static class MatchingTypeVisitor implements TypeVisitor<Boolean> {
165
-		private final TypeID type;
166
-		private final Map<TypeParameter, StoredType> mapping;
167
-		private final LocalMemberCache cache;
168
-		
169
-		public MatchingTypeVisitor(LocalMemberCache cache, TypeID type, Map<TypeParameter, StoredType> mapping) {
170
-			this.type = type;
171
-			this.mapping = mapping;
172
-			this.cache = cache;
173
-		}
174
-
175
-		@Override
176
-		public Boolean visitBasic(BasicTypeID basic) {
177
-			return basic == type;
178
-		}
179
-		
180
-		@Override
181
-		public Boolean visitString(StringTypeID string) {
182
-			return string == type;
183
-		}
184
-
185
-		@Override
186
-		public Boolean visitArray(ArrayTypeID array) {
187
-			if (type instanceof ArrayTypeID) {
188
-				ArrayTypeID arrayType = (ArrayTypeID) type;
189
-				if (arrayType.dimension != array.dimension)
190
-					return false;
191
-				
192
-				return match(arrayType.elementType, array.elementType);
193
-			} else {
194
-				return false;
195
-			}
196
-		}
197
-
198
-		@Override
199
-		public Boolean visitAssoc(AssocTypeID assoc) {
200
-			if (type instanceof AssocTypeID) {
201
-				AssocTypeID assocType = (AssocTypeID) type;
202
-				return match(assocType.keyType, assoc.keyType)
203
-						&& match(assocType.valueType, assoc.valueType);
204
-			} else {
205
-				return false;
206
-			}
207
-		}
208
-		
209
-		@Override
210
-		public Boolean visitIterator(IteratorTypeID iterator) {
211
-			if (type instanceof IteratorTypeID) {
212
-				IteratorTypeID iteratorType = (IteratorTypeID) type;
213
-				if (iteratorType.iteratorTypes.length != iterator.iteratorTypes.length)
214
-					return false;
215
-				
216
-				boolean result = true;
217
-				for (int i = 0; i < iteratorType.iteratorTypes.length; i++)
218
-					result = result && match(iterator.iteratorTypes[i], iteratorType.iteratorTypes[i]);
219
-				
220
-				return result;
221
-			} else {
222
-				return false;
223
-			}
224
-		}
225
-
226
-		@Override
227
-		public Boolean visitFunction(FunctionTypeID function) {
228
-			if (type instanceof FunctionTypeID) {
229
-				FunctionTypeID functionType = (FunctionTypeID) type;
230
-				if (functionType.header.parameters.length != function.header.parameters.length)
231
-					return false;
232
-				
233
-				if (!match(functionType.header.getReturnType(), function.header.getReturnType()))
234
-					return false;
235
-				
236
-				for (int i = 0; i < function.header.parameters.length; i++) {
237
-					if (!match(functionType.header.parameters[i].type, function.header.parameters[i].type))
238
-						return false;
239
-				}
240
-				
241
-				return true;
242
-			} else {
243
-				return false;
244
-			}
245
-		}
246
-
247
-		@Override
248
-		public Boolean visitDefinition(DefinitionTypeID definition) {
249
-			if (type instanceof DefinitionTypeID) {
250
-				DefinitionTypeID definitionType = (DefinitionTypeID) type;
251
-				if (definitionType.definition != definition.definition)
252
-					return false;
253
-				
254
-				if (definition.typeArguments != null) {
255
-					for (int i = 0; i < definitionType.typeArguments.length; i++) {
256
-						if (!match(definitionType.typeArguments[i], definition.typeArguments[i]))
257
-							return false;
258
-					}
259
-				}
260
-				
261
-				return true;
262
-			} else {
263
-				return false;
264
-			}
265
-		}
266
-
267
-		@Override
268
-		public Boolean visitGeneric(GenericTypeID generic) {
269
-			if (mapping.containsKey(generic.parameter)) {
270
-				return mapping.get(generic.parameter) == type;
271
-			} else if (type == generic || generic.matches(cache, type.stored())) {
272
-				mapping.put(generic.parameter, type.stored());
273
-				return true;
274
-			} else {
275
-				return false;
276
-			}
277
-		}
278
-
279
-		@Override
280
-		public Boolean visitRange(RangeTypeID range) {
281
-			if (type instanceof RangeTypeID) {
282
-				RangeTypeID rangeType = (RangeTypeID) type;
283
-				return match(rangeType.baseType, range.baseType);
284
-			} else {
285
-				return false;
286
-			}
287
-		}
288
-
289
-		@Override
290
-		public Boolean visitOptional(OptionalTypeID type) {
291
-			if (this.type instanceof OptionalTypeID) {
292
-				OptionalTypeID constType = (OptionalTypeID) this.type;
293
-				return match(constType.baseType, type.baseType.stored());
294
-			} else {
295
-				return false;
296
-			}
297
-		}
298
-		
299
-		private boolean match(StoredType type, StoredType pattern) {
300
-			if (pattern.storage != null && type.storage != pattern.storage)
301
-				return false;
302
-			
303
-			return TypeMatcher.match(cache, type, pattern) != null;
304
-		}
305
-		
306
-		private boolean match(TypeID type, StoredType pattern) {
307
-			return TypeMatcher.match(cache, type.stored(), pattern) != null;
308
-		}
309
-
310
-		@Override
311
-		public Boolean visitGenericMap(GenericMapTypeID map) {
312
-			return map == type; // TODO: improve this
313
-		}
314
-	}
315 158
 }

+ 1
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeID.java Ver fichero

@@ -20,7 +20,7 @@ import org.openzen.zenscript.codemodel.type.storage.ValueStorageTag;
20 20
  * @author Hoofdgebruiker
21 21
  */
22 22
 public interface TypeID {
23
-	public static final TypeID[] NONE = new TypeID[0];
23
+	TypeID[] NONE = new TypeID[0];
24 24
 	
25 25
 	default TypeID getSuperType(GlobalTypeRegistry registry) {
26 26
 		return null;

+ 0
- 92
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeParameterCollector.java Ver fichero

@@ -1,92 +0,0 @@
1
-/*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
-package org.openzen.zenscript.codemodel.type;
7
-
8
-import java.util.Map;
9
-import org.openzen.zenscript.codemodel.FunctionParameter;
10
-import org.openzen.zenscript.codemodel.generic.TypeParameter;
11
-
12
-/**
13
- *
14
- * @author Hoofdgebruiker
15
- */
16
-public class TypeParameterCollector implements TypeVisitorWithContext<Map<TypeParameter, GenericTypeID>, Void, RuntimeException> {
17
-	private final Map<TypeParameter, GenericTypeID> map;
18
-	
19
-	public TypeParameterCollector(Map<TypeParameter, GenericTypeID> map) {
20
-		this.map = map;
21
-	}
22
-
23
-	@Override
24
-	public Void visitBasic(Map<TypeParameter, GenericTypeID> context, BasicTypeID basic) {
25
-		return null;
26
-	}
27
-	
28
-	@Override
29
-	public Void visitString(Map<TypeParameter, GenericTypeID> context, StringTypeID string) {
30
-		return null;
31
-	}
32
-
33
-	@Override
34
-	public Void visitArray(Map<TypeParameter, GenericTypeID> context, ArrayTypeID array) {
35
-		array.elementType.type.accept(context, this);
36
-		return null;
37
-	}
38
-
39
-	@Override
40
-	public Void visitAssoc(Map<TypeParameter, GenericTypeID> context, AssocTypeID assoc) {
41
-		assoc.keyType.type.accept(context, this);
42
-		assoc.valueType.type.accept(context, this);
43
-		return null;
44
-	}
45
-
46
-	@Override
47
-	public Void visitGenericMap(Map<TypeParameter, GenericTypeID> context, GenericMapTypeID map) {
48
-		return null;
49
-	}
50
-
51
-	@Override
52
-	public Void visitIterator(Map<TypeParameter, GenericTypeID> context, IteratorTypeID iterator) {
53
-		for (StoredType type : iterator.iteratorTypes)
54
-			type.type.accept(context, this);
55
-		return null;
56
-	}
57
-
58
-	@Override
59
-	public Void visitFunction(Map<TypeParameter, GenericTypeID> context, FunctionTypeID function) {
60
-		function.header.getReturnType().type.accept(context, this);
61
-		for (FunctionParameter parameter : function.header.parameters)
62
-			parameter.type.type.accept(context, this);
63
-		return null;
64
-	}
65
-
66
-	@Override
67
-	public Void visitDefinition(Map<TypeParameter, GenericTypeID> context, DefinitionTypeID definition) {
68
-		for (StoredType argument : definition.typeArguments)
69
-			argument.type.accept(context, this);
70
-		if (definition.outer != null)
71
-			visitDefinition(context, definition.outer);
72
-		return null;
73
-	}
74
-
75
-	@Override
76
-	public Void visitGeneric(Map<TypeParameter, GenericTypeID> context, GenericTypeID generic) {
77
-		map.put(generic.parameter, generic);
78
-		return null;
79
-	}
80
-
81
-	@Override
82
-	public Void visitRange(Map<TypeParameter, GenericTypeID> context, RangeTypeID range) {
83
-		range.baseType.type.accept(context, this);
84
-		return null;
85
-	}
86
-
87
-	@Override
88
-	public Void visitModified(Map<TypeParameter, GenericTypeID> context, OptionalTypeID type) {
89
-		type.baseType.accept(context, this);
90
-		return null;
91
-	}
92
-}

+ 12
- 12
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeVisitor.java Ver fichero

@@ -10,29 +10,29 @@ package org.openzen.zenscript.codemodel.type;
10 10
  * @author Hoofdgebruiker
11 11
  */
12 12
 public interface TypeVisitor<T> {
13
-	public T visitBasic(BasicTypeID basic);
13
+	T visitBasic(BasicTypeID basic);
14 14
 	
15
-	public T visitString(StringTypeID string);
15
+	T visitString(StringTypeID string);
16 16
 	
17
-	public T visitArray(ArrayTypeID array);
17
+	T visitArray(ArrayTypeID array);
18 18
 	
19
-	public T visitAssoc(AssocTypeID assoc);
19
+	T visitAssoc(AssocTypeID assoc);
20 20
 	
21
-	public T visitGenericMap(GenericMapTypeID map);
21
+	T visitGenericMap(GenericMapTypeID map);
22 22
 	
23
-	public T visitIterator(IteratorTypeID iterator);
23
+	T visitIterator(IteratorTypeID iterator);
24 24
 	
25
-	public T visitFunction(FunctionTypeID function);
25
+	T visitFunction(FunctionTypeID function);
26 26
 	
27
-	public T visitDefinition(DefinitionTypeID definition);
27
+	T visitDefinition(DefinitionTypeID definition);
28 28
 	
29
-	public T visitGeneric(GenericTypeID generic);
29
+	T visitGeneric(GenericTypeID generic);
30 30
 	
31
-	public T visitRange(RangeTypeID range);
31
+	T visitRange(RangeTypeID range);
32 32
 	
33
-	public T visitOptional(OptionalTypeID type);
33
+	T visitOptional(OptionalTypeID type);
34 34
 	
35
-	public default T visitInvalid(InvalidTypeID type) {
35
+	default T visitInvalid(InvalidTypeID type) {
36 36
 		throw new UnsupportedOperationException("Invalid type: " + type.message);
37 37
 	}
38 38
 }

+ 3
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMember.java Ver fichero

@@ -21,12 +21,9 @@ public class TypeMember<T extends DefinitionMemberRef> {
21 21
 	}
22 22
 	
23 23
 	public TypeMember<T> resolve(TypeMember<T> other) {
24
-		if (priority == other.priority) {
25
-			//if (priority == TypeMemberPriority.SPECIFIED)
26
-			//	throw new CompileException(other.member.getPosition(), CompileExceptionCode.MEMBER_DUPLICATE, "Duplicate " + other.member.describe());
27
-			return this;
28
-		}
29
-		
24
+		if (priority == other.priority)
25
+			return this; // this is actually an error; but that error will be reported through the validator
26
+
30 27
 		if (priority.compareTo(other.priority) < 0) {
31 28
 			return other;
32 29
 		} else {

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberBuilder.java Ver fichero

@@ -523,12 +523,12 @@ public class TypeMemberBuilder implements TypeVisitorWithContext<Void, Void, Run
523 523
 			InterfaceDefinition interfaceDefinition = (InterfaceDefinition)definition;
524 524
 			for (TypeID baseType : interfaceDefinition.baseInterfaces)
525 525
 				cache.get(baseType.instance(mapper, type.getSpecifiedStorage()))
526
-						.copyMembersTo(definitionType.definition.position, members, TypeMemberPriority.INHERITED);
526
+						.copyMembersTo(members, TypeMemberPriority.INHERITED);
527 527
 		}
528 528
 		
529 529
 		if (definitionType.superType != null) {
530 530
 			cache.get(definitionType.superType.stored(type.getSpecifiedStorage()))
531
-					.copyMembersTo(definitionType.definition.position, members, TypeMemberPriority.INHERITED);
531
+					.copyMembersTo(members, TypeMemberPriority.INHERITED);
532 532
 		} else {
533 533
 			getter(definition, OBJECT_HASHCODE, "objectHashCode", INT.stored);
534 534
 		}

+ 3
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberGroup.java Ver fichero

@@ -40,6 +40,8 @@ import org.openzen.zenscript.codemodel.type.TypeID;
40 40
  * @author Hoofdgebruiker
41 41
  */
42 42
 public class TypeMemberGroup {
43
+	public static final TypeMemberGroup EMPTY = new TypeMemberGroup(false, "");
44
+
43 45
 	public static TypeMemberGroup forMethod(String name, FunctionalMemberRef member) {
44 46
 		TypeMemberGroup instance = new TypeMemberGroup(member.isStatic(), name);
45 47
 		instance.addMethod(member, TypeMemberPriority.SPECIFIED);
@@ -59,7 +61,7 @@ public class TypeMemberGroup {
59 61
 		this.name = name;
60 62
 	}
61 63
 	
62
-	public void merge(CodePosition position, TypeMemberGroup other, TypeMemberPriority priority) {
64
+	public void merge(TypeMemberGroup other, TypeMemberPriority priority) {
63 65
 		if (other.constant != null)
64 66
 			setConst(other.constant.member, priority);
65 67
 		if (other.field != null)
@@ -198,9 +200,6 @@ public class TypeMemberGroup {
198 200
 			scope.getPreparer().prepare(setter.member.member);
199 201
 			return new SetterExpression(position, target, setter.member, value.castImplicit(position, scope, setter.member.getType()));
200 202
 		} else if (field != null) {
201
-			// TODO: perform proper checks on val fields
202
-			//if (field.isFinal)
203
-			//	throw new CompileException(position, "This field cannot be modified");
204 203
 			if (field.member.isStatic()) {
205 204
 				if (!allowStaticUsage)
206 205
 					return new InvalidExpression(position, field.member.getType(), CompileExceptionCode.USING_STATIC_ON_INSTANCE, "This field is static");
@@ -244,8 +243,6 @@ public class TypeMemberGroup {
244 243
 			scope.getPreparer().prepare(setter.member.member);
245 244
 			return new StaticSetterExpression(position, setter.member, value.castImplicit(position, scope, setter.member.getType()));
246 245
 		} else if (field != null) {
247
-			//if (field.member.isFinal)
248
-			//	throw new CompileException(position, CompileExceptionCode.MEMBER_IS_FINAL, "This field cannot be modified");
249 246
 			if (!field.member.isStatic())
250 247
 				return new InvalidExpression(position, field.member.getType(), CompileExceptionCode.MEMBER_NOT_STATIC, "This field is not static");
251 248
 

+ 9
- 16
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMembers.java Ver fichero

@@ -48,7 +48,6 @@ import org.openzen.zenscript.codemodel.GenericName;
48 48
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
49 49
 import org.openzen.zenscript.codemodel.scope.TypeScope;
50 50
 import org.openzen.zenscript.codemodel.type.StoredType;
51
-import org.openzen.zenscript.codemodel.type.StringTypeID;
52 51
 import org.openzen.zenscript.codemodel.type.TypeID;
53 52
 
54 53
 /**
@@ -120,7 +119,7 @@ public final class TypeMembers {
120 119
 		return cache.getRegistry();
121 120
 	}
122 121
 	
123
-	public void copyMembersTo(CodePosition position, TypeMembers other, TypeMemberPriority priority) {
122
+	public void copyMembersTo(TypeMembers other, TypeMemberPriority priority) {
124 123
 		other.casters.addAll(casters);
125 124
 		other.iterators.addAll(iterators);
126 125
 		
@@ -129,11 +128,11 @@ public final class TypeMembers {
129 128
 		for (Map.Entry<String, VariantOptionRef> entry : variantOptions.entrySet())
130 129
 			other.addVariantOption(entry.getValue());
131 130
 		for (Map.Entry<String, TypeMemberGroup> entry : members.entrySet())
132
-			other.getOrCreateGroup(entry.getKey(), entry.getValue().isStatic).merge(position, entry.getValue(), priority);
131
+			other.getOrCreateGroup(entry.getKey(), entry.getValue().isStatic).merge(entry.getValue(), priority);
133 132
 		for (Map.Entry<String, InnerDefinition> entry : innerTypes.entrySet())
134 133
 			other.innerTypes.put(entry.getKey(), entry.getValue());
135 134
 		for (Map.Entry<OperatorType, TypeMemberGroup> entry : operators.entrySet())
136
-			other.getOrCreateGroup(entry.getKey()).merge(position, entry.getValue(), priority);
135
+			other.getOrCreateGroup(entry.getKey()).merge(entry.getValue(), priority);
137 136
 	}
138 137
 	
139 138
 	public DefinitionMemberRef getBuiltin(BuiltinID builtin) {
@@ -256,28 +255,16 @@ public final class TypeMembers {
256 255
 		group.setField(member, priority);
257 256
 	}
258 257
 	
259
-	public void addGetter(GetterMemberRef member) throws CompileException {
260
-		addGetter(member, TypeMemberPriority.SPECIFIED);
261
-	}
262
-	
263 258
 	public void addGetter(GetterMemberRef member, TypeMemberPriority priority) {
264 259
 		TypeMemberGroup group = getOrCreateGroup(member.member.name, member.isStatic());
265 260
 		group.setGetter(member, priority);
266 261
 	}
267 262
 	
268
-	public void addSetter(SetterMemberRef member) throws CompileException {
269
-		addSetter(member, TypeMemberPriority.SPECIFIED);
270
-	}
271
-	
272 263
 	public void addSetter(SetterMemberRef member, TypeMemberPriority priority) {
273 264
 		TypeMemberGroup group = getOrCreateGroup(member.member.name, member.isStatic());
274 265
 		group.setSetter(member, priority);
275 266
 	}
276 267
 	
277
-	public void addMethod(String name, FunctionalMemberRef member) {
278
-		addMethod(name, member, TypeMemberPriority.SPECIFIED);
279
-	}
280
-	
281 268
 	public void addMethod(String name, FunctionalMemberRef member, TypeMemberPriority priority) {
282 269
 		TypeMemberGroup group = getOrCreateGroup(name, member.isStatic());
283 270
 		group.addMethod(member, priority);
@@ -334,6 +321,9 @@ public final class TypeMembers {
334 321
 	}
335 322
 	
336 323
 	public TypeMemberGroup getGroup(String name) {
324
+		if (!members.containsKey(name))
325
+			return new TypeMemberGroup(false, name);
326
+
337 327
 		return members.get(name);
338 328
 	}
339 329
 	
@@ -345,6 +335,9 @@ public final class TypeMembers {
345 335
 	}
346 336
 	
347 337
 	public TypeMemberGroup getGroup(OperatorType operator) {
338
+		if (!operators.containsKey(operator))
339
+			return new TypeMemberGroup(false, operator.operator + " operator");
340
+
348 341
 		return operators.get(operator);
349 342
 	}
350 343
 	

+ 1
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/storage/StorageType.java Ver fichero

@@ -12,7 +12,7 @@ import org.openzen.zencode.shared.CodePosition;
12 12
  * @author Hoofdgebruiker
13 13
  */
14 14
 public interface StorageType {
15
-	public static StorageType[] getStandard() {
15
+	static StorageType[] getStandard() {
16 16
 		return new StorageType[] {
17 17
 			AutoStorageType.INSTANCE,
18 18
 			BorrowStorageType.INSTANCE,

+ 16
- 0
Constructor/src/main/java/org/openzen/zenscript/constructor/ConstructorRegistry.java Ver fichero

@@ -6,6 +6,10 @@
6 6
 package org.openzen.zenscript.constructor;
7 7
 
8 8
 import java.io.File;
9
+import java.io.FileOutputStream;
10
+import java.io.IOException;
11
+import java.io.OutputStreamWriter;
12
+import java.nio.charset.StandardCharsets;
9 13
 import java.util.ArrayList;
10 14
 import java.util.HashMap;
11 15
 import java.util.List;
@@ -21,6 +25,7 @@ import org.openzen.zenscript.javabytecode.JavaBytecodeModule;
21 25
 import org.openzen.zenscript.javabytecode.JavaBytecodeRunUnit;
22 26
 import org.openzen.zenscript.javabytecode.JavaCompiler;
23 27
 import org.openzen.zenscript.javashared.JavaCompileSpace;
28
+import org.openzen.zenscript.javashared.JavaCompiledModule;
24 29
 import org.openzen.zenscript.javashared.SimpleJavaCompileSpace;
25 30
 import org.openzen.zenscript.javasource.JavaDirectoryOutput;
26 31
 import org.openzen.zenscript.javasource.JavaSourceCompiler;
@@ -112,6 +117,8 @@ public class ConstructorRegistry {
112 117
 		@Override
113 118
 		public void addModule(SemanticModule module) {
114 119
 			JavaSourceModule result = compiler.compile(module, space, module.modulePackage.fullName);
120
+			writeMappings(result);
121
+			
115 122
 			modules.add(result);
116 123
 			space.register(result);
117 124
 		}
@@ -128,6 +135,15 @@ public class ConstructorRegistry {
128 135
 		public void run() {
129 136
 			throw new UnsupportedOperationException();
130 137
 		}
138
+		
139
+		private void writeMappings(JavaCompiledModule module) {
140
+			String mappings = module.generateMappings();
141
+			try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(new File(output, "java.map")), StandardCharsets.UTF_8)) {
142
+				writer.write(mappings);
143
+			} catch (IOException ex) {
144
+				
145
+			}
146
+		}
131 147
 	}
132 148
 	
133 149
 	private static class JavaBytecodeTargetType implements TargetType {

+ 0
- 15
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaBaseCompiler.java Ver fichero

@@ -1,15 +0,0 @@
1
-package org.openzen.zenscript.javashared;
2
-
3
-/*
4
- * To change this license header, choose License Headers in Project Properties.
5
- * To change this template file, choose Tools | Templates
6
- * and open the template in the editor.
7
- */
8
-
9
-/**
10
- *
11
- * @author Hoofdgebruiker
12
- */
13
-public abstract class JavaBaseCompiler {
14
-	//public abstract JavaCompiledModule compile(SemanticModule module, JavaCompileSpace space);
15
-}

+ 2
- 2
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaCompileSpace.java Ver fichero

@@ -13,7 +13,7 @@ import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
13 13
  * @author Hoofdgebruiker
14 14
  */
15 15
 public interface JavaCompileSpace {
16
-	public GlobalTypeRegistry getRegistry();
16
+	GlobalTypeRegistry getRegistry();
17 17
 	
18
-	public JavaCompiledModule getCompiled(Module module);
18
+	JavaCompiledModule getCompiled(Module module);
19 19
 }

+ 22
- 0
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaCompiledModule.java Ver fichero

@@ -11,6 +11,7 @@ import org.openzen.zenscript.codemodel.FunctionParameter;
11 11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12 12
 import org.openzen.zenscript.codemodel.Modifiers;
13 13
 import org.openzen.zenscript.codemodel.Module;
14
+import org.openzen.zenscript.codemodel.definition.ExpansionDefinition;
14 15
 import org.openzen.zenscript.codemodel.definition.VariantDefinition;
15 16
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
16 17
 import org.openzen.zenscript.codemodel.member.ImplementationMember;
@@ -37,6 +38,23 @@ public class JavaCompiledModule {
37 38
 		this.module = module;
38 39
 	}
39 40
 	
41
+	public void loadMappings(String mappings) {
42
+		
43
+	}
44
+	
45
+	public String generateMappings() {
46
+		JavaMappingWriter writer = new JavaMappingWriter(this);
47
+		for (HighLevelDefinition definition : classes.keySet()) {
48
+			if (!(definition instanceof ExpansionDefinition))
49
+				definition.accept(writer);
50
+		}
51
+		for (HighLevelDefinition definition : expansionClasses.keySet()) {
52
+			definition.accept(writer);
53
+		}
54
+		
55
+		return writer.getOutput();
56
+	}
57
+	
40 58
 	public void setClassInfo(HighLevelDefinition definition, JavaClass cls) {
41 59
 		classes.put(definition, cls);
42 60
 	}
@@ -121,6 +139,10 @@ public class JavaCompiledModule {
121 139
 		methods.put(member, method);
122 140
 	}
123 141
 	
142
+	public JavaMethod optMethodInfo(IDefinitionMember member) {
143
+		return methods.get(member);
144
+	}
145
+	
124 146
 	public JavaMethod getMethodInfo(DefinitionMemberRef member) {
125 147
 		return getMethodInfo(member.getTarget());
126 148
 	}

+ 12
- 0
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaField.java Ver fichero

@@ -20,4 +20,16 @@ public class JavaField {
20 20
 		this.name = name;
21 21
 		this.descriptor = descriptor;
22 22
 	}
23
+	
24
+	public String getMapping(JavaClass definition) {
25
+		StringBuilder result = new StringBuilder();
26
+		result.append(name);
27
+		result.append(':');
28
+		result.append(descriptor);
29
+		
30
+		if (!cls.internalName.equals(definition.internalName))
31
+			result.append(definition.internalName);
32
+		
33
+		return result.toString();
34
+	}
23 35
 }

+ 306
- 0
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaMappingWriter.java Ver fichero

@@ -0,0 +1,306 @@
1
+/*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+package org.openzen.zenscript.javashared;
7
+
8
+import org.openzen.zenscript.codemodel.FunctionHeader;
9
+import org.openzen.zenscript.codemodel.HighLevelDefinition;
10
+import org.openzen.zenscript.codemodel.definition.AliasDefinition;
11
+import org.openzen.zenscript.codemodel.definition.ClassDefinition;
12
+import org.openzen.zenscript.codemodel.definition.DefinitionVisitor;
13
+import org.openzen.zenscript.codemodel.definition.EnumDefinition;
14
+import org.openzen.zenscript.codemodel.definition.ExpansionDefinition;
15
+import org.openzen.zenscript.codemodel.definition.FunctionDefinition;
16
+import org.openzen.zenscript.codemodel.definition.InterfaceDefinition;
17
+import org.openzen.zenscript.codemodel.definition.StructDefinition;
18
+import org.openzen.zenscript.codemodel.definition.VariantDefinition;
19
+import org.openzen.zenscript.codemodel.member.CallerMember;
20
+import org.openzen.zenscript.codemodel.member.CasterMember;
21
+import org.openzen.zenscript.codemodel.member.ConstMember;
22
+import org.openzen.zenscript.codemodel.member.ConstructorMember;
23
+import org.openzen.zenscript.codemodel.member.DestructorMember;
24
+import org.openzen.zenscript.codemodel.member.FieldMember;
25
+import org.openzen.zenscript.codemodel.member.GetterMember;
26
+import org.openzen.zenscript.codemodel.member.IDefinitionMember;
27
+import org.openzen.zenscript.codemodel.member.ImplementationMember;
28
+import org.openzen.zenscript.codemodel.member.InnerDefinitionMember;
29
+import org.openzen.zenscript.codemodel.member.IteratorMember;
30
+import org.openzen.zenscript.codemodel.member.MemberVisitor;
31
+import org.openzen.zenscript.codemodel.member.MethodMember;
32
+import org.openzen.zenscript.codemodel.member.OperatorMember;
33
+import org.openzen.zenscript.codemodel.member.SetterMember;
34
+import org.openzen.zenscript.codemodel.member.StaticInitializerMember;
35
+
36
+/**
37
+ *
38
+ * @author Hoofdgebruiker
39
+ */
40
+public class JavaMappingWriter implements DefinitionVisitor<Void> {
41
+	private final JavaCompiledModule module;
42
+	private final StringBuilder result = new StringBuilder();
43
+	
44
+	public JavaMappingWriter(JavaCompiledModule module) {
45
+		this.module = module;
46
+	}
47
+	
48
+	public String getOutput() {
49
+		return result.toString();
50
+	}
51
+
52
+	@Override
53
+	public Void visitClass(ClassDefinition definition) {
54
+		result.append("class:");
55
+		writeDefinitionDescriptor(definition);
56
+		return null;
57
+	}
58
+
59
+	@Override
60
+	public Void visitInterface(InterfaceDefinition definition) {
61
+		result.append("interface:");
62
+		writeDefinitionDescriptor(definition);
63
+		return null;
64
+	}
65
+
66
+	@Override
67
+	public Void visitEnum(EnumDefinition definition) {
68
+		result.append("enum:");
69
+		writeDefinitionDescriptor(definition);
70
+		return null;
71
+	}
72
+
73
+	@Override
74
+	public Void visitStruct(StructDefinition definition) {
75
+		result.append("struct:");
76
+		writeDefinitionDescriptor(definition);
77
+		return null;
78
+	}
79
+
80
+	@Override
81
+	public Void visitFunction(FunctionDefinition definition) {
82
+		result.append("function:").append(definition.name);
83
+		writeFunctionDescriptor(definition.header);
84
+		return null;
85
+	}
86
+
87
+	@Override
88
+	public Void visitExpansion(ExpansionDefinition definition) {
89
+		result.append("expansion:");
90
+		writeDefinitionDescriptor(definition);
91
+		return null;
92
+	}
93
+
94
+	@Override
95
+	public Void visitAlias(AliasDefinition definition) {
96
+		// aliases don't have mappings
97
+		return null;
98
+	}
99
+
100
+	@Override
101
+	public Void visitVariant(VariantDefinition variant) {
102
+		result.append("variant:");
103
+		writeDefinitionDescriptor(variant);
104
+		return null;
105
+	}
106
+	
107
+	private void writeFunctionDescriptor(FunctionHeader header) {
108
+		result.append(header.getCanonical());
109
+	}
110
+	
111
+	private void writeDefinitionDescriptor(HighLevelDefinition definition) {
112
+		if (definition.name != null)
113
+			result.append(definition.name);
114
+		if (definition.typeParameters.length > 0) {
115
+			result.append('<');
116
+			for (int i = 0; i < definition.typeParameters.length; i++) {
117
+				if (i > 0)
118
+					result.append(',');
119
+				result.append(definition.typeParameters[i].getCanonical());
120
+			}
121
+			result.append('>');
122
+		}
123
+		
124
+		JavaClass definitionClass = definition instanceof ExpansionDefinition
125
+				? module.getExpansionClassInfo(definition)
126
+				: module.getClassInfo(definition);
127
+		if (definitionClass != null) {
128
+			result.append('@').append(definitionClass.internalName);
129
+		}
130
+		result.append('\n');
131
+		
132
+		MemberMappingWriter memberWriter = new MemberMappingWriter(definitionClass);
133
+		for (IDefinitionMember member : definition.members) {
134
+			member.accept(memberWriter);
135
+		}
136
+	}
137
+	
138
+	private class MemberMappingWriter implements MemberVisitor<Void> {
139
+		private final JavaClass definition;
140
+		
141
+		public MemberMappingWriter(JavaClass definition) {
142
+			this.definition = definition;
143
+		}
144
+
145
+		@Override
146
+		public Void visitConst(ConstMember member) {
147
+			JavaField field = module.optFieldInfo(member);
148
+			if (field == null)
149
+				return null;
150
+			
151
+			result.append(":const:");
152
+			result.append(member.name);
153
+			result.append("=");
154
+			result.append(field.getMapping(definition));
155
+			result.append('\n');
156
+			return null;
157
+		}
158
+
159
+		@Override
160
+		public Void visitField(FieldMember member) {
161
+			JavaField field = module.optFieldInfo(member);
162
+			if (field == null)
163
+				return null;
164
+			
165
+			result.append(":field:");
166
+			result.append(member.name);
167
+			result.append("=");
168
+			result.append(field.getMapping(definition));
169
+			result.append('\n');
170
+			return null;
171
+		}
172
+
173
+		@Override
174
+		public Void visitConstructor(ConstructorMember member) {
175
+			JavaMethod method = module.optMethodInfo(member);
176
+			if (method == null)
177
+				return null;
178
+			
179
+			result.append(":constructor:");
180
+			result.append(member.header.getCanonicalWithoutReturnType());
181
+			result.append("=");
182
+			result.append(method.getMapping(definition));
183
+			result.append('\n');
184
+			return null;
185
+		}
186
+
187
+		@Override
188
+		public Void visitDestructor(DestructorMember member) {
189
+			JavaMethod method = module.optMethodInfo(member);
190
+			if (method == null)
191
+				return null;
192
+			
193
+			result.append(":destructor=");
194
+			result.append(method.getMapping(definition));
195
+			result.append('\n');
196
+			return null;
197
+		}
198
+
199
+		@Override
200
+		public Void visitMethod(MethodMember member) {
201
+			JavaMethod method = module.optMethodInfo(member);
202
+			if (method == null)
203
+				return null;
204
+			
205
+			result.append(":method:");
206
+			result.append(member.name);
207
+			result.append(member.header.getCanonical());
208
+			result.append("=");
209
+			result.append(method.getMapping(definition));
210
+			result.append('\n');
211
+			return null;
212
+		}
213
+
214
+		@Override
215
+		public Void visitGetter(GetterMember member) {
216
+			JavaMethod method = module.optMethodInfo(member);
217
+			if (method == null)
218
+				return null;
219
+			
220
+			result.append(":getter:");
221
+			result.append(member.name);
222
+			result.append("=");
223
+			result.append(method.getMapping(definition));
224
+			result.append('\n');
225
+			return null;
226
+		}
227
+
228
+		@Override
229
+		public Void visitSetter(SetterMember member) {
230
+			JavaMethod method = module.optMethodInfo(member);
231
+			if (method == null)
232
+				return null;
233
+			
234
+			result.append(":setter:");
235
+			result.append(member.name);
236
+			result.append("=");
237
+			result.append(method.getMapping(definition));
238
+			result.append('\n');
239
+			return null;
240
+		}
241
+
242
+		@Override
243
+		public Void visitOperator(OperatorMember member) {
244
+			JavaMethod method = module.optMethodInfo(member);
245
+			if (method == null)
246
+				return null;
247
+			
248
+			result.append(":operator:");
249
+			result.append(member.operator.name().toLowerCase());
250
+			result.append(member.header.getCanonical());
251
+			result.append("=");
252
+			result.append(method.getMapping(definition));
253
+			result.append('\n');
254
+			return null;
255
+		}
256
+
257
+		@Override
258
+		public Void visitCaster(CasterMember member) {
259
+			JavaMethod method = module.optMethodInfo(member);
260
+			if (method == null)
261
+				return null;
262
+			
263
+			result.append(":caster:");
264
+			result.append(member.toType.type.toString());
265
+			result.append("=");
266
+			result.append(method.getMapping(definition));
267
+			result.append('\n');
268
+			return null;
269
+		}
270
+
271
+		@Override
272
+		public Void visitCustomIterator(IteratorMember member) {
273
+			return null;
274
+		}
275
+
276
+		@Override
277
+		public Void visitCaller(CallerMember member) {
278
+			JavaMethod method = module.optMethodInfo(member);
279
+			if (method == null)
280
+				return null;
281
+			
282
+			result.append(":caller:");
283
+			result.append(member.header.getCanonical());
284
+			result.append("=");
285
+			result.append(method.getMapping(definition));
286
+			result.append('\n');
287
+			return null;
288
+		}
289
+
290
+		@Override
291
+		public Void visitImplementation(ImplementationMember member) {
292
+			JavaImplementation implementation = module.getImplementationInfo(member);
293
+			return null;
294
+		}
295
+
296
+		@Override
297
+		public Void visitInnerDefinition(InnerDefinitionMember member) {
298
+			return null;
299
+		}
300
+
301
+		@Override
302
+		public Void visitStaticInitializer(StaticInitializerMember member) {
303
+			return null;
304
+		}
305
+	}
306
+}

+ 14
- 0
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaMethod.java Ver fichero

@@ -78,6 +78,20 @@ public class JavaMethod {
78 78
 		this.genericResult = false;
79 79
 	}
80 80
 	
81
+	public String getMapping(JavaClass definition) {
82
+		if (cls == null)
83
+			return "!TODO";
84
+		
85
+		StringBuilder result = new StringBuilder();
86
+		result.append(name);
87
+		result.append(descriptor);
88
+		
89
+		if (definition == null || !definition.internalName.equals(cls.internalName))
90
+			result.append('@').append(cls.internalName);
91
+		
92
+		return result.toString();
93
+	}
94
+	
81 95
 	public enum Kind {
82 96
 		STATIC,
83 97
 		STATICINIT,

+ 2
- 1
JavaShared/src/main/java/org/openzen/zenscript/javashared/JavaNativeTranslation.java Ver fichero

@@ -11,6 +11,7 @@ import org.openzen.zenscript.codemodel.expression.Expression;
11 11
  *
12 12
  * @author Hoofdgebruiker
13 13
  */
14
+@FunctionalInterface
14 15
 public interface JavaNativeTranslation<T> {
15
-	public T translate(Expression expression, JavaNativeTranslator<T> translator);
16
+	T translate(Expression expression, JavaNativeTranslator<T> translator);
16 17
 }

+ 8
- 8
Parser/src/main/java/org/openzen/zenscript/lexer/ZSTokenType.java Ver fichero

@@ -172,7 +172,7 @@ public enum ZSTokenType implements TokenType {
172 172
 	public final boolean isKeyword;
173 173
 	public final boolean multiline;
174 174
 	
175
-	private ZSTokenType() {
175
+	ZSTokenType() {
176 176
 		this.regexp = null;
177 177
 		this.whitespace = false;
178 178
 		this.isKeyword = false;
@@ -180,7 +180,7 @@ public enum ZSTokenType implements TokenType {
180 180
 		this.multiline = false;
181 181
 	}
182 182
 	
183
-	private ZSTokenType(String regexp) {
183
+	ZSTokenType(String regexp) {
184 184
 		this.regexp = regexp;
185 185
 		this.whitespace = false;
186 186
 		this.isKeyword = false;
@@ -188,7 +188,7 @@ public enum ZSTokenType implements TokenType {
188 188
 		this.multiline = false;
189 189
 	}
190 190
 	
191
-	private ZSTokenType(String regexp, boolean whitespace) {
191
+	ZSTokenType(String regexp, boolean whitespace) {
192 192
 		this.regexp = regexp;
193 193
 		this.whitespace = whitespace;
194 194
 		this.isKeyword = false;
@@ -196,7 +196,7 @@ public enum ZSTokenType implements TokenType {
196 196
 		this.multiline = false;
197 197
 	}
198 198
 	
199
-	private ZSTokenType(String regexp, boolean whitespace, boolean multiline) {
199
+	ZSTokenType(String regexp, boolean whitespace, boolean multiline) {
200 200
 		this.regexp = regexp;
201 201
 		this.whitespace = whitespace;
202 202
 		this.isKeyword = false;
@@ -204,7 +204,7 @@ public enum ZSTokenType implements TokenType {
204 204
 		this.multiline = multiline;
205 205
 	}
206 206
 	
207
-	private ZSTokenType(String regexp, String content) {
207
+	ZSTokenType(String regexp, String content) {
208 208
 		this.regexp = regexp;
209 209
 		this.whitespace = false;
210 210
 		this.isKeyword = false;
@@ -212,7 +212,7 @@ public enum ZSTokenType implements TokenType {
212 212
 		this.multiline = false;
213 213
 	}
214 214
 	
215
-	private ZSTokenType(boolean isWhitespace, String regexp, String content) {
215
+	ZSTokenType(boolean isWhitespace, String regexp, String content) {
216 216
 		this.regexp = regexp;
217 217
 		this.whitespace = isWhitespace;
218 218
 		this.isKeyword = false;
@@ -220,7 +220,7 @@ public enum ZSTokenType implements TokenType {
220 220
 		this.multiline = false;
221 221
 	}
222 222
 	
223
-	private ZSTokenType(boolean isWhitespace, String regexp, String content, boolean multiline) {
223
+	ZSTokenType(boolean isWhitespace, String regexp, String content, boolean multiline) {
224 224
 		this.regexp = regexp;
225 225
 		this.whitespace = isWhitespace;
226 226
 		this.isKeyword = false;
@@ -228,7 +228,7 @@ public enum ZSTokenType implements TokenType {
228 228
 		this.multiline = multiline;
229 229
 	}
230 230
 	
231
-	private ZSTokenType(boolean isKeyword, String content) {
231
+	ZSTokenType(boolean isKeyword, String content) {
232 232
 		this.regexp = null;
233 233
 		this.whitespace = false;
234 234
 		this.isKeyword = isKeyword;

+ 2
- 3
Parser/src/main/java/org/openzen/zenscript/parser/definitions/BaseParsedDefinition.java Ver fichero

@@ -47,8 +47,7 @@ public abstract class BaseParsedDefinition extends ParsedDefinition {
47 47
 		if (typesCompiled)
48 48
 			return;
49 49
 		typesCompiled = true;
50
-		
51
-		//System.out.println("compileTypes " + getCompiled().name);
50
+
52 51
 		linkTypesLocal(context);
53 52
 	}
54 53
 	
@@ -89,7 +88,7 @@ public abstract class BaseParsedDefinition extends ParsedDefinition {
89 88
 	private class Compiling implements CompilingType {
90 89
 		private final TypeResolutionContext context;
91 90
 		
92
-		public Compiling(TypeResolutionContext context) {
91
+		private Compiling(TypeResolutionContext context) {
93 92
 			this.context = new LocalTypeResolutionContext(context, this, getCompiled().typeParameters);
94 93
 		}
95 94
 		

+ 1
- 1
Parser/src/main/java/org/openzen/zenscript/parser/definitions/ParsedAlias.java Ver fichero

@@ -114,7 +114,7 @@ public class ParsedAlias extends ParsedDefinition {
114 114
 	private class Compiling implements CompilingType {
115 115
 		private final TypeResolutionContext context;
116 116
 		
117
-		public Compiling(TypeResolutionContext context) {
117
+		private Compiling(TypeResolutionContext context) {
118 118
 			this.context = new LocalTypeResolutionContext(context, this, compiled.typeParameters);
119 119
 		}
120 120
 		

+ 3
- 2
Parser/src/main/java/org/openzen/zenscript/parser/definitions/ParsedFunctionParameter.java Ver fichero

@@ -40,9 +40,10 @@ public class ParsedFunctionParameter {
40 40
 		
41 41
 		StoredType cType = type.compile(context);
42 42
 		Expression cDefaultValue = null;
43
-		return compiled = new FunctionParameter(cType, name, cDefaultValue, variadic);
43
+		return compiled = new FunctionParameter(cType, name, null, variadic);
44 44
 	}
45
-	
45
+
46
+	// TODO: this isn't called!
46 47
 	public void compileInitializer(BaseScope scope, PrecompilationState state) {
47 48
 		if (defaultValue != null) {
48 49
 			try {

Loading…
Cancelar
Guardar