Browse Source

WIP removing stored types

Stan Hebben 4 years ago
parent
commit
417e99aab0
100 changed files with 805 additions and 1064 deletions
  1. 0
    1
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/ExpressionFormatter.java
  2. 4
    4
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/FormattingUtils.java
  3. 1
    7
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/TypeFormatter.java
  4. 40
    65
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionHeader.java
  5. 6
    11
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionParameter.java
  6. 15
    18
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/GenericMapper.java
  7. 3
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/GenericName.java
  8. 1
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/NativeAnnotationDefinition.java
  9. 4
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/PreconditionAnnotationDefinition.java
  10. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/StatementContext.java
  11. 7
    7
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/TypeContext.java
  12. 2
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/TypeResolutionContext.java
  13. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/ExpansionDefinition.java
  14. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/VariantDefinition.java
  15. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ArrayExpression.java
  16. 7
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CallArguments.java
  17. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedExpression.java
  18. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedThisExpression.java
  19. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConditionalExpression.java
  20. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantStringExpression.java
  21. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstructorSuperCallExpression.java
  22. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstructorThisCallExpression.java
  23. 17
    19
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/Expression.java
  24. 1
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionVisitor.java
  25. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/FunctionExpression.java
  26. 3
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/InvalidExpression.java
  27. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MapExpression.java
  28. 6
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MatchExpression.java
  29. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NewExpression.java
  30. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NullExpression.java
  31. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/PanicExpression.java
  32. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/RangeExpression.java
  33. 0
    46
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/StorageCastExpression.java
  34. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SupertypeCastExpression.java
  35. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThisExpression.java
  36. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThrowExpression.java
  37. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryConvertExpression.java
  38. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryRethrowAsExceptionExpression.java
  39. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryRethrowAsResultExpression.java
  40. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/VariantValueExpression.java
  41. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/WrapOptionalExpression.java
  42. 0
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/TypeParameter.java
  43. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/CasterMember.java
  44. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ConstMember.java
  45. 4
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FieldMember.java
  46. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FunctionalMember.java
  47. 6
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/GetterMember.java
  48. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/IDefinitionMember.java
  49. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/InnerDefinition.java
  50. 6
    7
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/IteratorMember.java
  51. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/PropertyMember.java
  52. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/SetterMember.java
  53. 5
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/CasterMemberRef.java
  54. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/ConstMemberRef.java
  55. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/DefinitionMemberRef.java
  56. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/FieldMemberRef.java
  57. 3
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/FunctionalMemberRef.java
  58. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/GetterMemberRef.java
  59. 5
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/ImplementationMemberRef.java
  60. 6
    10
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/IteratorMemberRef.java
  61. 7
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/PropertyRef.java
  62. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/SetterMemberRef.java
  63. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/TranslatedOperatorMemberRef.java
  64. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/VariantOptionRef.java
  65. 8
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/IPartialExpression.java
  66. 8
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialGlobalExpression.java
  67. 10
    10
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialMemberGroupExpression.java
  68. 8
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialStaticMemberGroupExpression.java
  69. 10
    13
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialTypeExpression.java
  70. 7
    7
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialVariantOptionExpression.java
  71. 7
    14
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/DefinitionScope.java
  72. 13
    22
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/ExpressionScope.java
  73. 3
    10
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/FunctionScope.java
  74. 2
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/TypeScope.java
  75. 5
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/serialization/CodeSerializationInput.java
  76. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/BlockStatement.java
  77. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/IfStatement.java
  78. 6
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/Statement.java
  79. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/VarStatement.java
  80. 11
    12
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/ArrayTypeID.java
  81. 7
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/AssocTypeID.java
  82. 6
    10
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/BasicTypeID.java
  83. 24
    25
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/DefinitionTypeID.java
  84. 5
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/GenericMapTypeID.java
  85. 4
    9
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/GenericTypeID.java
  86. 10
    10
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/GlobalTypeRegistry.java
  87. 10
    11
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/IteratorTypeID.java
  88. 3
    9
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/OptionalTypeID.java
  89. 9
    13
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/RangeTypeID.java
  90. 12
    13
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/StoredType.java
  91. 2
    14
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/StringTypeID.java
  92. 18
    20
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeID.java
  93. 29
    37
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeMatcher.java
  94. 0
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeVisitor.java
  95. 1
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeVisitorWithContext.java
  96. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/LocalMemberCache.java
  97. 237
    287
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberBuilder.java
  98. 9
    12
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberGroup.java
  99. 44
    67
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMembers.java
  100. 0
    0
      JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaBytecodeContext.java

+ 0
- 1
CodeFormatter/src/main/java/org/openzen/zenscript/formatter/ExpressionFormatter.java View File

@@ -70,7 +70,6 @@ import org.openzen.zenscript.codemodel.expression.SetStaticFieldExpression;
70 70
 import org.openzen.zenscript.codemodel.expression.SetterExpression;
71 71
 import org.openzen.zenscript.codemodel.expression.StaticGetterExpression;
72 72
 import org.openzen.zenscript.codemodel.expression.StaticSetterExpression;
73
-import org.openzen.zenscript.codemodel.expression.StorageCastExpression;
74 73
 import org.openzen.zenscript.codemodel.expression.SupertypeCastExpression;
75 74
 import org.openzen.zenscript.codemodel.expression.ThisExpression;
76 75
 import org.openzen.zenscript.codemodel.expression.ThrowExpression;

+ 4
- 4
CodeFormatter/src/main/java/org/openzen/zenscript/formatter/FormattingUtils.java View File

@@ -30,7 +30,7 @@ import org.openzen.zenscript.codemodel.statement.TryCatchStatement;
30 30
 import org.openzen.zenscript.codemodel.statement.VarStatement;
31 31
 import org.openzen.zenscript.codemodel.statement.WhileStatement;
32 32
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
33
-import org.openzen.zenscript.codemodel.type.StoredType;
33
+import org.openzen.zenscript.codemodel.type.TypeID;
34 34
 
35 35
 /**
36 36
  *
@@ -78,7 +78,7 @@ public class FormattingUtils {
78 78
 			if (parameter.variadic)
79 79
 				result.append("...");
80 80
 			
81
-			if (!settings.showAnyInFunctionHeaders || !parameter.type.isBasic(BasicTypeID.UNDETERMINED)) {
81
+			if (!settings.showAnyInFunctionHeaders || parameter.type != BasicTypeID.UNDETERMINED) {
82 82
 				result.append(" as ");
83 83
 				result.append(typeFormatter.format(header.getReturnType()));
84 84
 			}
@@ -86,7 +86,7 @@ public class FormattingUtils {
86 86
 			parameterIndex++;
87 87
 		}
88 88
 		result.append(")");
89
-		if (!settings.showAnyInFunctionHeaders || !header.getReturnType().isBasic(BasicTypeID.UNDETERMINED)) {
89
+		if (!settings.showAnyInFunctionHeaders || header.getReturnType() != BasicTypeID.UNDETERMINED) {
90 90
 			result.append(" as ");
91 91
 			result.append(typeFormatter.format(header.getReturnType()));
92 92
 		}
@@ -128,7 +128,7 @@ public class FormattingUtils {
128 128
 			result.append("<");
129 129
 			
130 130
 			int index = 0;
131
-			for (StoredType typeArgument : arguments.typeArguments) {
131
+			for (TypeID typeArgument : arguments.typeArguments) {
132 132
 				if (index > 0)
133 133
 					result.append(", ");
134 134
 				result.append(typeFormatter.format(typeArgument));

+ 1
- 7
CodeFormatter/src/main/java/org/openzen/zenscript/formatter/TypeFormatter.java View File

@@ -21,7 +21,6 @@ import org.openzen.zenscript.codemodel.type.GenericTypeID;
21 21
 import org.openzen.zenscript.codemodel.type.IteratorTypeID;
22 22
 import org.openzen.zenscript.codemodel.type.RangeTypeID;
23 23
 import org.openzen.zenscript.codemodel.type.StoredType;
24
-import org.openzen.zenscript.codemodel.type.StringTypeID;
25 24
 import org.openzen.zenscript.codemodel.type.TypeID;
26 25
 import stdlib.Chars;
27 26
 import org.openzen.zenscript.codemodel.type.TypeVisitor;
@@ -51,11 +50,6 @@ public class TypeFormatter implements TypeVisitor<String>, GenericParameterBound
51 50
 	public String visitBasic(BasicTypeID basic) {
52 51
 		return basic.name;
53 52
 	}
54
-	
55
-	@Override
56
-	public String visitString(StringTypeID string) {
57
-		return "string";
58
-	}
59 53
 
60 54
 	@Override
61 55
 	public String visitArray(ArrayTypeID array) {
@@ -97,7 +91,7 @@ public class TypeFormatter implements TypeVisitor<String>, GenericParameterBound
97 91
 		result.append(importedName);
98 92
 		result.append("<");
99 93
 		int index = 0;
100
-		for (StoredType typeParameter : definition.typeArguments) {
94
+		for (TypeID typeParameter : definition.typeArguments) {
101 95
 			if (index > 0)
102 96
 				result.append(", ");
103 97
 			

+ 40
- 65
CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionHeader.java View File

@@ -14,9 +14,7 @@ import org.openzen.zenscript.codemodel.generic.TypeParameter;
14 14
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
15 15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
16 16
 import org.openzen.zenscript.codemodel.scope.TypeScope;
17
-import org.openzen.zenscript.codemodel.type.StoredType;
18
-import org.openzen.zenscript.codemodel.type.storage.AutoStorageTag;
19
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
17
+import org.openzen.zenscript.codemodel.type.TypeID;
20 18
 
21 19
 /**
22 20
  *
@@ -24,16 +22,15 @@ import org.openzen.zenscript.codemodel.type.storage.StorageTag;
24 22
  */
25 23
 public class FunctionHeader {
26 24
 	public final TypeParameter[] typeParameters;
27
-	private StoredType returnType;
25
+	private TypeID returnType;
28 26
 	public final FunctionParameter[] parameters;
29
-	public final StoredType thrownType;
30
-	public final StorageTag storage;
31
-	
27
+	public final TypeID thrownType;
28
+
32 29
 	public final int minParameters;
33 30
 	public final int maxParameters;
34 31
 	public final boolean hasUnknowns;
35 32
 	
36
-	public FunctionHeader(StoredType returnType) {
33
+	public FunctionHeader(TypeID returnType) {
37 34
 		if (returnType == null)
38 35
 			throw new NullPointerException();
39 36
 		
@@ -41,18 +38,13 @@ public class FunctionHeader {
41 38
 		this.returnType = returnType;
42 39
 		this.parameters = FunctionParameter.NONE;
43 40
 		this.thrownType = null;
44
-		this.storage = null;
45 41
 		
46 42
 		minParameters = 0;
47 43
 		maxParameters = 0;
48
-		hasUnknowns = returnType.type == BasicTypeID.UNDETERMINED;
49
-	}
50
-	
51
-	public FunctionHeader(BasicTypeID returnType) {
52
-		this(returnType.stored);
44
+		hasUnknowns = returnType == BasicTypeID.UNDETERMINED;
53 45
 	}
54 46
 	
55
-	public FunctionHeader(StoredType returnType, StoredType... parameterTypes) {
47
+	public FunctionHeader(TypeID returnType, TypeID... parameterTypes) {
56 48
 		if (returnType == null)
57 49
 			throw new NullPointerException();
58 50
 		
@@ -60,7 +52,6 @@ public class FunctionHeader {
60 52
 		this.returnType = returnType;
61 53
 		this.parameters = new FunctionParameter[parameterTypes.length];
62 54
 		this.thrownType = null;
63
-		this.storage = null;
64 55
 		
65 56
 		for (int i = 0; i < parameterTypes.length; i++)
66 57
 			parameters[i] = new FunctionParameter(parameterTypes[i], null);
@@ -70,11 +61,7 @@ public class FunctionHeader {
70 61
 		hasUnknowns = hasUnknowns(parameterTypes, returnType);
71 62
 	}
72 63
 	
73
-	public FunctionHeader(BasicTypeID returnType, StoredType... parameterTypes) {
74
-		this(returnType.stored, parameterTypes);
75
-	}
76
-	
77
-	public FunctionHeader(StoredType returnType, FunctionParameter... parameters) {
64
+	public FunctionHeader(TypeID returnType, FunctionParameter... parameters) {
78 65
 		if (returnType == null)
79 66
 			throw new NullPointerException();
80 67
 		
@@ -82,18 +69,13 @@ public class FunctionHeader {
82 69
 		this.returnType = returnType;
83 70
 		this.parameters = parameters;
84 71
 		this.thrownType = null;
85
-		this.storage = null;
86 72
 		
87 73
 		minParameters = getMinParameters(parameters);
88 74
 		maxParameters = getMaxParameters(parameters);
89 75
 		hasUnknowns = hasUnknowns(parameters, returnType);
90 76
 	}
91 77
 	
92
-	public FunctionHeader(BasicTypeID returnType, FunctionParameter... parameters) {
93
-		this(returnType.stored, parameters);
94
-	}
95
-	
96
-	public FunctionHeader(TypeParameter[] typeParameters, StoredType returnType, StoredType thrownType, StorageTag storage, FunctionParameter... parameters) {
78
+	public FunctionHeader(TypeParameter[] typeParameters, TypeID returnType, TypeID thrownType, FunctionParameter... parameters) {
97 79
 		if (returnType == null)
98 80
 			throw new NullPointerException();
99 81
 		if (typeParameters == null)
@@ -103,7 +85,6 @@ public class FunctionHeader {
103 85
 		this.returnType = returnType;
104 86
 		this.parameters = parameters;
105 87
 		this.thrownType = thrownType;
106
-		this.storage = storage;
107 88
 		
108 89
 		minParameters = getMinParameters(parameters);
109 90
 		maxParameters = getMaxParameters(parameters);
@@ -148,18 +129,18 @@ public class FunctionHeader {
148 129
 		return useTypeParameters;
149 130
 	}
150 131
 	
151
-	public StoredType getReturnType() {
132
+	public TypeID getReturnType() {
152 133
 		return returnType;
153 134
 	}
154 135
 	
155
-	public void setReturnType(StoredType returnType) {
136
+	public void setReturnType(TypeID returnType) {
156 137
 		if (returnType == null)
157 138
 			throw new NullPointerException();
158 139
 		
159 140
 		this.returnType = returnType;
160 141
 	}
161 142
 	
162
-	public StoredType getParameterType(boolean isVariadic, int index) {
143
+	public TypeID getParameterType(boolean isVariadic, int index) {
163 144
 		return getParameter(isVariadic, index).type;
164 145
 	}
165 146
 	
@@ -188,7 +169,7 @@ public class FunctionHeader {
188 169
 		FunctionParameter[] normalizedParameters = new FunctionParameter[parameters.length];
189 170
 		for (int i = 0; i < normalizedParameters.length; i++)
190 171
 			normalizedParameters[i] = parameters[i].normalize(registry);
191
-		return new FunctionHeader(typeParameters, returnType.getNormalized(), thrownType == null ? null : thrownType.getNormalized(), storage, normalizedParameters);
172
+		return new FunctionHeader(typeParameters, returnType.getNormalized(), thrownType == null ? null : thrownType.getNormalized(), normalizedParameters);
192 173
 	}
193 174
 	
194 175
 	public int getNumberOfTypeParameters() {
@@ -205,28 +186,24 @@ public class FunctionHeader {
205 186
 	
206 187
 	public FunctionHeader inferFromOverride(GlobalTypeRegistry registry, FunctionHeader overridden) {
207 188
 		TypeParameter[] resultTypeParameters = typeParameters;
208
-		StoredType resultReturnType = this.returnType;
209
-		if (resultReturnType.type == BasicTypeID.UNDETERMINED)
189
+		TypeID resultReturnType = this.returnType;
190
+		if (resultReturnType == BasicTypeID.UNDETERMINED)
210 191
 			resultReturnType = overridden.returnType;
211
-		
212
-		StoredType resultThrownType = this.thrownType;
192
+
193
+		TypeID resultThrownType = this.thrownType;
213 194
 		if (resultThrownType == null && overridden.thrownType != null)
214 195
 			resultThrownType = overridden.thrownType;
215 196
 		
216 197
 		FunctionParameter[] resultParameters = Arrays.copyOf(parameters, parameters.length);
217 198
 		for (int i = 0; i < resultParameters.length; i++) {
218
-			if (resultParameters[i].type.type == BasicTypeID.UNDETERMINED) {
199
+			if (resultParameters[i].type == BasicTypeID.UNDETERMINED) {
219 200
 				FunctionParameter parameter = resultParameters[i];
220 201
 				FunctionParameter original = overridden.parameters[i];
221 202
 				resultParameters[i] = new FunctionParameter(original.type, parameter.name, parameter.defaultValue, original.variadic);
222 203
 			}
223 204
 		}
224 205
 		
225
-		StorageTag resultStorage = this.storage;
226
-		if (resultStorage == null)
227
-			resultStorage = overridden.storage;
228
-		
229
-		return new FunctionHeader(resultTypeParameters, resultReturnType, resultThrownType, resultStorage, resultParameters);
206
+		return new FunctionHeader(resultTypeParameters, resultReturnType, resultThrownType, resultParameters);
230 207
 	}
231 208
 	
232 209
 	public boolean matchesExactly(CodePosition position, CallArguments arguments, TypeScope scope) {
@@ -266,8 +243,6 @@ public class FunctionHeader {
266 243
 			}
267 244
 			result.append('>');
268 245
 		}
269
-		if (storage != null && storage != AutoStorageTag.INSTANCE)
270
-			result.append('`').append(storage);
271 246
 		result.append('(');
272 247
 		for (int i = 0; i < parameters.length; i++) {
273 248
 			if (i > 0)
@@ -279,7 +254,7 @@ public class FunctionHeader {
279 254
 	}
280 255
 	
281 256
 	public String getCanonical() {
282
-		return getCanonicalWithoutReturnType() + returnType.type.toString();
257
+		return getCanonicalWithoutReturnType() + returnType.toString();
283 258
 	}
284 259
 	
285 260
 	public boolean hasInferenceBlockingTypeParameters(TypeParameter[] parameters) {
@@ -307,11 +282,11 @@ public class FunctionHeader {
307 282
 			throw new NullPointerException();
308 283
 		if (parameters.length != other.parameters.length)
309 284
 			return false;
310
-		if (returnType.type != BasicTypeID.UNDETERMINED && !scope.getTypeMembers(returnType).canCastImplicit(other.returnType))
285
+		if (returnType != BasicTypeID.UNDETERMINED && !scope.getTypeMembers(returnType).canCastImplicit(other.returnType))
311 286
 			return false;
312 287
 		
313 288
 		for (int i = 0; i < parameters.length; i++) {
314
-			if (parameters[i].type.type == BasicTypeID.UNDETERMINED)
289
+			if (parameters[i].type == BasicTypeID.UNDETERMINED)
315 290
 				continue;
316 291
 			
317 292
 			if (parameters[i].variadic != other.parameters[i].variadic)
@@ -376,7 +351,7 @@ public class FunctionHeader {
376 351
 	
377 352
 	public FunctionHeader instanceForCall(CodePosition position, GlobalTypeRegistry registry, CallArguments arguments) {
378 353
 		if (arguments.getNumberOfTypeArguments() > 0) {
379
-			Map<TypeParameter, StoredType> typeParameters = StoredType.getMapping(this.typeParameters, arguments.typeArguments);
354
+			Map<TypeParameter, TypeID> typeParameters = TypeID.getMapping(this.typeParameters, arguments.typeArguments);
380 355
 			return instance(new GenericMapper(position, registry, typeParameters));
381 356
 		} else {
382 357
 			return this;
@@ -385,37 +360,37 @@ public class FunctionHeader {
385 360
 	
386 361
 	public FunctionHeader withGenericArguments(GenericMapper mapper) {
387 362
 		if (typeParameters.length > 0)
388
-			mapper = mapper.getInner(mapper.position, mapper.registry, StoredType.getSelfMapping(mapper.registry, typeParameters));
363
+			mapper = mapper.getInner(mapper.position, mapper.registry, TypeID.getSelfMapping(mapper.registry, typeParameters));
389 364
 		
390 365
 		return instance(mapper);
391 366
 	}
392 367
 	
393 368
 	private FunctionHeader instance(GenericMapper mapper) {
394
-		StoredType returnType = this.returnType.instance(mapper);
369
+		TypeID returnType = this.returnType.instance(mapper);
395 370
 		FunctionParameter[] parameters = new FunctionParameter[this.parameters.length];
396 371
 		for (int i = 0; i < parameters.length; i++) {
397 372
 			parameters[i] = this.parameters[i].withGenericArguments(mapper);
398 373
 		}
399
-		return new FunctionHeader(typeParameters, returnType, thrownType == null ? null : thrownType.instance(mapper), storage, parameters);
374
+		return new FunctionHeader(typeParameters, returnType, thrownType == null ? null : thrownType.instance(mapper), parameters);
400 375
 	}
401 376
 	
402
-	public FunctionHeader fillGenericArguments(CodePosition position, TypeScope scope, StoredType[] arguments) {
377
+	public FunctionHeader fillGenericArguments(CodePosition position, TypeScope scope, TypeID[] arguments) {
403 378
 		if (arguments == null || arguments.length == 0)
404 379
 			return this;
405 380
 		
406
-		Map<TypeParameter, StoredType> typeArguments = StoredType.getMapping(typeParameters, arguments);
381
+		Map<TypeParameter, TypeID> typeArguments = TypeID.getMapping(typeParameters, arguments);
407 382
 		GenericMapper mapper = scope.getLocalTypeParameters().getInner(position, scope.getTypeRegistry(), typeArguments);
408
-		
409
-		StoredType returnType = this.returnType.instance(mapper);
383
+
384
+		TypeID returnType = this.returnType.instance(mapper);
410 385
 		FunctionParameter[] parameters = new FunctionParameter[this.parameters.length];
411 386
 		for (int i = 0; i < parameters.length; i++) {
412 387
 			parameters[i] = this.parameters[i].withGenericArguments(mapper);
413 388
 		}
414
-		return new FunctionHeader(TypeParameter.NONE, returnType, thrownType == null ? null : thrownType.instance(mapper), storage, parameters);
389
+		return new FunctionHeader(TypeParameter.NONE, returnType, thrownType == null ? null : thrownType.instance(mapper), parameters);
415 390
 	}
416 391
 	
417 392
 	public FunctionHeader forTypeParameterInference() {
418
-		return new FunctionHeader(BasicTypeID.UNDETERMINED.stored, parameters);
393
+		return new FunctionHeader(BasicTypeID.UNDETERMINED, parameters);
419 394
 	}
420 395
 	
421 396
 	public FunctionHeader forLambda(FunctionHeader lambdaHeader) {
@@ -423,7 +398,7 @@ public class FunctionHeader {
423 398
 		for (int i = 0; i < lambdaHeader.parameters.length; i++)
424 399
 			parameters[i] = new FunctionParameter(this.parameters[i].type, lambdaHeader.parameters[i].name);
425 400
 		
426
-		return new FunctionHeader(typeParameters, returnType, thrownType, storage, parameters);
401
+		return new FunctionHeader(typeParameters, returnType, thrownType, parameters);
427 402
 	}
428 403
 	
429 404
 	public FunctionParameter getVariadicParameter() {
@@ -489,23 +464,23 @@ public class FunctionHeader {
489 464
 		return parameters[parameters.length - 1].variadic ? Integer.MAX_VALUE : parameters.length;
490 465
 	}
491 466
 	
492
-	private static boolean hasUnknowns(StoredType[] types, StoredType returnType) {
493
-		if (returnType.type == BasicTypeID.UNDETERMINED)
467
+	private static boolean hasUnknowns(TypeID[] types, TypeID returnType) {
468
+		if (returnType == BasicTypeID.UNDETERMINED)
494 469
 			return true;
495 470
 		
496
-		for (StoredType type : types)
497
-			if (type.type == BasicTypeID.UNDETERMINED)
471
+		for (TypeID type : types)
472
+			if (type == BasicTypeID.UNDETERMINED)
498 473
 				return true;
499 474
 		
500 475
 		return false;
501 476
 	}
502 477
 	
503
-	private static boolean hasUnknowns(FunctionParameter[] parameters, StoredType returnType) {
504
-		if (returnType.type == BasicTypeID.UNDETERMINED)
478
+	private static boolean hasUnknowns(FunctionParameter[] parameters, TypeID returnType) {
479
+		if (returnType == BasicTypeID.UNDETERMINED)
505 480
 			return true;
506 481
 		
507 482
 		for (FunctionParameter parameter : parameters)
508
-			if (parameter.type.type == BasicTypeID.UNDETERMINED)
483
+			if (parameter.type == BasicTypeID.UNDETERMINED)
509 484
 				return true;
510 485
 		
511 486
 		return false;

+ 6
- 11
CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionParameter.java View File

@@ -8,10 +8,9 @@ package org.openzen.zenscript.codemodel;
8 8
 import java.util.Objects;
9 9
 import org.openzen.zencode.shared.Taggable;
10 10
 import org.openzen.zenscript.codemodel.expression.Expression;
11
-import org.openzen.zenscript.codemodel.type.BasicTypeID;
12 11
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
13
-import org.openzen.zenscript.codemodel.type.StoredType;
14 12
 import org.openzen.zenscript.codemodel.annotations.ParameterAnnotation;
13
+import org.openzen.zenscript.codemodel.type.TypeID;
15 14
 
16 15
 /**
17 16
  *
@@ -21,12 +20,12 @@ public class FunctionParameter extends Taggable {
21 20
 	public static final FunctionParameter[] NONE = new FunctionParameter[0];
22 21
 	
23 22
 	public ParameterAnnotation[] annotations;
24
-	public final StoredType type;
23
+	public final TypeID type;
25 24
 	public final String name;
26 25
 	public Expression defaultValue;
27 26
 	public final boolean variadic;
28 27
 	
29
-	public FunctionParameter(StoredType type) {
28
+	public FunctionParameter(TypeID type) {
30 29
 		this.annotations = ParameterAnnotation.NONE;
31 30
 		this.type = type;
32 31
 		this.name = "";
@@ -34,11 +33,7 @@ public class FunctionParameter extends Taggable {
34 33
 		this.variadic = false;
35 34
 	}
36 35
 	
37
-	public FunctionParameter(BasicTypeID type) {
38
-		this(type.stored);
39
-	}
40
-	
41
-	public FunctionParameter(StoredType type, String name) {
36
+	public FunctionParameter(TypeID type, String name) {
42 37
 		this.annotations = ParameterAnnotation.NONE;
43 38
 		this.type = type;
44 39
 		this.name = name;
@@ -46,7 +41,7 @@ public class FunctionParameter extends Taggable {
46 41
 		this.variadic = false;
47 42
 	}
48 43
 	
49
-	public FunctionParameter(StoredType type, String name, Expression defaultValue, boolean variadic) {
44
+	public FunctionParameter(TypeID type, String name, Expression defaultValue, boolean variadic) {
50 45
 		this.annotations = ParameterAnnotation.NONE;
51 46
 		this.type = type;
52 47
 		this.name = name;
@@ -61,7 +56,7 @@ public class FunctionParameter extends Taggable {
61 56
 	}
62 57
 	
63 58
 	public FunctionParameter withGenericArguments(GenericMapper mapper) {
64
-		StoredType instanced = type.instance(mapper);
59
+		TypeID instanced = type.instance(mapper);
65 60
 		if (instanced.equals(type))
66 61
 			return this;
67 62
 		

+ 15
- 18
CodeModel/src/main/java/org/openzen/zenscript/codemodel/GenericMapper.java View File

@@ -12,7 +12,7 @@ import org.openzen.zencode.shared.CodePosition;
12 12
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
13 13
 import org.openzen.zenscript.codemodel.type.GenericTypeID;
14 14
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
-import org.openzen.zenscript.codemodel.type.StoredType;
15
+import org.openzen.zenscript.codemodel.type.TypeID;
16 16
 
17 17
 /**
18 18
  *
@@ -23,9 +23,9 @@ public class GenericMapper {
23 23
 	
24 24
 	public final CodePosition position;
25 25
 	public final GlobalTypeRegistry registry;
26
-	private final Map<TypeParameter, StoredType> mapping;
26
+	private final Map<TypeParameter, TypeID> mapping;
27 27
 	
28
-	public GenericMapper(CodePosition position, GlobalTypeRegistry registry, Map<TypeParameter, StoredType> mapping) {
28
+	public GenericMapper(CodePosition position, GlobalTypeRegistry registry, Map<TypeParameter, TypeID> mapping) {
29 29
 		if (mapping == null)
30 30
 			throw new IllegalArgumentException();
31 31
 		
@@ -34,45 +34,42 @@ public class GenericMapper {
34 34
 		this.mapping = mapping;
35 35
 	}
36 36
 	
37
-	public Map<TypeParameter, StoredType> getMapping() {
37
+	public Map<TypeParameter, TypeID> getMapping() {
38 38
 		return mapping;
39 39
 	}
40 40
 	
41
-	public StoredType map(StoredType original) {
41
+	public TypeID map(TypeID original) {
42 42
 		return mapping.isEmpty() ? original : original.instance(this);
43 43
 	}
44 44
 	
45
-	public StoredType[] map(StoredType[] original) {
45
+	public TypeID[] map(TypeID[] original) {
46 46
 		if (mapping.isEmpty() || original.length == 0)
47 47
 			return original;
48
-		
49
-		StoredType[] mapped = new StoredType[original.length];
48
+
49
+		TypeID[] mapped = new TypeID[original.length];
50 50
 		for (int i = 0; i < original.length; i++)
51 51
 			mapped[i] = original[i].instance(this);
52 52
 		return mapped;
53 53
 	}
54 54
 	
55
-	public StoredType map(GenericTypeID type) {
56
-		//if (!mapping.containsKey(type.parameter))
57
-		//	throw new IllegalStateException("No mapping found for type " + type);
58
-		
59
-		return mapping.containsKey(type.parameter) ? mapping.get(type.parameter) : type.stored();
55
+	public TypeID map(GenericTypeID type) {
56
+		return mapping.getOrDefault(type.parameter, type);
60 57
 	}
61 58
 	
62 59
 	public FunctionHeader map(FunctionHeader original) {
63 60
 		return mapping.isEmpty() ? original : original.withGenericArguments(this);
64 61
 	}
65 62
 	
66
-	public GenericMapper getInner(CodePosition position, GlobalTypeRegistry registry, Map<TypeParameter, StoredType> mapping) {
67
-		Map<TypeParameter, StoredType> resultMap = new HashMap<>(this.mapping);
63
+	public GenericMapper getInner(CodePosition position, GlobalTypeRegistry registry, Map<TypeParameter, TypeID> mapping) {
64
+		Map<TypeParameter, TypeID> resultMap = new HashMap<>(this.mapping);
68 65
 		resultMap.putAll(mapping);
69 66
 		return new GenericMapper(position, registry, resultMap);
70 67
 	}
71 68
 	
72 69
 	public GenericMapper getInner(CodePosition position, GlobalTypeRegistry registry, TypeParameter[] parameters) {
73
-		Map<TypeParameter, StoredType> resultMap = new HashMap<>(this.mapping);
70
+		Map<TypeParameter, TypeID> resultMap = new HashMap<>(this.mapping);
74 71
 		for (TypeParameter parameter : parameters)
75
-			resultMap.put(parameter, new StoredType(registry.getGeneric(parameter), null));
72
+			resultMap.put(parameter, registry.getGeneric(parameter));
76 73
 		return new GenericMapper(position, registry, resultMap);
77 74
 	}
78 75
 	
@@ -84,7 +81,7 @@ public class GenericMapper {
84 81
 		StringBuilder result = new StringBuilder();
85 82
 		result.append('{');
86 83
 		boolean first = true;
87
-		for (Map.Entry<TypeParameter, StoredType> entry : mapping.entrySet()) {
84
+		for (Map.Entry<TypeParameter, TypeID> entry : mapping.entrySet()) {
88 85
 			if (first) {
89 86
 				first = false;
90 87
 			} else {

+ 3
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/GenericName.java View File

@@ -8,7 +8,6 @@ package org.openzen.zenscript.codemodel;
8 8
 import java.util.List;
9 9
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
10 10
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
11
-import org.openzen.zenscript.codemodel.type.StoredType;
12 11
 import org.openzen.zenscript.codemodel.type.TypeID;
13 12
 
14 13
 /**
@@ -17,13 +16,13 @@ import org.openzen.zenscript.codemodel.type.TypeID;
17 16
  */
18 17
 public class GenericName {
19 18
 	public final String name;
20
-	public final StoredType[] arguments;
19
+	public final TypeID[] arguments;
21 20
 	
22 21
 	public GenericName(String name) {
23
-		this(name, StoredType.NONE);
22
+		this(name, TypeID.NONE);
24 23
 	}
25 24
 	
26
-	public GenericName(String name, StoredType[] arguments) {
25
+	public GenericName(String name, TypeID[] arguments) {
27 26
 		if (arguments == null)
28 27
 			throw new NullPointerException("Arguments cannot be null");
29 28
 		

+ 1
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/NativeAnnotationDefinition.java View File

@@ -22,7 +22,6 @@ import org.openzen.zenscript.codemodel.scope.StatementScope;
22 22
 import org.openzen.zenscript.codemodel.serialization.CodeSerializationInput;
23 23
 import org.openzen.zenscript.codemodel.statement.Statement;
24 24
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
25
-import org.openzen.zenscript.codemodel.type.StringTypeID;
26 25
 
27 26
 /**
28 27
  *
@@ -32,7 +31,7 @@ public class NativeAnnotationDefinition implements AnnotationDefinition {
32 31
 	public static final NativeAnnotationDefinition INSTANCE = new NativeAnnotationDefinition();
33 32
 	
34 33
 	private static final List<FunctionHeader> INITIALIZERS = Collections.singletonList(
35
-			new FunctionHeader(BasicTypeID.VOID, StringTypeID.UNIQUE));
34
+			new FunctionHeader(BasicTypeID.VOID, BasicTypeID.STRING));
36 35
 	
37 36
 	private NativeAnnotationDefinition() {}
38 37
 

+ 4
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/PreconditionAnnotationDefinition.java View File

@@ -27,8 +27,6 @@ import org.openzen.zenscript.codemodel.serialization.CodeSerializationInput;
27 27
 import org.openzen.zenscript.codemodel.statement.Statement;
28 28
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
29 29
 import org.openzen.zenscript.codemodel.GenericName;
30
-import org.openzen.zenscript.codemodel.type.StringTypeID;
31
-import org.openzen.zenscript.codemodel.type.storage.ValueStorageTag;
32 30
 
33 31
 /**
34 32
  *
@@ -51,10 +49,10 @@ public class PreconditionAnnotationDefinition implements AnnotationDefinition {
51 49
 	@Override
52 50
 	public List<FunctionHeader> getInitializers(BaseScope scope) {
53 51
 		return Collections.singletonList(new FunctionHeader(
54
-				BasicTypeID.VOID.stored,
55
-				scope.getType(CodePosition.BUILTIN, enforcementLevelName).stored(),
56
-				BasicTypeID.BOOL.stored,
57
-				StringTypeID.UNIQUE));
52
+				BasicTypeID.VOID,
53
+				scope.getType(CodePosition.BUILTIN, enforcementLevelName),
54
+				BasicTypeID.BOOL,
55
+				BasicTypeID.STRING));
58 56
 	}
59 57
 
60 58
 	@Override

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/StatementContext.java View File

@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.expression.switchvalue.VariantOptionSwitc
16 16
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
17 17
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
18 18
 import org.openzen.zenscript.codemodel.statement.VarStatement;
19
-import org.openzen.zenscript.codemodel.type.StoredType;
19
+import org.openzen.zenscript.codemodel.type.TypeID;
20 20
 
21 21
 /**
22 22
  *
@@ -31,7 +31,7 @@ public class StatementContext extends TypeContext {
31 31
 	
32 32
 	public VariantOptionSwitchValue variantOptionSwitchValue;
33 33
 	
34
-	public StatementContext(CodePosition position, ModuleContext module, StoredType thisType) {
34
+	public StatementContext(CodePosition position, ModuleContext module, TypeID thisType) {
35 35
 		super(position, module, TypeParameter.NONE, thisType);
36 36
 		
37 37
 		loops = LoopStatement.NONE;
@@ -40,7 +40,7 @@ public class StatementContext extends TypeContext {
40 40
 		lambdaOuter = null;
41 41
 	}
42 42
 	
43
-	public StatementContext(CodePosition position, ModuleContext module, StoredType thisType, FunctionHeader header) {
43
+	public StatementContext(CodePosition position, ModuleContext module, TypeID thisType, FunctionHeader header) {
44 44
 		super(position, module, header.typeParameters, thisType);
45 45
 		
46 46
 		loops = LoopStatement.NONE;

+ 7
- 7
CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/TypeContext.java View File

@@ -11,7 +11,7 @@ import java.util.Map;
11 11
 import org.openzen.zencode.shared.CodePosition;
12 12
 import org.openzen.zenscript.codemodel.GenericMapper;
13 13
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15 15
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
16 16
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
17 17
 
@@ -22,11 +22,11 @@ import org.openzen.zenscript.codemodel.type.member.TypeMembers;
22 22
 public class TypeContext {
23 23
 	protected final CodePosition position;
24 24
 	protected final TypeParameter[] typeParameters;
25
-	public final StoredType thisType;
25
+	public final TypeID thisType;
26 26
 	private final LocalMemberCache memberCache;
27 27
 	public final ModuleContext moduleContext;
28 28
 	
29
-	public TypeContext(CodePosition position, ModuleContext context, TypeParameter[] parameters, StoredType thisType) {
29
+	public TypeContext(CodePosition position, ModuleContext context, TypeParameter[] parameters, TypeID thisType) {
30 30
 		this.position = position;
31 31
 		this.typeParameters = parameters;
32 32
 		this.thisType = thisType;
@@ -34,7 +34,7 @@ public class TypeContext {
34 34
 		moduleContext = context;
35 35
 	}
36 36
 	
37
-	public TypeContext(CodePosition position, TypeContext outer, StoredType thisType, TypeParameter... inner) {
37
+	public TypeContext(CodePosition position, TypeContext outer, TypeID thisType, TypeParameter... inner) {
38 38
 		this.position = position;
39 39
 		typeParameters = concat(outer.typeParameters, inner);
40 40
 		this.thisType = thisType;
@@ -42,7 +42,7 @@ public class TypeContext {
42 42
 		memberCache = new LocalMemberCache(moduleContext.registry, moduleContext.expansions);
43 43
 	}
44 44
 	
45
-	public TypeContext(CodePosition position, TypeContext outer, StoredType thisType, List<TypeParameter> inner) {
45
+	public TypeContext(CodePosition position, TypeContext outer, TypeID thisType, List<TypeParameter> inner) {
46 46
 		this(position, outer, thisType, inner.toArray(new TypeParameter[inner.size()]));
47 47
 	}
48 48
 	
@@ -58,12 +58,12 @@ public class TypeContext {
58 58
 		return typeParameters[index];
59 59
 	}
60 60
 	
61
-	public TypeMembers getTypeMembers(StoredType type) {
61
+	public TypeMembers getTypeMembers(TypeID type) {
62 62
 		return memberCache.get(type);
63 63
 	}
64 64
 	
65 65
 	public GenericMapper getMapper() {
66
-		Map<TypeParameter, StoredType> mapper = StoredType.getSelfMapping(moduleContext.registry, typeParameters);
66
+		Map<TypeParameter, TypeID> mapper = TypeID.getSelfMapping(moduleContext.registry, typeParameters);
67 67
 		return new GenericMapper(position, moduleContext.registry, mapper);
68 68
 	}
69 69
 	

+ 2
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/TypeResolutionContext.java View File

@@ -11,9 +11,7 @@ import org.openzen.zenscript.codemodel.annotations.AnnotationDefinition;
11 11
 import org.openzen.zenscript.codemodel.GenericName;
12 12
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
13 13
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
15 14
 import org.openzen.zenscript.codemodel.type.TypeID;
16
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
17 15
 
18 16
 /**
19 17
  *
@@ -27,8 +25,6 @@ public interface TypeResolutionContext {
27 25
 	AnnotationDefinition getAnnotation(String name);
28 26
 	
29 27
 	TypeID getType(CodePosition position, List<GenericName> name);
30
-	
31
-	StorageTag getStorageTag(CodePosition position, String name, String[] parameters);
32
-	
33
-	StoredType getThisType();
28
+
29
+	TypeID getThisType();
34 30
 }

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/ExpansionDefinition.java View File

@@ -8,14 +8,14 @@ package org.openzen.zenscript.codemodel.definition;
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
10 10
 import org.openzen.zenscript.codemodel.Module;
11
-import org.openzen.zenscript.codemodel.type.StoredType;
11
+import org.openzen.zenscript.codemodel.type.TypeID;
12 12
 
13 13
 /**
14 14
  *
15 15
  * @author Hoofdgebruiker
16 16
  */
17 17
 public class ExpansionDefinition extends HighLevelDefinition {
18
-	public StoredType target;
18
+	public TypeID target;
19 19
 	
20 20
 	public ExpansionDefinition(CodePosition position, Module module, ZSPackage pkg, int modifiers, HighLevelDefinition outerDefinition) {
21 21
 		super(position, module, pkg, null, modifiers, outerDefinition);

+ 4
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/VariantDefinition.java View File

@@ -13,7 +13,7 @@ import org.openzen.zenscript.codemodel.GenericMapper;
13 13
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
14 14
 import org.openzen.zenscript.codemodel.Module;
15 15
 import org.openzen.zenscript.codemodel.member.ref.VariantOptionRef;
16
-import org.openzen.zenscript.codemodel.type.StoredType;
16
+import org.openzen.zenscript.codemodel.type.TypeID;
17 17
 
18 18
 /**
19 19
  *
@@ -49,9 +49,9 @@ public class VariantDefinition extends HighLevelDefinition {
49 49
 		public final VariantDefinition variant;
50 50
 		public final String name;
51 51
 		public final int ordinal;
52
-		public final StoredType[] types;
52
+		public final TypeID[] types;
53 53
 		
54
-		public Option(CodePosition position, VariantDefinition variant, String name, int ordinal, StoredType[] types) {
54
+		public Option(CodePosition position, VariantDefinition variant, String name, int ordinal, TypeID[] types) {
55 55
 			this.position = position;
56 56
 			this.variant = variant;
57 57
 			this.name = name;
@@ -59,7 +59,7 @@ public class VariantDefinition extends HighLevelDefinition {
59 59
 			this.types = types;
60 60
 		}
61 61
 		
62
-		public VariantOptionRef instance(StoredType variantType, GenericMapper mapper) {
62
+		public VariantOptionRef instance(TypeID variantType, GenericMapper mapper) {
63 63
 			return new VariantOptionRef(this, variantType, mapper.map(types));
64 64
 		}
65 65
 	}

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ArrayExpression.java View File

@@ -8,7 +8,7 @@ package org.openzen.zenscript.codemodel.expression;
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10 10
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
11
-import org.openzen.zenscript.codemodel.type.StoredType;
11
+import org.openzen.zenscript.codemodel.type.TypeID;
12 12
 
13 13
 /**
14 14
  *
@@ -18,11 +18,11 @@ public class ArrayExpression extends Expression {
18 18
 	public final Expression[] expressions;
19 19
 	public final ArrayTypeID arrayType;
20 20
 	
21
-	public ArrayExpression(CodePosition position, Expression[] expressions, StoredType type) {
21
+	public ArrayExpression(CodePosition position, Expression[] expressions, TypeID type) {
22 22
 		super(position, type, multiThrow(position, expressions));
23 23
 		
24 24
 		this.expressions = expressions;
25
-		this.arrayType = (ArrayTypeID)type.type;
25
+		this.arrayType = (ArrayTypeID)type;
26 26
 	}
27 27
 
28 28
 	@Override

+ 7
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CallArguments.java View File

@@ -11,25 +11,26 @@ import org.openzen.zencode.shared.CompileExceptionCode;
11 11
 import org.openzen.zenscript.codemodel.FunctionHeader;
12 12
 import org.openzen.zenscript.codemodel.scope.TypeScope;
13 13
 import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
14 15
 
15 16
 /**
16 17
  *
17 18
  * @author Hoofdgebruiker
18 19
  */
19 20
 public class CallArguments {
20
-	public static final CallArguments EMPTY = new CallArguments(new Expression[0]);
21
+	public static final CallArguments EMPTY = new CallArguments(Expression.NONE);
21 22
 	
22
-	public final StoredType[] typeArguments;
23
+	public final TypeID[] typeArguments;
23 24
 	public final Expression[] arguments;
24 25
 	
25 26
 	public CallArguments(Expression... arguments) {
26
-		this.typeArguments = StoredType.NONE;
27
+		this.typeArguments = TypeID.NONE;
27 28
 		this.arguments = arguments;
28 29
 	}
29 30
 	
30
-	public CallArguments(StoredType[] typeArguments, Expression[] arguments) {
31
+	public CallArguments(TypeID[] typeArguments, Expression[] arguments) {
31 32
 		if (typeArguments == null)
32
-			typeArguments = StoredType.NONE;
33
+			typeArguments = TypeID.NONE;
33 34
 		if (arguments == null)
34 35
 			throw new IllegalArgumentException("Arguments cannot be null!");
35 36
 		
@@ -38,7 +39,7 @@ public class CallArguments {
38 39
 	}
39 40
 	
40 41
 	public CallArguments(StoredType... dummy) {
41
-		this.typeArguments = StoredType.NONE;
42
+		this.typeArguments = TypeID.NONE;
42 43
 		this.arguments = new Expression[dummy.length];
43 44
 		for (int i = 0; i < dummy.length; i++)
44 45
 			arguments[i] = new DummyExpression(dummy[i]);

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public abstract class CapturedExpression extends Expression {
17 17
 	public final LambdaClosure closure;
18 18
 	
19
-	public CapturedExpression(CodePosition position, StoredType type, LambdaClosure closure) {
19
+	public CapturedExpression(CodePosition position, TypeID type, LambdaClosure closure) {
20 20
 		super(position, type, null);
21 21
 		
22 22
 		this.closure = closure;

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedThisExpression.java View File

@@ -7,14 +7,14 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
14 14
  * @author Hoofdgebruiker
15 15
  */
16 16
 public class CapturedThisExpression extends CapturedExpression {
17
-	public CapturedThisExpression(CodePosition position, StoredType type, LambdaClosure closure) {
17
+	public CapturedThisExpression(CodePosition position, TypeID type, LambdaClosure closure) {
18 18
 		super(position, type, closure);
19 19
 	}
20 20
 

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConditionalExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -23,7 +23,7 @@ public class ConditionalExpression extends Expression {
23 23
 			Expression condition,
24 24
 			Expression ifThen,
25 25
 			Expression ifElse,
26
-			StoredType type) {
26
+			TypeID type) {
27 27
 		super(position, type, binaryThrow(position, condition.thrownType, binaryThrow(position, ifThen.thrownType, ifElse.thrownType)));
28 28
 		
29 29
 		if (!ifThen.type.equals(ifElse.type))

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantStringExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StringTypeID;
10
+import org.openzen.zenscript.codemodel.type.BasicTypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -17,7 +17,7 @@ public class ConstantStringExpression extends Expression {
17 17
 	public final String value;
18 18
 	
19 19
 	public ConstantStringExpression(CodePosition position, String value) {
20
-		super(position, StringTypeID.STATIC, null);
20
+		super(position, BasicTypeID.STRING, null);
21 21
 		
22 22
 		this.value = value;
23 23
 	}

+ 4
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstructorSuperCallExpression.java View File

@@ -9,19 +9,19 @@ import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
10 10
 import org.openzen.zenscript.codemodel.scope.TypeScope;
11 11
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
12
-import org.openzen.zenscript.codemodel.type.StoredType;
12
+import org.openzen.zenscript.codemodel.type.TypeID;
13 13
 
14 14
 /**
15 15
  *
16 16
  * @author Hoofdgebruiker
17 17
  */
18 18
 public class ConstructorSuperCallExpression extends Expression {
19
-	public final StoredType objectType;
19
+	public final TypeID objectType;
20 20
 	public final FunctionalMemberRef constructor;
21 21
 	public final CallArguments arguments;
22 22
 	
23
-	public ConstructorSuperCallExpression(CodePosition position, StoredType type, FunctionalMemberRef constructor, CallArguments arguments) {
24
-		super(position, BasicTypeID.VOID.stored, binaryThrow(position, constructor.getHeader().thrownType, multiThrow(position, arguments.arguments)));
23
+	public ConstructorSuperCallExpression(CodePosition position, TypeID type, FunctionalMemberRef constructor, CallArguments arguments) {
24
+		super(position, BasicTypeID.VOID, binaryThrow(position, constructor.getHeader().thrownType, multiThrow(position, arguments.arguments)));
25 25
 		
26 26
 		this.objectType = type;
27 27
 		this.constructor = constructor;

+ 5
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstructorThisCallExpression.java View File

@@ -9,21 +9,21 @@ import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
10 10
 import org.openzen.zenscript.codemodel.scope.TypeScope;
11 11
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
12
-import org.openzen.zenscript.codemodel.type.StoredType;
12
+import org.openzen.zenscript.codemodel.type.TypeID;
13 13
 
14 14
 /**
15 15
  *
16 16
  * @author Hoofdgebruiker
17 17
  */
18 18
 public class ConstructorThisCallExpression extends Expression {
19
-	public final StoredType objectType;
19
+	public final TypeID objectType;
20 20
 	public final FunctionalMemberRef constructor;
21 21
 	public final CallArguments arguments;
22 22
 	
23
-	public ConstructorThisCallExpression(CodePosition position, StoredType type, FunctionalMemberRef constructor, CallArguments arguments) {
24
-		super(position, BasicTypeID.VOID.stored, binaryThrow(position, constructor.getHeader().thrownType, multiThrow(position, arguments.arguments)));
23
+	public ConstructorThisCallExpression(CodePosition position, TypeID type, FunctionalMemberRef constructor, CallArguments arguments) {
24
+		super(position, BasicTypeID.VOID, binaryThrow(position, constructor.getHeader().thrownType, multiThrow(position, arguments.arguments)));
25 25
 		
26
-		if (type.type instanceof BasicTypeID)
26
+		if (type instanceof BasicTypeID)
27 27
 			throw new IllegalArgumentException("Type cannot be basic type");
28 28
 		
29 29
 		this.objectType = type;

+ 17
- 19
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/Expression.java View File

@@ -7,7 +7,6 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import java.util.Collections;
9 9
 import java.util.List;
10
-import java.util.Objects;
11 10
 import java.util.function.Consumer;
12 11
 import java.util.stream.Collectors;
13 12
 import org.openzen.zencode.shared.CodePosition;
@@ -18,14 +17,13 @@ import org.openzen.zenscript.codemodel.OperatorType;
18 17
 import org.openzen.zenscript.codemodel.member.EnumConstantMember;
19 18
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
20 19
 import org.openzen.zenscript.codemodel.GenericName;
20
+import org.openzen.zenscript.codemodel.type.TypeID;
21 21
 import org.openzen.zenscript.codemodel.type.member.TypeMemberGroup;
22 22
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
23 23
 import org.openzen.zenscript.codemodel.scope.TypeScope;
24 24
 import org.openzen.zenscript.codemodel.statement.Statement;
25 25
 import org.openzen.zenscript.codemodel.statement.StatementTransformer;
26 26
 import org.openzen.zenscript.codemodel.type.InvalidTypeID;
27
-import org.openzen.zenscript.codemodel.type.StoredType;
28
-import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
29 27
 
30 28
 /**
31 29
  *
@@ -35,10 +33,10 @@ public abstract class Expression implements IPartialExpression {
35 33
 	public static final Expression[] NONE = new Expression[0];
36 34
 	
37 35
 	public final CodePosition position;
38
-	public final StoredType type;
39
-	public final StoredType thrownType;
36
+	public final TypeID type;
37
+	public final TypeID thrownType;
40 38
 	
41
-	public Expression(CodePosition position, StoredType type, StoredType thrownType) {
39
+	public Expression(CodePosition position, TypeID type, TypeID thrownType) {
42 40
 		if (type == null)
43 41
 			throw new NullPointerException();
44 42
 		//if (type.type == BasicTypeID.UNDETERMINED)
@@ -73,7 +71,7 @@ public abstract class Expression implements IPartialExpression {
73 71
 	public abstract Expression normalize(TypeScope scope);
74 72
 	
75 73
 	@Override
76
-	public List<StoredType> getAssignHints() {
74
+	public List<TypeID> getAssignHints() {
77 75
 		return Collections.singletonList(type);
78 76
 	}
79 77
 	
@@ -82,11 +80,11 @@ public abstract class Expression implements IPartialExpression {
82 80
 		return this;
83 81
 	}
84 82
 	
85
-	public Expression castExplicit(CodePosition position, TypeScope scope, StoredType asType, boolean optional) {
83
+	public Expression castExplicit(CodePosition position, TypeScope scope, TypeID asType, boolean optional) {
86 84
 		return scope.getTypeMembers(type).castExplicit(position, this, asType, optional);
87 85
 	}
88 86
 	
89
-	public Expression castImplicit(CodePosition position, TypeScope scope, StoredType asType) {
87
+	public Expression castImplicit(CodePosition position, TypeScope scope, TypeID asType) {
90 88
 		return scope.getTypeMembers(type).castImplicit(position, this, asType, true);
91 89
 	}
92 90
 	
@@ -101,13 +99,13 @@ public abstract class Expression implements IPartialExpression {
101 99
 	}
102 100
 	
103 101
 	@Override
104
-	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) {
102
+	public List<TypeID>[] predictCallTypes(CodePosition position, TypeScope scope, List<TypeID> hints, int arguments) {
105 103
 		TypeMemberGroup group = scope.getTypeMembers(type).getGroup(OperatorType.CALL);
106 104
 		return group.predictCallTypes(position, scope, hints, arguments);
107 105
 	}
108 106
 	
109 107
 	@Override
110
-	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) {
108
+	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<TypeID> hints, int arguments) {
111 109
 		TypeMemberGroup group = scope.getTypeMembers(type).getGroup(OperatorType.CALL);
112 110
 		return group.getMethodMembers().stream()
113 111
 				.filter(method -> method.member.getHeader().accepts(arguments) && !method.member.isStatic())
@@ -116,13 +114,13 @@ public abstract class Expression implements IPartialExpression {
116 114
 	}
117 115
 	
118 116
 	@Override
119
-	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException {
117
+	public Expression call(CodePosition position, TypeScope scope, List<TypeID> hints, CallArguments arguments) throws CompileException {
120 118
 		TypeMemberGroup group = scope.getTypeMembers(type).getGroup(OperatorType.CALL);
121 119
 		return group.call(position, scope, this, arguments, false);
122 120
 	}
123 121
 	
124 122
 	@Override
125
-	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<StoredType> hints, GenericName name) {
123
+	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<TypeID> hints, GenericName name) {
126 124
 		TypeMembers members = scope.getTypeMembers(type);
127 125
 		IPartialExpression result = members.getMemberExpression(position, scope, this, name, false);
128 126
 		if (result == null)
@@ -131,7 +129,7 @@ public abstract class Expression implements IPartialExpression {
131 129
 	}
132 130
 	
133 131
 	@Override
134
-	public StoredType[] getTypeArguments() {
132
+	public TypeID[] getTypeArguments() {
135 133
 		return null;
136 134
 	}
137 135
 	
@@ -147,19 +145,19 @@ public abstract class Expression implements IPartialExpression {
147 145
 		throw new UnsupportedOperationException("Cannot evaluate this value to an enum constant!");
148 146
 	}
149 147
 	
150
-	public static StoredType binaryThrow(CodePosition position, StoredType left, StoredType right) {
151
-		if (Objects.equals(left, right))
148
+	public static TypeID binaryThrow(CodePosition position, TypeID left, TypeID right) {
149
+		if (left == right)
152 150
 			return left;
153 151
 		else if (left == null)
154 152
 			return right;
155 153
 		else if (right == null)
156 154
 			return left;
157 155
 		else
158
-			return new InvalidTypeID(position, CompileExceptionCode.DIFFERENT_EXCEPTIONS, "two different exceptions in same operation: " + left.toString() + " and " + right.toString()).stored(UniqueStorageTag.INSTANCE);
156
+			return new InvalidTypeID(position, CompileExceptionCode.DIFFERENT_EXCEPTIONS, "two different exceptions in same operation: " + left.toString() + " and " + right.toString());
159 157
 	}
160 158
 	
161
-	public static StoredType multiThrow(CodePosition position, Expression[] expressions) {
162
-		StoredType result = null;
159
+	public static TypeID multiThrow(CodePosition position, Expression[] expressions) {
160
+		TypeID result = null;
163 161
 		for (Expression expression : expressions)
164 162
 			result = binaryThrow(position, result, expression.thrownType);
165 163
 		return result;

+ 1
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionVisitor.java View File

@@ -137,9 +137,7 @@ public interface ExpressionVisitor<T> {
137 137
 	T visitStaticGetter(StaticGetterExpression expression);
138 138
 	
139 139
 	T visitStaticSetter(StaticSetterExpression expression);
140
-	
141
-	T visitStorageCast(StorageCastExpression expression);
142
-	
140
+
143 141
 	T visitSupertypeCast(SupertypeCastExpression expression);
144 142
 	
145 143
 	T visitThis(ThisExpression expression);

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/FunctionExpression.java View File

@@ -17,7 +17,7 @@ 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.StoredType;
20
+import org.openzen.zenscript.codemodel.type.TypeID;
21 21
 
22 22
 /**
23 23
  *
@@ -30,7 +30,7 @@ public class FunctionExpression extends Expression {
30 30
 	
31 31
 	public FunctionExpression(
32 32
 			CodePosition position,
33
-			StoredType type,
33
+			TypeID type,
34 34
 			LambdaClosure closure,
35 35
 			FunctionHeader header,
36 36
 			Statement body) {

+ 3
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/InvalidExpression.java View File

@@ -5,12 +5,11 @@
5 5
  */
6 6
 package org.openzen.zenscript.codemodel.expression;
7 7
 
8
-import jdk.nashorn.internal.ir.Assignment;
9 8
 import org.openzen.zencode.shared.CodePosition;
10 9
 import org.openzen.zencode.shared.CompileException;
11 10
 import org.openzen.zencode.shared.CompileExceptionCode;
12 11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
13
-import org.openzen.zenscript.codemodel.type.StoredType;
12
+import org.openzen.zenscript.codemodel.type.TypeID;
14 13
 
15 14
 /**
16 15
  *
@@ -20,14 +19,14 @@ public class InvalidExpression extends Expression {
20 19
 	public final CompileExceptionCode code;
21 20
 	public final String message;
22 21
 	
23
-	public InvalidExpression(CodePosition position, StoredType type, CompileExceptionCode code, String message) {
22
+	public InvalidExpression(CodePosition position, TypeID type, CompileExceptionCode code, String message) {
24 23
 		super(position, type, null);
25 24
 		
26 25
 		this.code = code;
27 26
 		this.message = message;
28 27
 	}
29 28
 	
30
-	public InvalidExpression(StoredType type, CompileException cause) {
29
+	public InvalidExpression(TypeID type, CompileException cause) {
31 30
 		this(cause.position, type, cause.code, cause.message);
32 31
 	}
33 32
 	

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MapExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -21,7 +21,7 @@ public class MapExpression extends Expression {
21 21
 			CodePosition position,
22 22
 			Expression[] keys,
23 23
 			Expression[] values,
24
-			StoredType type) {
24
+			TypeID type) {
25 25
 		super(position, type, binaryThrow(position, multiThrow(position, keys), multiThrow(position, values)));
26 26
 		
27 27
 		this.keys = keys;

+ 6
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MatchExpression.java View File

@@ -18,7 +18,7 @@ import org.openzen.zenscript.codemodel.statement.SwitchStatement;
18 18
 import org.openzen.zenscript.codemodel.statement.VarStatement;
19 19
 import org.openzen.zenscript.codemodel.statement.VariableID;
20 20
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
21
-import org.openzen.zenscript.codemodel.type.StoredType;
21
+import org.openzen.zenscript.codemodel.type.TypeID;
22 22
 
23 23
 /**
24 24
  *
@@ -28,7 +28,7 @@ public class MatchExpression extends Expression {
28 28
 	public final Expression value;
29 29
 	public final Case[] cases;
30 30
 	
31
-	public MatchExpression(CodePosition position, Expression value, StoredType type, Case[] cases) {
31
+	public MatchExpression(CodePosition position, Expression value, TypeID type, Case[] cases) {
32 32
 		super(position, type, binaryThrow(position, value.thrownType, getThrownType(position, cases)));
33 33
 		
34 34
 		this.value = value;
@@ -89,7 +89,7 @@ public class MatchExpression extends Expression {
89 89
 				hasDefault = true;
90 90
 		}
91 91
 		if (!hasDefault) {
92
-			Statement defaultCase = new ExpressionStatement(position, new PanicExpression(position, BasicTypeID.VOID.stored, new ConstantStringExpression(position, "Missing case")));
92
+			Statement defaultCase = new ExpressionStatement(position, new PanicExpression(position, BasicTypeID.VOID, new ConstantStringExpression(position, "Missing case")));
93 93
 			switchStatement.cases.add(new SwitchCase(null, new Statement[] { defaultCase }));
94 94
 		}
95 95
 		return new SwitchedMatch(result, switchStatement);
@@ -124,11 +124,11 @@ public class MatchExpression extends Expression {
124 124
 		}
125 125
 	}
126 126
 	
127
-	private static StoredType getThrownType(CodePosition position, Case[] cases) {
127
+	private static TypeID getThrownType(CodePosition position, Case[] cases) {
128 128
 		if (cases.length == 0)
129 129
 			return null;
130
-		
131
-		StoredType result = cases[0].value.thrownType;
130
+
131
+		TypeID result = cases[0].value.thrownType;
132 132
 		for (int i = 1; i < cases.length; i++)
133 133
 			result = binaryThrow(position, result, cases[i].value.thrownType);
134 134
 		

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NewExpression.java View File

@@ -9,7 +9,7 @@ import org.openzen.zencode.shared.CodePosition;
9 9
 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
-import org.openzen.zenscript.codemodel.type.StoredType;
12
+import org.openzen.zenscript.codemodel.type.TypeID;
13 13
 
14 14
 /**
15 15
  *
@@ -22,7 +22,7 @@ public class NewExpression extends Expression {
22 22
 	
23 23
 	public NewExpression(
24 24
 			CodePosition position,
25
-			StoredType type,
25
+			TypeID type,
26 26
 			FunctionalMemberRef constructor,
27 27
 			CallArguments arguments)
28 28
 	{
@@ -31,7 +31,7 @@ public class NewExpression extends Expression {
31 31
 	
32 32
 	public NewExpression(
33 33
 			CodePosition position,
34
-			StoredType type,
34
+			TypeID type,
35 35
 			FunctionalMemberRef constructor,
36 36
 			CallArguments arguments,
37 37
 			FunctionHeader instancedHeader)

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NullExpression.java View File

@@ -8,7 +8,7 @@ package org.openzen.zenscript.codemodel.expression;
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10 10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
11
-import org.openzen.zenscript.codemodel.type.StoredType;
11
+import org.openzen.zenscript.codemodel.type.TypeID;
12 12
 
13 13
 /**
14 14
  *
@@ -16,10 +16,10 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
  */
17 17
 public class NullExpression extends Expression {
18 18
 	public NullExpression(CodePosition position) {
19
-		super(position, BasicTypeID.NULL.stored, null);
19
+		super(position, BasicTypeID.NULL, null);
20 20
 	}
21 21
 	
22
-	public NullExpression(CodePosition position, StoredType optionalType) {
22
+	public NullExpression(CodePosition position, TypeID optionalType) {
23 23
 		super(position, optionalType, null);
24 24
 	}
25 25
 

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/PanicExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class PanicExpression extends Expression {
17 17
 	public final Expression value;
18 18
 	
19
-	public PanicExpression(CodePosition position, StoredType type, Expression value) {
19
+	public PanicExpression(CodePosition position, TypeID type, Expression value) {
20 20
 		super(position, type, null);
21 21
 		
22 22
 		this.value = value;

+ 4
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/RangeExpression.java View File

@@ -8,7 +8,7 @@ package org.openzen.zenscript.codemodel.expression;
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10 10
 import org.openzen.zenscript.codemodel.type.RangeTypeID;
11
-import org.openzen.zenscript.codemodel.type.StoredType;
11
+import org.openzen.zenscript.codemodel.type.TypeID;
12 12
 
13 13
 /**
14 14
  *
@@ -18,14 +18,14 @@ public class RangeExpression extends Expression {
18 18
 	public final Expression from;
19 19
 	public final Expression to;
20 20
 	
21
-	public RangeExpression(CodePosition position, StoredType type, Expression from, Expression to) {
21
+	public RangeExpression(CodePosition position, TypeID type, Expression from, Expression to) {
22 22
 		super(position, type, binaryThrow(position, from.thrownType, to.thrownType));
23 23
 	
24 24
 		this.from = from;
25 25
 		this.to = to;
26 26
 	}
27 27
 	
28
-	private RangeExpression(CodePosition position, StoredType type, Expression from, Expression to, StoredType thrownType) {
28
+	private RangeExpression(CodePosition position, TypeID type, Expression from, Expression to, TypeID thrownType) {
29 29
 		super(position, type, thrownType);
30 30
 		
31 31
 		this.from = from;
@@ -51,7 +51,7 @@ public class RangeExpression extends Expression {
51 51
 
52 52
 	@Override
53 53
 	public Expression normalize(TypeScope scope) {
54
-		StoredType baseType = ((RangeTypeID)type.type).baseType;
54
+		TypeID baseType = ((RangeTypeID)type).baseType;
55 55
 		return new RangeExpression(
56 56
 				position,
57 57
 				type.getNormalized(),

+ 0
- 46
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/StorageCastExpression.java View File

@@ -1,46 +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.zencode.shared.CodePosition;
9
-import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
11
-
12
-/**
13
- *
14
- * @author Hoofdgebruiker
15
- */
16
-public class StorageCastExpression extends Expression {
17
-	public final Expression value;
18
-	
19
-	public StorageCastExpression(CodePosition position, Expression value, StoredType toType) {
20
-		super(position, toType, value.thrownType);
21
-		
22
-		this.value = value;
23
-	}
24
-
25
-	@Override
26
-	public <T> T accept(ExpressionVisitor<T> visitor) {
27
-		return visitor.visitStorageCast(this);
28
-	}
29
-
30
-	@Override
31
-	public <C, R> R accept(C context, ExpressionVisitorWithContext<C, R> visitor) {
32
-		return visitor.visitStorageCast(context, this);
33
-	}
34
-
35
-	@Override
36
-	public Expression transform(ExpressionTransformer transformer) {
37
-		Expression transformed = transformer.transform(value);
38
-		return transformed == this ? this : new StorageCastExpression(position, transformed, type);
39
-	}
40
-
41
-	@Override
42
-	public Expression normalize(TypeScope scope) {
43
-		Expression normalized = value.normalize(scope);
44
-		return normalized == value ? this : new StorageCastExpression(position, normalized, type);
45
-	}
46
-}

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SupertypeCastExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  * Using to cast a class type to a base type.
@@ -17,7 +17,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
17 17
 public class SupertypeCastExpression extends Expression {
18 18
 	public final Expression value;
19 19
 	
20
-	public SupertypeCastExpression(CodePosition position, Expression value, StoredType type) {
20
+	public SupertypeCastExpression(CodePosition position, Expression value, TypeID type) {
21 21
 		super(position, type, value.thrownType);
22 22
 		
23 23
 		this.value = value;

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThisExpression.java View File

@@ -8,14 +8,14 @@ package org.openzen.zenscript.codemodel.expression;
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
10 10
 import org.openzen.zenscript.codemodel.scope.TypeScope;
11
-import org.openzen.zenscript.codemodel.type.StoredType;
11
+import org.openzen.zenscript.codemodel.type.TypeID;
12 12
 
13 13
 /**
14 14
  *
15 15
  * @author Hoofdgebruiker
16 16
  */
17 17
 public class ThisExpression extends Expression {
18
-	public ThisExpression(CodePosition position, StoredType type) {
18
+	public ThisExpression(CodePosition position, TypeID type) {
19 19
 		super(position, type, null);
20 20
 	}
21 21
 	

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThrowExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class ThrowExpression extends Expression {
17 17
 	public final Expression value;
18 18
 	
19
-	public ThrowExpression(CodePosition position, StoredType type, Expression value) {
19
+	public ThrowExpression(CodePosition position, TypeID type, Expression value) {
20 20
 		super(position, type, value.type);
21 21
 		
22 22
 		this.value = value;

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryConvertExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class TryConvertExpression extends Expression {
17 17
 	public final Expression value;
18 18
 	
19
-	public TryConvertExpression(CodePosition position, StoredType type, Expression value) {
19
+	public TryConvertExpression(CodePosition position, TypeID type, Expression value) {
20 20
 		super(position, type, null);
21 21
 		
22 22
 		this.value = value;

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryRethrowAsExceptionExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class TryRethrowAsExceptionExpression extends Expression {
17 17
 	public final Expression value;
18 18
 	
19
-	public TryRethrowAsExceptionExpression(CodePosition position, StoredType type, Expression value, StoredType thrownType) {
19
+	public TryRethrowAsExceptionExpression(CodePosition position, TypeID type, Expression value, TypeID thrownType) {
20 20
 		super(position, type, thrownType);
21 21
 		
22 22
 		this.value = value;

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryRethrowAsResultExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class TryRethrowAsResultExpression extends Expression {
17 17
 	public final Expression value;
18 18
 	
19
-	public TryRethrowAsResultExpression(CodePosition position, StoredType type, Expression value) {
19
+	public TryRethrowAsResultExpression(CodePosition position, TypeID type, Expression value) {
20 20
 		super(position, type, null);
21 21
 		
22 22
 		this.value = value;

+ 4
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/VariantValueExpression.java View File

@@ -10,7 +10,7 @@ import org.openzen.zencode.shared.CodePosition;
10 10
 import org.openzen.zencode.shared.CompileException;
11 11
 import org.openzen.zenscript.codemodel.member.ref.VariantOptionRef;
12 12
 import org.openzen.zenscript.codemodel.scope.TypeScope;
13
-import org.openzen.zenscript.codemodel.type.StoredType;
13
+import org.openzen.zenscript.codemodel.type.TypeID;
14 14
 
15 15
 /**
16 16
  *
@@ -20,11 +20,11 @@ public class VariantValueExpression extends Expression {
20 20
 	public final VariantOptionRef option;
21 21
 	public final Expression[] arguments;
22 22
 	
23
-	public VariantValueExpression(CodePosition position, StoredType variantType, VariantOptionRef option) {
23
+	public VariantValueExpression(CodePosition position, TypeID variantType, VariantOptionRef option) {
24 24
 		this(position, variantType, option, Expression.NONE);
25 25
 	}
26 26
 	
27
-	public VariantValueExpression(CodePosition position, StoredType variantType, VariantOptionRef option, Expression[] arguments) {
27
+	public VariantValueExpression(CodePosition position, TypeID variantType, VariantOptionRef option, Expression[] arguments) {
28 28
 		super(position, variantType, multiThrow(position, arguments));
29 29
 		
30 30
 		this.option = option;
@@ -36,7 +36,7 @@ public class VariantValueExpression extends Expression {
36 36
 	}
37 37
 	
38 38
 	@Override
39
-	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException {
39
+	public Expression call(CodePosition position, TypeScope scope, List<TypeID> hints, CallArguments arguments) throws CompileException {
40 40
 		if (arguments != null)
41 41
 			return super.call(position, scope, hints, arguments);
42 42
 		

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/WrapOptionalExpression.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.expression;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class WrapOptionalExpression extends Expression {
17 17
 	public final Expression value;
18 18
 	
19
-	public WrapOptionalExpression(CodePosition position, Expression value, StoredType optionalType) {
19
+	public WrapOptionalExpression(CodePosition position, Expression value, TypeID optionalType) {
20 20
 		super(position, optionalType, value.thrownType);
21 21
 		
22 22
 		if (value.type.isOptional())

+ 0
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/TypeParameter.java View File

@@ -11,7 +11,6 @@ import org.openzen.zencode.shared.CodePosition;
11 11
 import org.openzen.zencode.shared.Taggable;
12 12
 import org.openzen.zenscript.codemodel.type.TypeID;
13 13
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
14
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
15 14
 
16 15
 /**
17 16
  *
@@ -22,7 +21,6 @@ public class TypeParameter extends Taggable {
22 21
 	
23 22
 	public final CodePosition position;
24 23
 	public final String name;
25
-	public StorageTag storage = null;
26 24
 	public final List<TypeParameterBound> bounds = new ArrayList<>();
27 25
 	
28 26
 	public TypeParameter(CodePosition position, String name) {

+ 4
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/CasterMember.java View File

@@ -13,8 +13,8 @@ import org.openzen.zenscript.codemodel.Modifiers;
13 13
 import org.openzen.zenscript.codemodel.member.ref.CasterMemberRef;
14 14
 import org.openzen.zenscript.codemodel.scope.TypeScope;
15 15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
16
+import org.openzen.zenscript.codemodel.type.TypeID;
16 17
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
17
-import org.openzen.zenscript.codemodel.type.StoredType;
18 18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
19 19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
20 20
 
@@ -23,14 +23,14 @@ import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
23 23
  * @author Hoofdgebruiker
24 24
  */
25 25
 public class CasterMember extends FunctionalMember {
26
-	public StoredType toType;
26
+	public TypeID toType;
27 27
 	public CasterMemberRef overrides;
28 28
 	
29 29
 	public CasterMember(
30 30
 			CodePosition position,
31 31
 			HighLevelDefinition definition,
32 32
 			int modifiers,
33
-			StoredType toType,
33
+			TypeID toType,
34 34
 			BuiltinID builtin)
35 35
 	{
36 36
 		super(position, definition, modifiers, new FunctionHeader(toType), builtin);
@@ -58,7 +58,7 @@ public class CasterMember extends FunctionalMember {
58 58
 		return "caster to " + toType.toString();
59 59
 	}
60 60
 	
61
-	public StoredType getTargetType() {
61
+	public TypeID getTargetType() {
62 62
 		return toType;
63 63
 	}
64 64
 	

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ConstMember.java View File

@@ -14,7 +14,7 @@ import org.openzen.zenscript.codemodel.expression.Expression;
14 14
 import org.openzen.zenscript.codemodel.member.ref.ConstMemberRef;
15 15
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
16 16
 import org.openzen.zenscript.codemodel.scope.TypeScope;
17
-import org.openzen.zenscript.codemodel.type.StoredType;
17
+import org.openzen.zenscript.codemodel.type.TypeID;
18 18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
19 19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
20 20
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
@@ -27,7 +27,7 @@ public class ConstMember extends PropertyMember {
27 27
 	public final String name;
28 28
 	public Expression value;
29 29
 	
30
-	public ConstMember(CodePosition position, HighLevelDefinition definition, int modifiers, String name, StoredType type, BuiltinID builtin) {
30
+	public ConstMember(CodePosition position, HighLevelDefinition definition, int modifiers, String name, TypeID type, BuiltinID builtin) {
31 31
 		super(position, definition, modifiers, type, builtin);
32 32
 		
33 33
 		this.name = name;
@@ -81,7 +81,7 @@ public class ConstMember extends PropertyMember {
81 81
 	}
82 82
 
83 83
 	@Override
84
-	public DefinitionMemberRef ref(StoredType type, GenericMapper mapper) {
84
+	public DefinitionMemberRef ref(TypeID type, GenericMapper mapper) {
85 85
 		return new ConstMemberRef(type, this, mapper);
86 86
 	}
87 87
 	

+ 4
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FieldMember.java View File

@@ -22,7 +22,6 @@ import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
22 22
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
23 23
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
24 24
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
25
-import org.openzen.zenscript.codemodel.type.StoredType;
26 25
 import org.openzen.zenscript.codemodel.type.TypeID;
27 26
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
28 27
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
@@ -45,8 +44,8 @@ public class FieldMember extends PropertyMember {
45 44
 			HighLevelDefinition definition,
46 45
 			int modifiers,
47 46
 			String name,
48
-			StoredType thisType,
49
-			StoredType type,
47
+			TypeID thisType,
48
+			TypeID type,
50 49
 			GlobalTypeRegistry registry,
51 50
 			int autoGetterAccess,
52 51
 			int autoSetterAccess,
@@ -92,7 +91,7 @@ public class FieldMember extends PropertyMember {
92 91
 			HighLevelDefinition definition,
93 92
 			int modifiers,
94 93
 			String name,
95
-			StoredType type,
94
+			TypeID type,
96 95
 			int autoGetterAccess,
97 96
 			int autoSetterAccess,
98 97
 			GetterMember autoGetter,
@@ -173,7 +172,7 @@ public class FieldMember extends PropertyMember {
173 172
 	}
174 173
 
175 174
 	@Override
176
-	public DefinitionMemberRef ref(StoredType type, GenericMapper mapper) {
175
+	public DefinitionMemberRef ref(TypeID type, GenericMapper mapper) {
177 176
 		return new FieldMemberRef(type, this, mapper);
178 177
 	}
179 178
 	

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FunctionalMember.java View File

@@ -15,7 +15,7 @@ import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
15 15
 import org.openzen.zenscript.codemodel.scope.TypeScope;
16 16
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
17 17
 import org.openzen.zenscript.codemodel.statement.Statement;
18
-import org.openzen.zenscript.codemodel.type.StoredType;
18
+import org.openzen.zenscript.codemodel.type.TypeID;
19 19
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
20 20
 
21 21
 /**
@@ -47,12 +47,12 @@ public abstract class FunctionalMember extends DefinitionMember {
47 47
 	
48 48
 	public abstract FunctionalKind getKind();
49 49
 	
50
-	public FunctionalMemberRef ref(StoredType type) {
50
+	public FunctionalMemberRef ref(TypeID type) {
51 51
 		return new FunctionalMemberRef(this, type, null);
52 52
 	}
53 53
 	
54 54
 	@Override
55
-	public FunctionalMemberRef ref(StoredType type, GenericMapper mapper) {
55
+	public FunctionalMemberRef ref(TypeID type, GenericMapper mapper) {
56 56
 		return new FunctionalMemberRef(this, type, mapper);
57 57
 	}
58 58
 	

+ 6
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/GetterMember.java View File

@@ -16,8 +16,8 @@ import org.openzen.zenscript.codemodel.scope.TypeScope;
16 16
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
17 17
 import org.openzen.zenscript.codemodel.statement.Statement;
18 18
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
19
+import org.openzen.zenscript.codemodel.type.TypeID;
19 20
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
20
-import org.openzen.zenscript.codemodel.type.StoredType;
21 21
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
22 22
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
23 23
 
@@ -35,7 +35,7 @@ public class GetterMember extends PropertyMember {
35 35
 			HighLevelDefinition definition,
36 36
 			int modifiers,
37 37
 			String name,
38
-			StoredType type,
38
+			TypeID type,
39 39
 			BuiltinID builtin) {
40 40
 		super(position, definition, modifiers, type, builtin);
41 41
 		
@@ -45,8 +45,8 @@ public class GetterMember extends PropertyMember {
45 45
 	public void setBody(Statement body) {
46 46
 		this.body = body;
47 47
 		
48
-		if (getType().type == BasicTypeID.UNDETERMINED) {
49
-			StoredType returnType = body.getReturnType();
48
+		if (getType() == BasicTypeID.UNDETERMINED) {
49
+			TypeID returnType = body.getReturnType();
50 50
 			if (returnType != null)
51 51
 				setType(returnType);
52 52
 		}
@@ -102,12 +102,12 @@ public class GetterMember extends PropertyMember {
102 102
 	public void setOverrides(GetterMemberRef override) {
103 103
 		this.overrides = override;
104 104
 		
105
-		if (getType().type == BasicTypeID.UNDETERMINED)
105
+		if (getType() == BasicTypeID.UNDETERMINED)
106 106
 			setType(override.getType());
107 107
 	}
108 108
 
109 109
 	@Override
110
-	public GetterMemberRef ref(StoredType type, GenericMapper mapper) {
110
+	public GetterMemberRef ref(TypeID type, GenericMapper mapper) {
111 111
 		return new GetterMemberRef(type, this, mapper);
112 112
 	}
113 113
 	

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/IDefinitionMember.java View File

@@ -14,7 +14,7 @@ import org.openzen.zenscript.codemodel.HighLevelDefinition;
14 14
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
15 15
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
16 16
 import org.openzen.zenscript.codemodel.scope.TypeScope;
17
-import org.openzen.zenscript.codemodel.type.StoredType;
17
+import org.openzen.zenscript.codemodel.type.TypeID;
18 18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
19 19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
20 20
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
@@ -56,7 +56,7 @@ public interface IDefinitionMember {
56 56
 	
57 57
 	boolean isAbstract();
58 58
 	
59
-	DefinitionMemberRef ref(StoredType type, GenericMapper mapper);
59
+	DefinitionMemberRef ref(TypeID type, GenericMapper mapper);
60 60
 	
61 61
 	FunctionHeader getHeader();
62 62
 	

+ 4
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/InnerDefinition.java View File

@@ -11,7 +11,7 @@ import org.openzen.zenscript.codemodel.HighLevelDefinition;
11 11
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
12 12
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
13 13
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15 15
 
16 16
 /**
17 17
  *
@@ -19,19 +19,19 @@ import org.openzen.zenscript.codemodel.type.StoredType;
19 19
  */
20 20
 public class InnerDefinition {
21 21
 	public final HighLevelDefinition definition;
22
-	public final Map<TypeParameter, StoredType> outerTypeArguments;
22
+	public final Map<TypeParameter, TypeID> outerTypeArguments;
23 23
 	
24 24
 	public InnerDefinition(HighLevelDefinition definition) {
25 25
 		this.definition = definition;
26 26
 		this.outerTypeArguments = Collections.emptyMap();
27 27
 	}
28 28
 	
29
-	public InnerDefinition(HighLevelDefinition definition, Map<TypeParameter, StoredType> outerTypeArguments) {
29
+	public InnerDefinition(HighLevelDefinition definition, Map<TypeParameter, TypeID> outerTypeArguments) {
30 30
 		this.definition = definition;
31 31
 		this.outerTypeArguments = outerTypeArguments;
32 32
 	}
33 33
 	
34
-	public DefinitionTypeID instance(GlobalTypeRegistry registry, StoredType[] typeArguments, DefinitionTypeID outer) {
34
+	public DefinitionTypeID instance(GlobalTypeRegistry registry, TypeID[] typeArguments, DefinitionTypeID outer) {
35 35
 		return registry.getForDefinition(definition, typeArguments, outer);
36 36
 	}
37 37
 }

+ 6
- 7
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/IteratorMember.java View File

@@ -13,22 +13,21 @@ import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
13 13
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
14 14
 import org.openzen.zenscript.codemodel.statement.Statement;
15 15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
16
-import org.openzen.zenscript.codemodel.type.StoredType;
16
+import org.openzen.zenscript.codemodel.type.TypeID;
17 17
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
18 18
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
19 19
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
20
-import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
21 20
 
22 21
 /**
23 22
  *
24 23
  * @author Hoofdgebruiker
25 24
  */
26 25
 public class IteratorMember extends FunctionalMember {
27
-	private final StoredType[] iteratorTypes;
26
+	private final TypeID[] iteratorTypes;
28 27
 	public Statement body;
29 28
 	public IteratorMemberRef overrides;
30 29
 	
31
-	public IteratorMember(CodePosition position, HighLevelDefinition definition, int modifiers, StoredType[] iteratorTypes, GlobalTypeRegistry registry, BuiltinID builtin) {
30
+	public IteratorMember(CodePosition position, HighLevelDefinition definition, int modifiers, TypeID[] iteratorTypes, GlobalTypeRegistry registry, BuiltinID builtin) {
32 31
 		super(position, definition, modifiers, createIteratorHeader(registry, iteratorTypes), builtin);
33 32
 		
34 33
 		this.iteratorTypes = iteratorTypes;
@@ -47,7 +46,7 @@ public class IteratorMember extends FunctionalMember {
47 46
 		return iteratorTypes.length;
48 47
 	}
49 48
 	
50
-	public StoredType[] getLoopVariableTypes() {
49
+	public TypeID[] getLoopVariableTypes() {
51 50
 		return iteratorTypes;
52 51
 	}
53 52
 
@@ -85,7 +84,7 @@ public class IteratorMember extends FunctionalMember {
85 84
 		return FunctionalKind.ITERATOR;
86 85
 	}
87 86
 	
88
-	private static FunctionHeader createIteratorHeader(GlobalTypeRegistry registry, StoredType[] iteratorTypes) {
89
-		return new FunctionHeader(registry.getIterator(iteratorTypes).stored(UniqueStorageTag.INSTANCE));
87
+	private static FunctionHeader createIteratorHeader(GlobalTypeRegistry registry, TypeID[] iteratorTypes) {
88
+		return new FunctionHeader(registry.getIterator(iteratorTypes));
90 89
 	}
91 90
 }

+ 5
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/PropertyMember.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.member;
7 7
 
8 8
 import org.openzen.zencode.shared.CodePosition;
9 9
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
12 12
 
13 13
 /**
@@ -15,10 +15,10 @@ import org.openzen.zenscript.codemodel.type.member.BuiltinID;
15 15
  * @author Hoofdgebruiker
16 16
  */
17 17
 public abstract class PropertyMember extends DefinitionMember {
18
-	private StoredType type;
18
+	private TypeID type;
19 19
 	public final BuiltinID builtin;
20 20
 	
21
-	public PropertyMember(CodePosition position, HighLevelDefinition definition, int modifiers, StoredType type, BuiltinID builtin) {
21
+	public PropertyMember(CodePosition position, HighLevelDefinition definition, int modifiers, TypeID type, BuiltinID builtin) {
22 22
 		super(position, definition, modifiers);
23 23
 		
24 24
 		if (type == null)
@@ -28,11 +28,11 @@ public abstract class PropertyMember extends DefinitionMember {
28 28
 		this.builtin = builtin;
29 29
 	}
30 30
 	
31
-	public StoredType getType() {
31
+	public TypeID getType() {
32 32
 		return type;
33 33
 	}
34 34
 	
35
-	public void setType(StoredType type) {
35
+	public void setType(TypeID type) {
36 36
 		if (type == null)
37 37
 			throw new NullPointerException();
38 38
 		

+ 4
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/SetterMember.java View File

@@ -18,7 +18,7 @@ import org.openzen.zenscript.codemodel.scope.TypeScope;
18 18
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
19 19
 import org.openzen.zenscript.codemodel.statement.Statement;
20 20
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
21
-import org.openzen.zenscript.codemodel.type.StoredType;
21
+import org.openzen.zenscript.codemodel.type.TypeID;
22 22
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
23 23
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
24 24
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
@@ -38,7 +38,7 @@ public class SetterMember extends PropertyMember {
38 38
 			HighLevelDefinition definition,
39 39
 			int modifiers,
40 40
 			String name,
41
-			StoredType type,
41
+			TypeID type,
42 42
 			BuiltinID builtin)
43 43
 	{
44 44
 		super(position,
@@ -105,14 +105,14 @@ public class SetterMember extends PropertyMember {
105 105
 	public void setOverrides(SetterMemberRef overrides) {
106 106
 		this.overrides = overrides;
107 107
 		
108
-		if (getType().type == BasicTypeID.UNDETERMINED) {
108
+		if (getType() == BasicTypeID.UNDETERMINED) {
109 109
 			setType(overrides.getType());
110 110
 			parameter = new FunctionParameter(overrides.getType(), "value");
111 111
 		}
112 112
 	}
113 113
 
114 114
 	@Override
115
-	public DefinitionMemberRef ref(StoredType type, GenericMapper mapper) {
115
+	public DefinitionMemberRef ref(TypeID type, GenericMapper mapper) {
116 116
 		return new SetterMemberRef(type, this, mapper);
117 117
 	}
118 118
 	

+ 5
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/CasterMemberRef.java View File

@@ -15,6 +15,7 @@ import org.openzen.zenscript.codemodel.expression.Expression;
15 15
 import org.openzen.zenscript.codemodel.member.CasterMember;
16 16
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
17 17
 import org.openzen.zenscript.codemodel.type.StoredType;
18
+import org.openzen.zenscript.codemodel.type.TypeID;
18 19
 
19 20
 /**
20 21
  *
@@ -22,10 +23,10 @@ import org.openzen.zenscript.codemodel.type.StoredType;
22 23
  */
23 24
 public class CasterMemberRef implements DefinitionMemberRef {
24 25
 	public final CasterMember member;
25
-	public final StoredType type;
26
-	public final StoredType toType;
26
+	public final TypeID type;
27
+	public final TypeID toType;
27 28
 	
28
-	public CasterMemberRef(CasterMember member, StoredType type, StoredType toType) {
29
+	public CasterMemberRef(CasterMember member, TypeID type, TypeID toType) {
29 30
 		this.member = member;
30 31
 		this.type = type;
31 32
 		this.toType = toType;
@@ -37,7 +38,7 @@ public class CasterMemberRef implements DefinitionMemberRef {
37 38
 	}
38 39
 	
39 40
 	@Override
40
-	public StoredType getOwnerType() {
41
+	public TypeID getOwnerType() {
41 42
 		return type;
42 43
 	}
43 44
 

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/ConstMemberRef.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.member.ref;
7 7
 
8 8
 import org.openzen.zenscript.codemodel.GenericMapper;
9 9
 import org.openzen.zenscript.codemodel.member.ConstMember;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class ConstMemberRef extends PropertyRef {
17 17
 	public final ConstMember member;
18 18
 	
19
-	public ConstMemberRef(StoredType owner, ConstMember member, GenericMapper mapper) {
19
+	public ConstMemberRef(TypeID owner, ConstMember member, GenericMapper mapper) {
20 20
 		super(owner, member, mapper);
21 21
 		this.member = member;
22 22
 	}

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/DefinitionMemberRef.java View File

@@ -10,7 +10,7 @@ import org.openzen.zencode.shared.Tag;
10 10
 import org.openzen.zenscript.codemodel.FunctionHeader;
11 11
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
12 12
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
13
-import org.openzen.zenscript.codemodel.type.StoredType;
13
+import org.openzen.zenscript.codemodel.type.TypeID;
14 14
 
15 15
 /**
16 16
  *
@@ -29,7 +29,7 @@ public interface DefinitionMemberRef {
29 29
 		return getTarget().hasTag(type);
30 30
 	}
31 31
 	
32
-	StoredType getOwnerType();
32
+	TypeID getOwnerType();
33 33
 	
34 34
 	DefinitionMemberRef getOverrides();
35 35
 	

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/FieldMemberRef.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.member.ref;
7 7
 
8 8
 import org.openzen.zenscript.codemodel.GenericMapper;
9 9
 import org.openzen.zenscript.codemodel.member.FieldMember;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class FieldMemberRef extends PropertyRef {
17 17
 	public final FieldMember member;
18 18
 	
19
-	public FieldMemberRef(StoredType owner, FieldMember member, GenericMapper mapper) {
19
+	public FieldMemberRef(TypeID owner, FieldMember member, GenericMapper mapper) {
20 20
 		super(owner, member, mapper);
21 21
 		this.member = member;
22 22
 	}

+ 3
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/FunctionalMemberRef.java View File

@@ -22,7 +22,6 @@ import org.openzen.zenscript.codemodel.member.FunctionalMember;
22 22
 import org.openzen.zenscript.codemodel.member.MethodMember;
23 23
 import org.openzen.zenscript.codemodel.member.OperatorMember;
24 24
 import org.openzen.zenscript.codemodel.scope.TypeScope;
25
-import org.openzen.zenscript.codemodel.type.StoredType;
26 25
 import org.openzen.zenscript.codemodel.type.TypeID;
27 26
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
28 27
 
@@ -34,10 +33,10 @@ public class FunctionalMemberRef implements DefinitionMemberRef {
34 33
 	private final FunctionalMember target;
35 34
 	
36 35
 	private FunctionHeader header;
37
-	private final StoredType type;
36
+	private final TypeID type;
38 37
 	private GenericMapper mapper;
39 38
 	
40
-	public FunctionalMemberRef(FunctionalMember target, StoredType type, GenericMapper mapper) {
39
+	public FunctionalMemberRef(FunctionalMember target, TypeID type, GenericMapper mapper) {
41 40
 		this.target = target;
42 41
 		this.type = type;
43 42
 		
@@ -73,7 +72,7 @@ public class FunctionalMemberRef implements DefinitionMemberRef {
73 72
 	}
74 73
 	
75 74
 	@Override
76
-	public StoredType getOwnerType() {
75
+	public TypeID getOwnerType() {
77 76
 		return type;
78 77
 	}
79 78
 	

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/GetterMemberRef.java View File

@@ -11,7 +11,7 @@ import org.openzen.zenscript.codemodel.expression.Expression;
11 11
 import org.openzen.zenscript.codemodel.expression.GetterExpression;
12 12
 import org.openzen.zenscript.codemodel.expression.StaticGetterExpression;
13 13
 import org.openzen.zenscript.codemodel.member.GetterMember;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15 15
 
16 16
 /**
17 17
  *
@@ -20,7 +20,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
20 20
 public class GetterMemberRef extends PropertyRef {
21 21
 	public final GetterMember member;
22 22
 	
23
-	public GetterMemberRef(StoredType owner, GetterMember member, GenericMapper mapper) {
23
+	public GetterMemberRef(TypeID owner, GetterMember member, GenericMapper mapper) {
24 24
 		super(owner, member, mapper);
25 25
 		
26 26
 		this.member = member;

+ 5
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/ImplementationMemberRef.java View File

@@ -12,6 +12,7 @@ import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
12 12
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
13 13
 import org.openzen.zenscript.codemodel.member.ImplementationMember;
14 14
 import org.openzen.zenscript.codemodel.type.StoredType;
15
+import org.openzen.zenscript.codemodel.type.TypeID;
15 16
 
16 17
 /**
17 18
  *
@@ -19,10 +20,10 @@ import org.openzen.zenscript.codemodel.type.StoredType;
19 20
  */
20 21
 public class ImplementationMemberRef implements DefinitionMemberRef {
21 22
 	public final ImplementationMember member;
22
-	private final StoredType type;
23
-	public final StoredType implementsType;
23
+	private final TypeID type;
24
+	public final TypeID implementsType;
24 25
 	
25
-	public ImplementationMemberRef(ImplementationMember member, StoredType owner, StoredType implementsType) {
26
+	public ImplementationMemberRef(ImplementationMember member, TypeID owner, TypeID implementsType) {
26 27
 		this.member = member;
27 28
 		this.type = owner;
28 29
 		this.implementsType = implementsType;
@@ -34,7 +35,7 @@ public class ImplementationMemberRef implements DefinitionMemberRef {
34 35
 	}
35 36
 	
36 37
 	@Override
37
-	public StoredType getOwnerType() {
38
+	public TypeID getOwnerType() {
38 39
 		return type;
39 40
 	}
40 41
 

+ 6
- 10
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/IteratorMemberRef.java View File

@@ -11,7 +11,7 @@ import org.openzen.zenscript.codemodel.FunctionHeader;
11 11
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
12 12
 import org.openzen.zenscript.codemodel.member.IteratorMember;
13 13
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15 15
 
16 16
 /**
17 17
  *
@@ -19,10 +19,10 @@ import org.openzen.zenscript.codemodel.type.StoredType;
19 19
  */
20 20
 public class IteratorMemberRef implements DefinitionMemberRef {
21 21
 	public final IteratorMember target;
22
-	private final StoredType owner;
23
-	public final StoredType[] types;
22
+	private final TypeID owner;
23
+	public final TypeID[] types;
24 24
 	
25
-	public IteratorMemberRef(IteratorMember target, StoredType owner, StoredType... types) {
25
+	public IteratorMemberRef(IteratorMember target, TypeID owner, TypeID... types) {
26 26
 		this.target = target;
27 27
 		this.owner = owner;
28 28
 		this.types = types;
@@ -34,7 +34,7 @@ public class IteratorMemberRef implements DefinitionMemberRef {
34 34
 	}
35 35
 	
36 36
 	@Override
37
-	public StoredType getOwnerType() {
37
+	public TypeID getOwnerType() {
38 38
 		return owner;
39 39
 	}
40 40
 
@@ -64,11 +64,7 @@ public class IteratorMemberRef implements DefinitionMemberRef {
64 64
 
65 65
 	@Override
66 66
 	public MemberAnnotation[] getAnnotations() {
67
-		if (target instanceof IteratorMember) {
68
-			return ((IteratorMember)target).annotations;
69
-		} else {
70
-			return null;
71
-		}
67
+		return target.annotations;
72 68
 	}
73 69
 
74 70
 	@Override

+ 7
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/PropertyRef.java View File

@@ -14,6 +14,7 @@ import org.openzen.zenscript.codemodel.member.IDefinitionMember;
14 14
 import org.openzen.zenscript.codemodel.member.PropertyMember;
15 15
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
16 16
 import org.openzen.zenscript.codemodel.type.StoredType;
17
+import org.openzen.zenscript.codemodel.type.TypeID;
17 18
 
18 19
 /**
19 20
  *
@@ -22,15 +23,15 @@ import org.openzen.zenscript.codemodel.type.StoredType;
22 23
 public abstract class PropertyRef implements DefinitionMemberRef {
23 24
 	private final PropertyMember member;
24 25
 	
25
-	private final StoredType owner;
26
-	private StoredType type;
26
+	private final TypeID owner;
27
+	private TypeID type;
27 28
 	private GenericMapper mapper;
28 29
 	
29
-	public PropertyRef(StoredType owner, PropertyMember member, GenericMapper mapper) {
30
+	public PropertyRef(TypeID owner, PropertyMember member, GenericMapper mapper) {
30 31
 		this.owner = owner;
31 32
 		this.member = member;
32 33
 		
33
-		if (member.getType().type == BasicTypeID.UNDETERMINED) {
34
+		if (member.getType() == BasicTypeID.UNDETERMINED) {
34 35
 			type = null;
35 36
 			this.mapper = mapper;
36 37
 		} else {
@@ -40,11 +41,11 @@ public abstract class PropertyRef implements DefinitionMemberRef {
40 41
 	}
41 42
 	
42 43
 	@Override
43
-	public final StoredType getOwnerType() {
44
+	public final TypeID getOwnerType() {
44 45
 		return owner;
45 46
 	}
46 47
 	
47
-	public final StoredType getType() {
48
+	public final TypeID getType() {
48 49
 		if (type == null) {
49 50
 			//if (member.getType().type == BasicTypeID.UNDETERMINED)
50 51
 			//	throw new IllegalStateException("Property is not yet resolved!");

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/SetterMemberRef.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.member.ref;
7 7
 
8 8
 import org.openzen.zenscript.codemodel.GenericMapper;
9 9
 import org.openzen.zenscript.codemodel.member.SetterMember;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -16,7 +16,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
16 16
 public class SetterMemberRef extends PropertyRef {
17 17
 	public final SetterMember member;
18 18
 	
19
-	public SetterMemberRef(StoredType owner, SetterMember member, GenericMapper mapper) {
19
+	public SetterMemberRef(TypeID owner, SetterMember member, GenericMapper mapper) {
20 20
 		super(owner, member, mapper);
21 21
 		
22 22
 		this.member = member;

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/TranslatedOperatorMemberRef.java View File

@@ -13,7 +13,7 @@ import org.openzen.zenscript.codemodel.expression.CallTranslator;
13 13
 import org.openzen.zenscript.codemodel.expression.Expression;
14 14
 import org.openzen.zenscript.codemodel.member.OperatorMember;
15 15
 import org.openzen.zenscript.codemodel.scope.TypeScope;
16
-import org.openzen.zenscript.codemodel.type.StoredType;
16
+import org.openzen.zenscript.codemodel.type.TypeID;
17 17
 
18 18
 /**
19 19
  *
@@ -22,7 +22,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
22 22
 public class TranslatedOperatorMemberRef extends FunctionalMemberRef {
23 23
 	private final CallTranslator translator;
24 24
 	
25
-	public TranslatedOperatorMemberRef(OperatorMember member, StoredType type, GenericMapper mapper, CallTranslator translator) {
25
+	public TranslatedOperatorMemberRef(OperatorMember member, TypeID type, GenericMapper mapper, CallTranslator translator) {
26 26
 		super(member, type, mapper);
27 27
 		
28 28
 		this.translator = translator;

+ 5
- 5
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/VariantOptionRef.java View File

@@ -7,7 +7,7 @@ package org.openzen.zenscript.codemodel.member.ref;
7 7
 
8 8
 import org.openzen.zencode.shared.Tag;
9 9
 import org.openzen.zenscript.codemodel.definition.VariantDefinition;
10
-import org.openzen.zenscript.codemodel.type.StoredType;
10
+import org.openzen.zenscript.codemodel.type.TypeID;
11 11
 
12 12
 /**
13 13
  *
@@ -15,10 +15,10 @@ import org.openzen.zenscript.codemodel.type.StoredType;
15 15
  */
16 16
 public class VariantOptionRef {
17 17
 	private final VariantDefinition.Option option;
18
-	public final StoredType variant;
19
-	public final StoredType[] types;
18
+	public final TypeID variant;
19
+	public final TypeID[] types;
20 20
 	
21
-	public VariantOptionRef(VariantDefinition.Option option, StoredType variant, StoredType[] types) {
21
+	public VariantOptionRef(VariantDefinition.Option option, TypeID variant, TypeID[] types) {
22 22
 		this.option = option;
23 23
 		this.variant = variant;
24 24
 		this.types = types;
@@ -28,7 +28,7 @@ public class VariantOptionRef {
28 28
 		return option.name;
29 29
 	}
30 30
 	
31
-	public StoredType getParameterType(int index) {
31
+	public TypeID getParameterType(int index) {
32 32
 		return types[index];
33 33
 	}
34 34
 	

+ 8
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/IPartialExpression.java View File

@@ -18,28 +18,28 @@ import org.openzen.zenscript.codemodel.expression.LambdaClosure;
18 18
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
19 19
 import org.openzen.zenscript.codemodel.GenericName;
20 20
 import org.openzen.zenscript.codemodel.scope.TypeScope;
21
-import org.openzen.zenscript.codemodel.type.StoredType;
21
+import org.openzen.zenscript.codemodel.type.TypeID;
22 22
 
23 23
 /**
24 24
  *
25 25
  * @author Hoofdgebruiker
26 26
  */
27 27
 public interface IPartialExpression {
28
-	default List<StoredType> getAssignHints() {
28
+	default List<TypeID> getAssignHints() {
29 29
 		return Collections.emptyList();
30 30
 	}
31 31
 	
32 32
 	Expression eval() throws CompileException;
33 33
 	
34
-	List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) throws CompileException;
34
+	List<TypeID>[] predictCallTypes(CodePosition position, TypeScope scope, List<TypeID> hints, int arguments) throws CompileException;
35 35
 	
36
-	List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) throws CompileException;
36
+	List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<TypeID> hints, int arguments) throws CompileException;
37 37
 	
38
-	IPartialExpression getMember(CodePosition position, TypeScope scope, List<StoredType> hints, GenericName name) throws CompileException;
38
+	IPartialExpression getMember(CodePosition position, TypeScope scope, List<TypeID> hints, GenericName name) throws CompileException;
39 39
 	
40
-	Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException;
41
-	
42
-	StoredType[] getTypeArguments();
40
+	Expression call(CodePosition position, TypeScope scope, List<TypeID> hints, CallArguments arguments) throws CompileException;
41
+
42
+	TypeID[] getTypeArguments();
43 43
 	
44 44
 	/**
45 45
 	 * Retrieves the (primary) member this expression refers to, or null if there is no primary target.

+ 8
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialGlobalExpression.java View File

@@ -15,7 +15,7 @@ import org.openzen.zenscript.codemodel.expression.GlobalCallExpression;
15 15
 import org.openzen.zenscript.codemodel.expression.GlobalExpression;
16 16
 import org.openzen.zenscript.codemodel.scope.TypeScope;
17 17
 import org.openzen.zenscript.codemodel.GenericName;
18
-import org.openzen.zenscript.codemodel.type.StoredType;
18
+import org.openzen.zenscript.codemodel.type.TypeID;
19 19
 
20 20
 /**
21 21
  *
@@ -25,9 +25,9 @@ public class PartialGlobalExpression implements IPartialExpression {
25 25
 	private final CodePosition position;
26 26
 	private final String name;
27 27
 	private final IPartialExpression resolution;
28
-	private final StoredType[] typeArguments;
28
+	private final TypeID[] typeArguments;
29 29
 	
30
-	public PartialGlobalExpression(CodePosition position, String name, IPartialExpression resolution, StoredType[] typeArguments) {
30
+	public PartialGlobalExpression(CodePosition position, String name, IPartialExpression resolution, TypeID[] typeArguments) {
31 31
 		this.position = position;
32 32
 		this.name = name;
33 33
 		this.resolution = resolution;
@@ -40,27 +40,27 @@ public class PartialGlobalExpression implements IPartialExpression {
40 40
 	}
41 41
 
42 42
 	@Override
43
-	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) throws CompileException {
43
+	public List<TypeID>[] predictCallTypes(CodePosition position, TypeScope scope, List<TypeID> hints, int arguments) throws CompileException {
44 44
 		return resolution.predictCallTypes(position, scope, hints, arguments);
45 45
 	}
46 46
 
47 47
 	@Override
48
-	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) throws CompileException {
48
+	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<TypeID> hints, int arguments) throws CompileException {
49 49
 		return resolution.getPossibleFunctionHeaders(scope, hints, arguments);
50 50
 	}
51 51
 
52 52
 	@Override
53
-	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<StoredType> hints, GenericName name) throws CompileException {
53
+	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<TypeID> hints, GenericName name) throws CompileException {
54 54
 		return eval().getMember(position, scope, hints, name);
55 55
 	}
56 56
 
57 57
 	@Override
58
-	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException {
58
+	public Expression call(CodePosition position, TypeScope scope, List<TypeID> hints, CallArguments arguments) throws CompileException {
59 59
 		return new GlobalCallExpression(position, name, arguments, resolution.call(position, scope, hints, arguments));
60 60
 	}
61 61
 
62 62
 	@Override
63
-	public StoredType[] getTypeArguments() {
63
+	public TypeID[] getTypeArguments() {
64 64
 		return typeArguments;
65 65
 	}
66 66
 }

+ 10
- 10
CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialMemberGroupExpression.java View File

@@ -15,10 +15,10 @@ import org.openzen.zenscript.codemodel.expression.CallArguments;
15 15
 import org.openzen.zenscript.codemodel.expression.Expression;
16 16
 import org.openzen.zenscript.codemodel.expression.LambdaClosure;
17 17
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
18
+import org.openzen.zenscript.codemodel.type.TypeID;
18 19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberGroup;
19 20
 import org.openzen.zenscript.codemodel.GenericName;
20 21
 import org.openzen.zenscript.codemodel.scope.TypeScope;
21
-import org.openzen.zenscript.codemodel.type.StoredType;
22 22
 import org.openzen.zenscript.codemodel.type.member.TypeMember;
23 23
 
24 24
 /**
@@ -29,7 +29,7 @@ public class PartialMemberGroupExpression implements IPartialExpression {
29 29
 	private final CodePosition position;
30 30
 	private final Expression target;
31 31
 	private final TypeMemberGroup group;
32
-	private final StoredType[] typeArguments;
32
+	private final TypeID[] typeArguments;
33 33
 	private final boolean allowStaticUsage;
34 34
 	private final TypeScope scope;
35 35
 	
@@ -38,7 +38,7 @@ public class PartialMemberGroupExpression implements IPartialExpression {
38 38
 			TypeScope scope,
39 39
 			Expression target,
40 40
 			TypeMemberGroup group,
41
-			StoredType[] typeArguments,
41
+			TypeID[] typeArguments,
42 42
 			boolean allowStaticMembers)
43 43
 	{
44 44
 		this.position = position;
@@ -55,7 +55,7 @@ public class PartialMemberGroupExpression implements IPartialExpression {
55 55
 			Expression target,
56 56
 			String name,
57 57
 			FunctionalMemberRef member,
58
-			StoredType[] typeArguments,
58
+			TypeID[] typeArguments,
59 59
 			boolean allowStaticMembers)
60 60
 	{
61 61
 		this.position = position;
@@ -72,7 +72,7 @@ public class PartialMemberGroupExpression implements IPartialExpression {
72 72
 	}
73 73
 	
74 74
 	@Override
75
-	public List<StoredType> getAssignHints() {
75
+	public List<TypeID> getAssignHints() {
76 76
 		if (group.getSetter() != null)
77 77
 			return Collections.singletonList(group.getSetter().getType());
78 78
 		if (group.getField() != null)
@@ -82,12 +82,12 @@ public class PartialMemberGroupExpression implements IPartialExpression {
82 82
 	}
83 83
 
84 84
 	@Override
85
-	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) {
85
+	public List<TypeID>[] predictCallTypes(CodePosition position, TypeScope scope, List<TypeID> hints, int arguments) {
86 86
 		return group.predictCallTypes(position, scope, hints, arguments);
87 87
 	}
88 88
 	
89 89
 	@Override
90
-	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) {
90
+	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<TypeID> hints, int arguments) {
91 91
 		List<FunctionHeader> results = new ArrayList<>();
92 92
 		for (TypeMember<FunctionalMemberRef> method : group.getMethodMembers()) {
93 93
 			if (!method.member.accepts(arguments) || method.member.isStatic())
@@ -106,12 +106,12 @@ public class PartialMemberGroupExpression implements IPartialExpression {
106 106
 	}
107 107
 
108 108
 	@Override
109
-	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<StoredType> hints, GenericName name) throws CompileException {
109
+	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<TypeID> hints, GenericName name) throws CompileException {
110 110
 		return eval().getMember(position, scope, hints, name);
111 111
 	}
112 112
 
113 113
 	@Override
114
-	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException {
114
+	public Expression call(CodePosition position, TypeScope scope, List<TypeID> hints, CallArguments arguments) throws CompileException {
115 115
 		return group.call(position, scope, target, arguments, allowStaticUsage);
116 116
 	}
117 117
 	
@@ -126,7 +126,7 @@ public class PartialMemberGroupExpression implements IPartialExpression {
126 126
 	}
127 127
 
128 128
 	@Override
129
-	public StoredType[] getTypeArguments() {
129
+	public TypeID[] getTypeArguments() {
130 130
 		return typeArguments;
131 131
 	}
132 132
 }

+ 8
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialStaticMemberGroupExpression.java View File

@@ -30,9 +30,9 @@ public class PartialStaticMemberGroupExpression implements IPartialExpression {
30 30
 	private final TypeScope scope;
31 31
 	private final TypeID target;
32 32
 	private final TypeMemberGroup group;
33
-	private final StoredType[] typeArguments;
33
+	private final TypeID[] typeArguments;
34 34
 	
35
-	public PartialStaticMemberGroupExpression(CodePosition position, TypeScope scope, TypeID target, TypeMemberGroup group, StoredType[] typeArguments) {
35
+	public PartialStaticMemberGroupExpression(CodePosition position, TypeScope scope, TypeID target, TypeMemberGroup group, TypeID[] typeArguments) {
36 36
 		this.position = position;
37 37
 		this.scope = scope;
38 38
 		this.group = group;
@@ -46,12 +46,12 @@ public class PartialStaticMemberGroupExpression implements IPartialExpression {
46 46
 	}
47 47
 
48 48
 	@Override
49
-	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) {
49
+	public List<TypeID>[] predictCallTypes(CodePosition position, TypeScope scope, List<TypeID> hints, int arguments) {
50 50
 		return group.predictCallTypes(position, scope, hints, arguments);
51 51
 	}
52 52
 	
53 53
 	@Override
54
-	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) {
54
+	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<TypeID> hints, int arguments) {
55 55
 		return group.getMethodMembers().stream()
56 56
 				.filter(method -> method.member.getHeader().accepts(arguments) && method.member.isStatic())
57 57
 				.map(method -> method.member.getHeader())
@@ -59,12 +59,12 @@ public class PartialStaticMemberGroupExpression implements IPartialExpression {
59 59
 	}
60 60
 
61 61
 	@Override
62
-	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<StoredType> hints, GenericName name) throws CompileException {
62
+	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<TypeID> hints, GenericName name) throws CompileException {
63 63
 		return eval().getMember(position, scope, hints, name);
64 64
 	}
65 65
 
66 66
 	@Override
67
-	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException {
67
+	public Expression call(CodePosition position, TypeScope scope, List<TypeID> hints, CallArguments arguments) throws CompileException {
68 68
 		return group.callStatic(position, target, scope, arguments);
69 69
 	}
70 70
 	
@@ -74,12 +74,12 @@ public class PartialStaticMemberGroupExpression implements IPartialExpression {
74 74
 	}
75 75
 
76 76
 	@Override
77
-	public StoredType[] getTypeArguments() {
77
+	public TypeID[] getTypeArguments() {
78 78
 		return typeArguments;
79 79
 	}
80 80
 	
81 81
 	@Override
82
-	public List<StoredType> getAssignHints() {
82
+	public List<TypeID> getAssignHints() {
83 83
 		if (group.getSetter() != null)
84 84
 			return Collections.singletonList(group.getSetter().getType());
85 85
 		if (group.getField() != null)

+ 10
- 13
CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialTypeExpression.java View File

@@ -5,7 +5,6 @@
5 5
  */
6 6
 package org.openzen.zenscript.codemodel.partial;
7 7
 
8
-import java.util.Collections;
9 8
 import java.util.List;
10 9
 import java.util.stream.Collectors;
11 10
 import org.openzen.zencode.shared.CodePosition;
@@ -19,10 +18,8 @@ import org.openzen.zenscript.codemodel.expression.InvalidExpression;
19 18
 import org.openzen.zenscript.codemodel.expression.LambdaClosure;
20 19
 import org.openzen.zenscript.codemodel.GenericName;
21 20
 import org.openzen.zenscript.codemodel.scope.TypeScope;
22
-import org.openzen.zenscript.codemodel.type.StoredType;
23 21
 import org.openzen.zenscript.codemodel.type.TypeID;
24 22
 import org.openzen.zenscript.codemodel.type.member.TypeMemberGroup;
25
-import org.openzen.zenscript.codemodel.type.storage.StaticExpressionStorageTag;
26 23
 
27 24
 /**
28 25
  *
@@ -30,12 +27,12 @@ import org.openzen.zenscript.codemodel.type.storage.StaticExpressionStorageTag;
30 27
  */
31 28
 public class PartialTypeExpression implements IPartialExpression {
32 29
 	private final CodePosition position;
33
-	private final StoredType type;
34
-	private final StoredType[] typeArguments;
30
+	private final TypeID type;
31
+	private final TypeID[] typeArguments;
35 32
 	
36
-	public PartialTypeExpression(CodePosition position, TypeID type, StoredType[] typeArguments) {
33
+	public PartialTypeExpression(CodePosition position, TypeID type, TypeID[] typeArguments) {
37 34
 		this.position = position;
38
-		this.type = type.stored(StaticExpressionStorageTag.INSTANCE);
35
+		this.type = type;
39 36
 		this.typeArguments = typeArguments;
40 37
 	}
41 38
 
@@ -45,7 +42,7 @@ public class PartialTypeExpression implements IPartialExpression {
45 42
 	}
46 43
 
47 44
 	@Override
48
-	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) {
45
+	public List<TypeID>[] predictCallTypes(CodePosition position, TypeScope scope, List<TypeID> hints, int arguments) {
49 46
 		TypeMemberGroup group = scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CALL);
50 47
 		if (group == null)
51 48
 			return new List[0];
@@ -54,7 +51,7 @@ public class PartialTypeExpression implements IPartialExpression {
54 51
 	}
55 52
 	
56 53
 	@Override
57
-	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) {
54
+	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<TypeID> hints, int arguments) {
58 55
 		TypeMemberGroup group = scope.getTypeMembers(type).getGroup(OperatorType.CALL);
59 56
 		return group
60 57
 				.getMethodMembers().stream()
@@ -64,12 +61,12 @@ public class PartialTypeExpression implements IPartialExpression {
64 61
 	}
65 62
 
66 63
 	@Override
67
-	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<StoredType> hints, GenericName name) {
64
+	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<TypeID> hints, GenericName name) {
68 65
 		return scope.getTypeMembers(type).getStaticMemberExpression(position, scope, name);
69 66
 	}
70 67
 
71 68
 	@Override
72
-	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) throws CompileException {
69
+	public Expression call(CodePosition position, TypeScope scope, List<TypeID> hints, CallArguments arguments) throws CompileException {
73 70
 		if (arguments.getNumberOfTypeArguments() == 0 && (typeArguments != null && typeArguments.length > 0))
74 71
 			arguments = new CallArguments(typeArguments, arguments.arguments);
75 72
 
@@ -77,11 +74,11 @@ public class PartialTypeExpression implements IPartialExpression {
77 74
 		if (group == null)
78 75
 			throw new CompileException(position, CompileExceptionCode.NO_SUCH_MEMBER, "This type has not call operator");
79 76
 
80
-		return group.callStatic(position, type.type, scope, arguments);
77
+		return group.callStatic(position, type, scope, arguments);
81 78
 	}
82 79
 
83 80
 	@Override
84
-	public StoredType[] getTypeArguments() {
81
+	public TypeID[] getTypeArguments() {
85 82
 		return typeArguments;
86 83
 	}
87 84
 	

+ 7
- 7
CodeModel/src/main/java/org/openzen/zenscript/codemodel/partial/PartialVariantOptionExpression.java View File

@@ -19,7 +19,7 @@ import org.openzen.zenscript.codemodel.expression.VariantValueExpression;
19 19
 import org.openzen.zenscript.codemodel.member.ref.VariantOptionRef;
20 20
 import org.openzen.zenscript.codemodel.scope.TypeScope;
21 21
 import org.openzen.zenscript.codemodel.GenericName;
22
-import org.openzen.zenscript.codemodel.type.StoredType;
22
+import org.openzen.zenscript.codemodel.type.TypeID;
23 23
 
24 24
 /**
25 25
  *
@@ -42,7 +42,7 @@ public class PartialVariantOptionExpression implements IPartialExpression {
42 42
 	}
43 43
 
44 44
 	@Override
45
-	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> hints, int arguments) {
45
+	public List<TypeID>[] predictCallTypes(CodePosition position, TypeScope scope, List<TypeID> hints, int arguments) {
46 46
 		if (arguments != option.getOption().types.length)
47 47
 			return new List[0];
48 48
 		
@@ -50,7 +50,7 @@ public class PartialVariantOptionExpression implements IPartialExpression {
50 50
 	}
51 51
 
52 52
 	@Override
53
-	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<StoredType> hints, int arguments) {
53
+	public List<FunctionHeader> getPossibleFunctionHeaders(TypeScope scope, List<TypeID> hints, int arguments) {
54 54
 		if (arguments != option.getOption().types.length)
55 55
 			return Collections.emptyList();
56 56
 		
@@ -58,17 +58,17 @@ public class PartialVariantOptionExpression implements IPartialExpression {
58 58
 	}
59 59
 
60 60
 	@Override
61
-	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<StoredType> hints, GenericName name) throws CompileException {
61
+	public IPartialExpression getMember(CodePosition position, TypeScope scope, List<TypeID> hints, GenericName name) throws CompileException {
62 62
 		throw new CompileException(position, CompileExceptionCode.NO_SUCH_MEMBER, "Variant options don't have members");
63 63
 	}
64 64
 
65 65
 	@Override
66
-	public Expression call(CodePosition position, TypeScope scope, List<StoredType> hints, CallArguments arguments) {
66
+	public Expression call(CodePosition position, TypeScope scope, List<TypeID> hints, CallArguments arguments) {
67 67
 		return new VariantValueExpression(position, option.variant, option, arguments.arguments);
68 68
 	}
69 69
 
70 70
 	@Override
71
-	public StoredType[] getTypeArguments() {
72
-		return StoredType.NONE;
71
+	public TypeID[] getTypeArguments() {
72
+		return TypeID.NONE;
73 73
 	}
74 74
 }

+ 7
- 14
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/DefinitionScope.java View File

@@ -32,9 +32,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
32 32
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
33 33
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPreparer;
34 34
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
35
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
36 35
 import org.openzen.zenscript.codemodel.type.TypeID;
37
-import org.openzen.zenscript.codemodel.type.storage.StaticExpressionStorageTag;
38 36
 
39 37
 /**
40 38
  *
@@ -43,7 +41,7 @@ import org.openzen.zenscript.codemodel.type.storage.StaticExpressionStorageTag;
43 41
 public class DefinitionScope extends BaseScope {
44 42
 	private final BaseScope outer;
45 43
 	private final HighLevelDefinition definition;
46
-	private final StoredType type;
44
+	private final TypeID type;
47 45
 	private final TypeMembers members;
48 46
 	private final TypeParameter[] typeParameters;
49 47
 	private final GenericMapper typeParameterMap;
@@ -56,19 +54,19 @@ public class DefinitionScope extends BaseScope {
56 54
 		this.outer = outer;
57 55
 		this.definition = definition;
58 56
 		
59
-		Map<TypeParameter, StoredType> typeParameters = new HashMap<>();
57
+		Map<TypeParameter, TypeID> typeParameters = new HashMap<>();
60 58
 		if (definition instanceof ExpansionDefinition) {
61 59
 			ExpansionDefinition expansion = (ExpansionDefinition)definition;
62 60
 			type = expansion.target;
63 61
 			this.typeParameters = expansion.typeParameters;
64
-			typeParameters = StoredType.getSelfMapping(outer.getTypeRegistry(), expansion.typeParameters);
62
+			typeParameters = TypeID.getSelfMapping(outer.getTypeRegistry(), expansion.typeParameters);
65 63
 		} else {
66 64
 			DefinitionTypeID definitionType = outer.getTypeRegistry().getForMyDefinition(definition);
67
-			type = definitionType.stored();
65
+			type = definitionType;
68 66
 			
69 67
 			List<TypeParameter> typeParameterList = new ArrayList<>();
70 68
 			while (definitionType != null) {
71
-				typeParameters = StoredType.getSelfMapping(outer.getTypeRegistry(), definitionType.definition.typeParameters);
69
+				typeParameters = TypeID.getSelfMapping(outer.getTypeRegistry(), definitionType.definition.typeParameters);
72 70
 				typeParameterList.addAll(Arrays.asList(definitionType.definition.typeParameters));
73 71
 				
74 72
 				definitionType = definitionType.definition.isStatic() ? null : definitionType.outer;
@@ -112,7 +110,7 @@ public class DefinitionScope extends BaseScope {
112 110
 		if (members != null && members.hasInnerType(name.get(0).name)) {
113 111
 			TypeID result = members.getInnerType(position, name.get(0));
114 112
 			for (int i = 1; i < name.size(); i++) {
115
-				result = getTypeMembers(result.stored(StaticExpressionStorageTag.INSTANCE)).getInnerType(position, name.get(i));
113
+				result = getTypeMembers(result).getInnerType(position, name.get(i));
116 114
 			}
117 115
 			return result;
118 116
 		} 
@@ -125,11 +123,6 @@ public class DefinitionScope extends BaseScope {
125 123
 		return outer.getType(position, name);
126 124
 	}
127 125
 
128
-	@Override
129
-	public StorageTag getStorageTag(CodePosition position, String name, String[] parameters) {
130
-		return outer.getStorageTag(position, name, parameters);
131
-	}
132
-
133 126
 	@Override
134 127
 	public LoopStatement getLoop(String name) {
135 128
 		return null;
@@ -141,7 +134,7 @@ public class DefinitionScope extends BaseScope {
141 134
 	}
142 135
 
143 136
 	@Override
144
-	public StoredType getThisType() {
137
+	public TypeID getThisType() {
145 138
 		return type;
146 139
 	}
147 140
 

+ 13
- 22
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/ExpressionScope.java View File

@@ -16,20 +16,16 @@ import org.openzen.zenscript.codemodel.annotations.AnnotationDefinition;
16 16
 import org.openzen.zenscript.codemodel.FunctionHeader;
17 17
 import org.openzen.zenscript.codemodel.GenericMapper;
18 18
 import org.openzen.zenscript.codemodel.expression.Expression;
19
-import org.openzen.zenscript.codemodel.expression.GetLocalVariableExpression;
20 19
 import org.openzen.zenscript.codemodel.expression.GetMatchingVariantField;
21 20
 import org.openzen.zenscript.codemodel.expression.switchvalue.VariantOptionSwitchValue;
22 21
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
23 22
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
24 23
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
25
-import org.openzen.zenscript.codemodel.statement.VarStatement;
26 24
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
27 25
 import org.openzen.zenscript.codemodel.GenericName;
28 26
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
29
-import org.openzen.zenscript.codemodel.type.StoredType;
30 27
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
31 28
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPreparer;
32
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
33 29
 import org.openzen.zenscript.codemodel.type.TypeID;
34 30
 
35 31
 /**
@@ -40,8 +36,8 @@ public class ExpressionScope extends BaseScope {
40 36
 	private final BaseScope outer;
41 37
 	private final DollarEvaluator dollar;
42 38
 	
43
-	public final List<StoredType> hints;
44
-	public final Map<TypeParameter, StoredType> genericInferenceMap;
39
+	public final List<TypeID> hints;
40
+	public final Map<TypeParameter, TypeID> genericInferenceMap;
45 41
 	private final Map<String, Function<CodePosition, Expression>> innerVariables = new HashMap<>();
46 42
 	
47 43
 	public ExpressionScope(BaseScope outer) {
@@ -51,25 +47,25 @@ public class ExpressionScope extends BaseScope {
51 47
 		this.genericInferenceMap = Collections.emptyMap();
52 48
 	}
53 49
 	
54
-	public ExpressionScope(BaseScope outer, List<StoredType> hints) {
50
+	public ExpressionScope(BaseScope outer, List<TypeID> hints) {
55 51
 		this.outer = outer;
56 52
 		this.hints = hints;
57 53
 		this.dollar = null;
58 54
 		this.genericInferenceMap = Collections.emptyMap();
59 55
 	}
60 56
 	
61
-	public ExpressionScope(BaseScope scope, StoredType hint) {
57
+	public ExpressionScope(BaseScope scope, TypeID hint) {
62 58
 		this.outer = scope;
63
-		this.hints = hint.type == BasicTypeID.UNDETERMINED ? Collections.emptyList() : Collections.singletonList(hint);
59
+		this.hints = hint == BasicTypeID.UNDETERMINED ? Collections.emptyList() : Collections.singletonList(hint);
64 60
 		this.dollar = null;
65 61
 		this.genericInferenceMap = Collections.emptyMap();
66 62
 	}
67 63
 	
68 64
 	private ExpressionScope(
69 65
 			BaseScope scope,
70
-			List<StoredType> hints,
66
+			List<TypeID> hints,
71 67
 			DollarEvaluator dollar,
72
-			Map<TypeParameter, StoredType> genericInferenceMap,
68
+			Map<TypeParameter, TypeID> genericInferenceMap,
73 69
 			Map<String, Function<CodePosition, Expression>> innerVariables) {
74 70
 		this.outer = scope;
75 71
 		this.hints = hints;
@@ -82,7 +78,7 @@ public class ExpressionScope extends BaseScope {
82 78
 		innerVariables.put(name, position -> new GetMatchingVariantField(position, value, index));
83 79
 	}
84 80
 	
85
-	public List<StoredType> getResultTypeHints() {
81
+	public List<TypeID> getResultTypeHints() {
86 82
 		return hints;
87 83
 	}
88 84
 	
@@ -90,15 +86,15 @@ public class ExpressionScope extends BaseScope {
90 86
 		return new ExpressionScope(outer, Collections.emptyList(), dollar, genericInferenceMap, innerVariables);
91 87
 	}
92 88
 	
93
-	public ExpressionScope withHint(StoredType hint) {
89
+	public ExpressionScope withHint(TypeID hint) {
94 90
 		return new ExpressionScope(outer, Collections.singletonList(hint), dollar, genericInferenceMap, innerVariables);
95 91
 	}
96 92
 	
97
-	public ExpressionScope withHints(List<StoredType> hints) {
93
+	public ExpressionScope withHints(List<TypeID> hints) {
98 94
 		return new ExpressionScope(outer, hints, dollar, genericInferenceMap, innerVariables);
99 95
 	}
100 96
 	
101
-	public ExpressionScope createInner(List<StoredType> hints, DollarEvaluator dollar) {
97
+	public ExpressionScope createInner(List<TypeID> hints, DollarEvaluator dollar) {
102 98
 		return new ExpressionScope(outer, hints, dollar, genericInferenceMap, innerVariables);
103 99
 	}
104 100
 	
@@ -106,7 +102,7 @@ public class ExpressionScope extends BaseScope {
106 102
 		if (header.typeParameters == null)
107 103
 			return this;
108 104
 		
109
-		Map<TypeParameter, StoredType> genericInferenceMap = new HashMap<>();
105
+		Map<TypeParameter, TypeID> genericInferenceMap = new HashMap<>();
110 106
 		for (TypeParameter parameter : header.typeParameters)
111 107
 			genericInferenceMap.put(parameter, null);
112 108
 		
@@ -135,11 +131,6 @@ public class ExpressionScope extends BaseScope {
135 131
 	public TypeID getType(CodePosition position, List<GenericName> name) {
136 132
 		return outer.getType(position, name);
137 133
 	}
138
-
139
-	@Override
140
-	public StorageTag getStorageTag(CodePosition position, String name, String[] parameters) {
141
-		return outer.getStorageTag(position, name, parameters);
142
-	}
143 134
 	
144 135
 	@Override
145 136
 	public LoopStatement getLoop(String name) {
@@ -152,7 +143,7 @@ public class ExpressionScope extends BaseScope {
152 143
 	}
153 144
 	
154 145
 	@Override
155
-	public StoredType getThisType() {
146
+	public TypeID getThisType() {
156 147
 		return outer.getThisType();
157 148
 	}
158 149
 

+ 3
- 10
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/FunctionScope.java View File

@@ -19,11 +19,9 @@ import org.openzen.zenscript.codemodel.partial.PartialTypeExpression;
19 19
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
20 20
 import org.openzen.zenscript.codemodel.GenericName;
21 21
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
22
-import org.openzen.zenscript.codemodel.type.StoredType;
23 22
 import org.openzen.zenscript.codemodel.type.TypeID;
24 23
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
25 24
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPreparer;
26
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
27 25
 
28 26
 /**
29 27
  *
@@ -33,7 +31,7 @@ public class FunctionScope extends StatementScope {
33 31
 	private final BaseScope outer;
34 32
 	private final FunctionHeader header;
35 33
 	private final GenericMapper typeParameterMap;
36
-	private final StoredType thisType;
34
+	private final TypeID thisType;
37 35
 	private final DollarEvaluator dollar;
38 36
 	
39 37
 	public FunctionScope(CodePosition position, BaseScope outer, FunctionHeader header) {
@@ -43,7 +41,7 @@ public class FunctionScope extends StatementScope {
43 41
 	public FunctionScope(CodePosition position, BaseScope outer, FunctionHeader header, DollarEvaluator dollar) {
44 42
 		this.outer = outer;
45 43
 		this.header = header;
46
-		this.thisType = outer.getThisType() == null || header.storage == null ? outer.getThisType() : outer.getThisType().type.stored(header.storage);
44
+		this.thisType = outer.getThisType();
47 45
 		this.dollar = dollar;
48 46
 		
49 47
 		if (outer.getLocalTypeParameters() == null)
@@ -113,12 +111,7 @@ public class FunctionScope extends StatementScope {
113 111
 	}
114 112
 
115 113
 	@Override
116
-	public StorageTag getStorageTag(CodePosition position, String name, String[] parameters) {
117
-		return outer.getStorageTag(position, name, parameters);
118
-	}
119
-
120
-	@Override
121
-	public StoredType getThisType() {
114
+	public TypeID getThisType() {
122 115
 		return thisType;
123 116
 	}
124 117
 

+ 2
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/TypeScope.java View File

@@ -9,6 +9,7 @@ import org.openzen.zenscript.codemodel.GenericMapper;
9 9
 import org.openzen.zenscript.codemodel.context.TypeResolutionContext;
10 10
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
11 11
 import org.openzen.zenscript.codemodel.type.StoredType;
12
+import org.openzen.zenscript.codemodel.type.TypeID;
12 13
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
13 14
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPreparer;
14 15
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
@@ -20,7 +21,7 @@ import org.openzen.zenscript.codemodel.type.member.TypeMembers;
20 21
 public interface TypeScope extends TypeResolutionContext {
21 22
 	public LocalMemberCache getMemberCache();
22 23
 	
23
-	default TypeMembers getTypeMembers(StoredType type) {
24
+	default TypeMembers getTypeMembers(TypeID type) {
24 25
 		return getMemberCache().get(type);
25 26
 	}
26 27
 	

+ 5
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/serialization/CodeSerializationInput.java View File

@@ -18,7 +18,6 @@ import org.openzen.zenscript.codemodel.context.TypeContext;
18 18
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
19 19
 import org.openzen.zenscript.codemodel.member.EnumConstantMember;
20 20
 import org.openzen.zenscript.codemodel.member.ref.VariantOptionRef;
21
-import org.openzen.zenscript.codemodel.type.StoredType;
22 21
 import org.openzen.zenscript.codemodel.type.TypeID;
23 22
 
24 23
 /**
@@ -54,18 +53,16 @@ public interface CodeSerializationInput {
54 53
 	
55 54
 	HighLevelDefinition readDefinition();
56 55
 	
57
-	DefinitionMemberRef readMember(TypeContext context, StoredType type);
56
+	DefinitionMemberRef readMember(TypeContext context, TypeID type);
58 57
 	
59 58
 	EnumConstantMember readEnumConstant(TypeContext context);
60 59
 	
61
-	VariantOptionRef readVariantOption(TypeContext context, StoredType type);
60
+	VariantOptionRef readVariantOption(TypeContext context, TypeID type);
62 61
 	
63 62
 	AnnotationDefinition readAnnotationType();
64
-	
65
-	TypeID deserializeTypeID(TypeContext context);
66
-	
67
-	StoredType deserializeType(TypeContext context);
68
-	
63
+
64
+	TypeID deserializeType(TypeContext context);
65
+
69 66
 	CodePosition deserializePosition();
70 67
 	
71 68
 	FunctionHeader deserializeHeader(TypeContext context);

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/BlockStatement.java View File

@@ -11,7 +11,7 @@ import org.openzen.zencode.shared.ConcatMap;
11 11
 import org.openzen.zenscript.codemodel.expression.Expression;
12 12
 import org.openzen.zenscript.codemodel.expression.ExpressionTransformer;
13 13
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15 15
 
16 16
 /**
17 17
  *
@@ -69,8 +69,8 @@ public class BlockStatement extends Statement {
69 69
 		return unchanged ? this : new BlockStatement(position, tStatements);
70 70
 	}
71 71
 	
72
-	private static StoredType getThrownType(Statement[] statements) {
73
-		StoredType result = null;
72
+	private static TypeID getThrownType(Statement[] statements) {
73
+		TypeID result = null;
74 74
 		for (Statement statement : statements)
75 75
 			result = Expression.binaryThrow(statement.position, result, statement.thrownType);
76 76
 		return result;

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/IfStatement.java View File

@@ -11,7 +11,7 @@ import org.openzen.zencode.shared.ConcatMap;
11 11
 import org.openzen.zenscript.codemodel.expression.Expression;
12 12
 import org.openzen.zenscript.codemodel.expression.ExpressionTransformer;
13 13
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15 15
 
16 16
 /**
17 17
  *
@@ -68,8 +68,8 @@ public class IfStatement extends Statement {
68 68
 				: new IfStatement(position, tCondition, tOnThen, tOnElse);
69 69
 	}
70 70
 	
71
-	private static StoredType getThrownType(Expression condition, Statement onThen, Statement onElse) {
72
-		StoredType result = Expression.binaryThrow(onThen.position, condition.thrownType, onThen.thrownType);
71
+	private static TypeID getThrownType(Expression condition, Statement onThen, Statement onElse) {
72
+		TypeID result = Expression.binaryThrow(onThen.position, condition.thrownType, onThen.thrownType);
73 73
 		if (onElse != null)
74 74
 			result = Expression.binaryThrow(onElse.position, result, onElse.thrownType);
75 75
 		return result;

+ 6
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/Statement.java View File

@@ -14,7 +14,7 @@ import org.openzen.zencode.shared.Taggable;
14 14
 import org.openzen.zenscript.codemodel.annotations.StatementAnnotation;
15 15
 import org.openzen.zenscript.codemodel.expression.ExpressionTransformer;
16 16
 import org.openzen.zenscript.codemodel.scope.TypeScope;
17
-import org.openzen.zenscript.codemodel.type.StoredType;
17
+import org.openzen.zenscript.codemodel.type.TypeID;
18 18
 
19 19
 /**
20 20
  *
@@ -22,19 +22,19 @@ import org.openzen.zenscript.codemodel.type.StoredType;
22 22
  */
23 23
 public abstract class Statement extends Taggable {
24 24
 	public final CodePosition position;
25
-	public final StoredType thrownType;
25
+	public final TypeID thrownType;
26 26
 	public StatementAnnotation[] annotations = StatementAnnotation.NONE;
27 27
 	
28
-	public Statement(CodePosition position, StoredType thrownType) {
28
+	public Statement(CodePosition position, TypeID thrownType) {
29 29
 		this.position = position;
30 30
 		this.thrownType = thrownType;
31 31
 	}
32 32
 	
33
-	public StoredType getReturnType() {
33
+	public TypeID getReturnType() {
34 34
 		return null;
35 35
 	}
36 36
 	
37
-	public Statement withReturnType(TypeScope scope, StoredType returnType) {
37
+	public Statement withReturnType(TypeScope scope, TypeID returnType) {
38 38
 		return this;
39 39
 	}
40 40
 	
@@ -54,7 +54,7 @@ public abstract class Statement extends Taggable {
54 54
 	
55 55
 	public abstract Statement transform(ExpressionTransformer transformer, ConcatMap<LoopStatement, LoopStatement> modified);
56 56
 	
57
-	public static List<Statement> withReturnType(TypeScope scope, List<Statement> statements, StoredType returnType) {
57
+	public static List<Statement> withReturnType(TypeScope scope, List<Statement> statements, TypeID returnType) {
58 58
 		return statements.stream()
59 59
 				.map(statement -> statement.withReturnType(scope, returnType))
60 60
 				.collect(Collectors.toList());

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/statement/VarStatement.java View File

@@ -11,7 +11,7 @@ import org.openzen.zencode.shared.ConcatMap;
11 11
 import org.openzen.zenscript.codemodel.expression.Expression;
12 12
 import org.openzen.zenscript.codemodel.expression.ExpressionTransformer;
13 13
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15 15
 
16 16
 /**
17 17
  *
@@ -19,12 +19,12 @@ import org.openzen.zenscript.codemodel.type.StoredType;
19 19
  */
20 20
 public class VarStatement extends Statement {
21 21
 	public final String name;
22
-	public final StoredType type;
22
+	public final TypeID type;
23 23
 	public final Expression initializer;
24 24
 	public final VariableID variable;
25 25
 	public final boolean isFinal;
26 26
 	
27
-	public VarStatement(CodePosition position, VariableID variable, String name, StoredType type, Expression initializer, boolean isFinal) {
27
+	public VarStatement(CodePosition position, VariableID variable, String name, TypeID type, Expression initializer, boolean isFinal) {
28 28
 		super(position, initializer == null ? null : initializer.thrownType);
29 29
 		
30 30
 		this.name = name;

+ 11
- 12
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/ArrayTypeID.java View File

@@ -13,27 +13,26 @@ import org.openzen.zenscript.codemodel.HighLevelDefinition;
13 13
 import org.openzen.zenscript.codemodel.expression.ArrayExpression;
14 14
 import org.openzen.zenscript.codemodel.expression.Expression;
15 15
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
16
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
17 16
 
18 17
 /**
19 18
  *
20 19
  * @author Hoofdgebruiker
21 20
  */
22 21
 public class ArrayTypeID implements TypeID {
23
-	public static final ArrayTypeID INT = new ArrayTypeID(BasicTypeID.INT.stored, 1);
24
-	public static final ArrayTypeID CHAR = new ArrayTypeID(BasicTypeID.CHAR.stored, 1);
22
+	public static final ArrayTypeID INT = new ArrayTypeID(BasicTypeID.INT, 1);
23
+	public static final ArrayTypeID CHAR = new ArrayTypeID(BasicTypeID.CHAR, 1);
25 24
 	
26
-	public final StoredType elementType;
25
+	public final TypeID elementType;
27 26
 	public final int dimension;
28 27
 	private final ArrayTypeID normalized;
29 28
 
30
-	private ArrayTypeID(StoredType elementType, int dimension) {
29
+	private ArrayTypeID(TypeID elementType, int dimension) {
31 30
 		this.elementType = elementType;
32 31
 		this.dimension = dimension;
33 32
 		this.normalized = this;
34 33
 	}
35 34
 	
36
-	public ArrayTypeID(GlobalTypeRegistry registry, StoredType elementType, int dimension) {
35
+	public ArrayTypeID(GlobalTypeRegistry registry, TypeID elementType, int dimension) {
37 36
 		this.elementType = elementType;
38 37
 		this.dimension = dimension;
39 38
 		this.normalized = elementType.getNormalized() == elementType ? this : registry.getArray(elementType.getNormalized(), dimension);
@@ -41,7 +40,7 @@ public class ArrayTypeID implements TypeID {
41 40
 	
42 41
 	@Override
43 42
 	public Expression getDefaultValue() {
44
-		return new ArrayExpression(CodePosition.UNKNOWN, Expression.NONE, this.stored());
43
+		return new ArrayExpression(CodePosition.UNKNOWN, Expression.NONE, this);
45 44
 	}
46 45
 	
47 46
 	@Override
@@ -71,17 +70,17 @@ public class ArrayTypeID implements TypeID {
71 70
 	
72 71
 	@Override
73 72
 	public boolean isDestructible() {
74
-		return elementType.type.isDestructible();
73
+		return elementType.isDestructible();
75 74
 	}
76 75
 	
77 76
 	@Override
78 77
 	public boolean isDestructible(Set<HighLevelDefinition> scanning) {
79
-		return elementType.type.isDestructible(scanning);
78
+		return elementType.isDestructible(scanning);
80 79
 	}
81 80
 	
82 81
 	@Override
83
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
84
-		return mapper.registry.getArray(elementType.instance(mapper), dimension).stored(storage);
82
+	public TypeID instance(GenericMapper mapper) {
83
+		return mapper.registry.getArray(elementType.instance(mapper), dimension);
85 84
 	}
86 85
 
87 86
 	@Override
@@ -96,7 +95,7 @@ public class ArrayTypeID implements TypeID {
96 95
 
97 96
 	@Override
98 97
 	public void extractTypeParameters(List<TypeParameter> typeParameters) {
99
-		elementType.type.extractTypeParameters(typeParameters);
98
+		elementType.extractTypeParameters(typeParameters);
100 99
 	}
101 100
 
102 101
 	@Override

+ 7
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/AssocTypeID.java View File

@@ -10,18 +10,17 @@ import java.util.Set;
10 10
 import org.openzen.zenscript.codemodel.GenericMapper;
11 11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12 12
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
13
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
14 13
 
15 14
 /**
16 15
  *
17 16
  * @author Hoofdgebruiker
18 17
  */
19 18
 public class AssocTypeID implements TypeID {
20
-	public final StoredType keyType;
21
-	public final StoredType valueType;
19
+	public final TypeID keyType;
20
+	public final TypeID valueType;
22 21
 	private final AssocTypeID normalized;
23 22
 	
24
-	public AssocTypeID(GlobalTypeRegistry typeRegistry, StoredType keyType, StoredType valueType) {
23
+	public AssocTypeID(GlobalTypeRegistry typeRegistry, TypeID keyType, TypeID valueType) {
25 24
 		this.keyType = keyType;
26 25
 		this.valueType = valueType;
27 26
 		
@@ -32,10 +31,10 @@ public class AssocTypeID implements TypeID {
32 31
 	}
33 32
 	
34 33
 	@Override
35
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
34
+	public TypeID instance(GenericMapper mapper) {
36 35
 		return mapper.registry.getAssociative(
37 36
 				keyType.instance(mapper),
38
-				valueType.instance(mapper)).stored(storage);
37
+				valueType.instance(mapper));
39 38
 	}
40 39
 	
41 40
 	@Override
@@ -85,8 +84,8 @@ public class AssocTypeID implements TypeID {
85 84
 
86 85
 	@Override
87 86
 	public void extractTypeParameters(List<TypeParameter> typeParameters) {
88
-		keyType.type.extractTypeParameters(typeParameters);
89
-		valueType.type.extractTypeParameters(typeParameters);
87
+		keyType.extractTypeParameters(typeParameters);
88
+		valueType.extractTypeParameters(typeParameters);
90 89
 	}
91 90
 
92 91
 	@Override

+ 6
- 10
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/BasicTypeID.java View File

@@ -13,7 +13,6 @@ import org.openzen.zenscript.codemodel.GenericMapper;
13 13
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
14 14
 import org.openzen.zenscript.codemodel.expression.ConstantBoolExpression;
15 15
 import org.openzen.zenscript.codemodel.expression.ConstantByteExpression;
16
-import org.openzen.zenscript.codemodel.expression.ConstantCharExpression;
17 16
 import org.openzen.zenscript.codemodel.expression.ConstantDoubleExpression;
18 17
 import org.openzen.zenscript.codemodel.expression.ConstantFloatExpression;
19 18
 import org.openzen.zenscript.codemodel.expression.ConstantIntExpression;
@@ -27,7 +26,6 @@ import org.openzen.zenscript.codemodel.expression.ConstantUSizeExpression;
27 26
 import org.openzen.zenscript.codemodel.expression.Expression;
28 27
 import org.openzen.zenscript.codemodel.expression.NullExpression;
29 28
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
30
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
31 29
 
32 30
 /**
33 31
  *
@@ -49,32 +47,30 @@ public enum BasicTypeID implements TypeID {
49 47
 	FLOAT("float"),
50 48
 	DOUBLE("double"),
51 49
 	CHAR("char"),
50
+	STRING("string"),
52 51
 	
53 52
 	UNDETERMINED("undetermined");
54 53
 	
55
-	public static final List<StoredType> HINT_BOOL = Collections.singletonList(BOOL.stored);
54
+	public static final List<TypeID> HINT_BOOL = Collections.singletonList(BOOL);
56 55
 	
57 56
 	public final String name;
58
-	public final StoredType stored;
59 57
 	
60 58
 	private Expression defaultValue = null;
61 59
 	
62 60
 	BasicTypeID(String name) {
63 61
 		this.name = name;
64
-		stored = new StoredType(this, null);
65
-		this.defaultValue = defaultValue;
66 62
 	}
67 63
 	
68 64
 	@Override
69 65
 	public BasicTypeID getNormalized() {
70 66
 		return this;
71 67
 	}
72
-	
68
+
73 69
 	@Override
74
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
75
-		return stored(storage);
70
+	public TypeID instance(GenericMapper mapper) {
71
+		return this;
76 72
 	}
77
-	
73
+
78 74
 	@Override
79 75
 	public String toString() {
80 76
 		return name;

+ 24
- 25
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/DefinitionTypeID.java View File

@@ -27,18 +27,18 @@ import org.openzen.zenscript.codemodel.type.storage.StorageTag;
27 27
  */
28 28
 public class DefinitionTypeID implements TypeID {
29 29
 	public final HighLevelDefinition definition;
30
-	public final StoredType[] typeArguments;
30
+	public final TypeID[] typeArguments;
31 31
 	public final DefinitionTypeID outer;
32 32
 	private TypeID normalized;
33 33
 	
34 34
 	public TypeID superType;
35 35
 	
36
-	public DefinitionTypeID(GlobalTypeRegistry typeRegistry, HighLevelDefinition definition, StoredType[] typeArguments) {
36
+	public DefinitionTypeID(GlobalTypeRegistry typeRegistry, HighLevelDefinition definition, TypeID[] typeArguments) {
37 37
 		this(typeRegistry, definition, typeArguments, null);
38 38
 	}
39 39
 	
40 40
 	// For inner classes of generic outer classes
41
-	public DefinitionTypeID(GlobalTypeRegistry typeRegistry, HighLevelDefinition definition, StoredType[] typeArguments, DefinitionTypeID outer) {
41
+	public DefinitionTypeID(GlobalTypeRegistry typeRegistry, HighLevelDefinition definition, TypeID[] typeArguments, DefinitionTypeID outer) {
42 42
 		if (typeArguments == null)
43 43
 			throw new NullPointerException("typeParameters cannot be null");
44 44
 		if (typeArguments.length != definition.getNumberOfGenericParameters())
@@ -61,7 +61,7 @@ public class DefinitionTypeID implements TypeID {
61 61
 		if (definition instanceof AliasDefinition)
62 62
 			return true;
63 63
 		
64
-		for (StoredType typeArgument : typeArguments)
64
+		for (TypeID typeArgument : typeArguments)
65 65
 			if (!typeArgument.getNormalized().equals(typeArgument))
66 66
 				return true;
67 67
 		if (outer != null && !outer.getNormalized().equals(outer))
@@ -76,15 +76,14 @@ public class DefinitionTypeID implements TypeID {
76 76
 			if (alias.type == null)
77 77
 				throw new IllegalStateException("Alias type not yet initialized!");
78 78
 			
79
-			Map<TypeParameter, StoredType> typeMapping = new HashMap<>();
79
+			Map<TypeParameter, TypeID> typeMapping = new HashMap<>();
80 80
 			for (int i = 0; i < definition.typeParameters.length; i++)
81 81
 				typeMapping.put(definition.typeParameters[i], typeArguments[i].getNormalized());
82 82
 			GenericMapper mapper = new GenericMapper(definition.position, typeRegistry, typeMapping);
83
-			TypeID result = alias.type.instance(mapper, null).type.getNormalized();
84
-			return result;
83
+			return alias.type.instance(mapper).getNormalized();
85 84
 		}
86
-		
87
-		StoredType[] normalizedTypeParameters = new StoredType[typeArguments.length];
85
+
86
+		TypeID[] normalizedTypeParameters = new TypeID[typeArguments.length];
88 87
 		for (int i = 0; i < normalizedTypeParameters.length; i++)
89 88
 			normalizedTypeParameters[i] = typeArguments[i].getNormalized();
90 89
 		
@@ -95,8 +94,8 @@ public class DefinitionTypeID implements TypeID {
95 94
 		return typeArguments.length > 0;
96 95
 	}
97 96
 	
98
-	public Map<TypeParameter, StoredType> getTypeParameterMapping() {
99
-		Map<TypeParameter, StoredType> mapping = new HashMap<>();
97
+	public Map<TypeParameter, TypeID> getTypeParameterMapping() {
98
+		Map<TypeParameter, TypeID> mapping = new HashMap<>();
100 99
 		DefinitionTypeID current = this;
101 100
 		do {
102 101
 			if (current.typeArguments != null) {
@@ -114,7 +113,7 @@ public class DefinitionTypeID implements TypeID {
114 113
 	
115 114
 	public DefinitionTypeID(HighLevelDefinition definition) {
116 115
 		this.definition = definition;
117
-		this.typeArguments = StoredType.NONE;
116
+		this.typeArguments = TypeID.NONE;
118 117
 		this.superType = definition.getSuperType();
119 118
 		this.outer = null;
120 119
 	}
@@ -125,28 +124,28 @@ public class DefinitionTypeID implements TypeID {
125 124
 	}
126 125
 	
127 126
 	@Override
128
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
127
+	public TypeID instance(GenericMapper mapper) {
129 128
 		if (!hasTypeParameters() && outer == null)
130
-			return stored(storage);
129
+			return this;
131 130
 		if (mapper == null || mapper.getMapping().isEmpty())
132
-			return stored(storage);
131
+			return this;
133 132
 		if (mapper.registry == null)
134 133
 			throw new NullPointerException();
135
-		
136
-		StoredType[] instancedArguments = StoredType.NONE;
134
+
135
+		TypeID[] instancedArguments = TypeID.NONE;
137 136
 		if (hasTypeParameters()) {
138
-			instancedArguments = new StoredType[typeArguments.length];
137
+			instancedArguments = new TypeID[typeArguments.length];
139 138
 			for (int i = 0; i < typeArguments.length; i++)
140 139
 				instancedArguments[i] = typeArguments[i].instance(mapper);
141 140
 		}
142 141
 		
143
-		DefinitionTypeID instancedOuter = outer == null ? null : (DefinitionTypeID)outer.instance(mapper, storage).type;
144
-		return mapper.registry.getForDefinition(definition, instancedArguments, instancedOuter).stored(storage);
142
+		DefinitionTypeID instancedOuter = outer == null ? null : (DefinitionTypeID)outer.instance(mapper);
143
+		return mapper.registry.getForDefinition(definition, instancedArguments, instancedOuter);
145 144
 	}
146 145
 	
147 146
 	@Override
148 147
 	public TypeID getSuperType(GlobalTypeRegistry registry) {
149
-		return definition.getSuperType() == null ? null : definition.getSuperType().instance(new GenericMapper(definition.position, registry, getTypeParameterMapping()), null).type;
148
+		return definition.getSuperType() == null ? null : definition.getSuperType().instance(new GenericMapper(definition.position, registry, getTypeParameterMapping()));
150 149
 	}
151 150
 	
152 151
 	@Override
@@ -192,8 +191,8 @@ public class DefinitionTypeID implements TypeID {
192 191
 	@Override
193 192
 	public boolean hasInferenceBlockingTypeParameters(TypeParameter[] parameters) {
194 193
 		if (hasTypeParameters()) {
195
-			for (StoredType typeArgument : typeArguments)
196
-				if (typeArgument.type.hasInferenceBlockingTypeParameters(parameters))
194
+			for (TypeID typeArgument : typeArguments)
195
+				if (typeArgument.hasInferenceBlockingTypeParameters(parameters))
197 196
 					return true;
198 197
 		}
199 198
 		
@@ -253,8 +252,8 @@ public class DefinitionTypeID implements TypeID {
253 252
 
254 253
 	@Override
255 254
 	public void extractTypeParameters(List<TypeParameter> typeParameters) {
256
-		for (StoredType type : this.typeArguments)
257
-			type.type.extractTypeParameters(typeParameters);
255
+		for (TypeID type : this.typeArguments)
256
+			type.extractTypeParameters(typeParameters);
258 257
 	}
259 258
 
260 259
 	public DefinitionTypeID getInnerType(GenericName name, GlobalTypeRegistry registry) {

+ 5
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/GenericMapTypeID.java View File

@@ -11,18 +11,17 @@ import java.util.Set;
11 11
 import org.openzen.zenscript.codemodel.GenericMapper;
12 12
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
13 13
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
14
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
15 14
 
16 15
 /**
17 16
  *
18 17
  * @author Hoofdgebruiker
19 18
  */
20 19
 public class GenericMapTypeID implements TypeID {
21
-	public final StoredType value;
20
+	public final TypeID value;
22 21
 	public final TypeParameter key;
23 22
 	private final GenericMapTypeID normalized;
24 23
 	
25
-	public GenericMapTypeID(GlobalTypeRegistry registry, StoredType value, TypeParameter key) {
24
+	public GenericMapTypeID(GlobalTypeRegistry registry, TypeID value, TypeParameter key) {
26 25
 		this.value = value;
27 26
 		this.key = key;
28 27
 		
@@ -65,8 +64,8 @@ public class GenericMapTypeID implements TypeID {
65 64
 	}
66 65
 	
67 66
 	@Override
68
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
69
-		return mapper.registry.getGenericMap(value.instance(mapper), key).stored(storage);
67
+	public TypeID instance(GenericMapper mapper) {
68
+		return mapper.registry.getGenericMap(value.instance(mapper), key);
70 69
 	}
71 70
 
72 71
 	@Override
@@ -81,7 +80,7 @@ public class GenericMapTypeID implements TypeID {
81 80
 
82 81
 	@Override
83 82
 	public void extractTypeParameters(List<TypeParameter> typeParameters) {
84
-		value.type.extractTypeParameters(typeParameters);
83
+		value.extractTypeParameters(typeParameters);
85 84
 		typeParameters.remove(key);
86 85
 	}
87 86
 	

+ 4
- 9
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/GenericTypeID.java View File

@@ -11,7 +11,6 @@ import org.openzen.zenscript.codemodel.GenericMapper;
11 11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12 12
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
13 13
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
14
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
15 14
 
16 15
 /**
17 16
  *
@@ -24,11 +23,8 @@ public class GenericTypeID implements TypeID {
24 23
 		this.parameter = parameter;
25 24
 	}
26 25
 	
27
-	public boolean matches(LocalMemberCache cache, StoredType type) {
28
-		if (type.getSpecifiedStorage() != null && parameter.storage != null && !type.getActualStorage().equals(parameter.storage))
29
-			return false;
30
-		
31
-		return parameter.matches(cache, type.type);
26
+	public boolean matches(LocalMemberCache cache, TypeID type) {
27
+		return parameter.matches(cache, type);
32 28
 	}
33 29
 	
34 30
 	@Override
@@ -37,9 +33,8 @@ public class GenericTypeID implements TypeID {
37 33
 	}
38 34
 	
39 35
 	@Override
40
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
41
-		StoredType mapped = mapper.map(this);
42
-		return new StoredType(mapped.type, StorageTag.union(mapper.position, mapped.getSpecifiedStorage(), storage));
36
+	public TypeID instance(GenericMapper mapper) {
37
+		return mapper.map(this);
43 38
 	}
44 39
 	
45 40
 	@Override

+ 10
- 10
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/GlobalTypeRegistry.java View File

@@ -40,22 +40,22 @@ public class GlobalTypeRegistry {
40 40
 		rangeTypes.put(RangeTypeID.USIZE, RangeTypeID.USIZE);
41 41
 	}
42 42
 	
43
-	public ArrayTypeID getArray(StoredType baseType, int dimension) {
43
+	public ArrayTypeID getArray(TypeID baseType, int dimension) {
44 44
 		ArrayTypeID id = new ArrayTypeID(this, baseType, dimension);
45 45
 		return internalize(arrayTypes, id);
46 46
 	}
47 47
 	
48
-	public AssocTypeID getAssociative(StoredType keyType, StoredType valueType) {
48
+	public AssocTypeID getAssociative(TypeID keyType, TypeID valueType) {
49 49
 		AssocTypeID id = new AssocTypeID(this, keyType, valueType);
50 50
 		return internalize(assocTypes, id);
51 51
 	}
52 52
 	
53
-	public GenericMapTypeID getGenericMap(StoredType valueType, TypeParameter key) {
53
+	public GenericMapTypeID getGenericMap(TypeID valueType, TypeParameter key) {
54 54
 		GenericMapTypeID id = new GenericMapTypeID(this, valueType, key);
55 55
 		return internalize(genericMapTypes, id);
56 56
 	}
57 57
 	
58
-	public IteratorTypeID getIterator(StoredType[] loopTypes) {
58
+	public IteratorTypeID getIterator(TypeID[] loopTypes) {
59 59
 		IteratorTypeID id = new IteratorTypeID(this, loopTypes);
60 60
 		return internalize(iteratorTypes, id);
61 61
 	}
@@ -65,7 +65,7 @@ public class GlobalTypeRegistry {
65 65
 		return internalize(functionTypes, id);
66 66
 	}
67 67
 	
68
-	public RangeTypeID getRange(StoredType type) {
68
+	public RangeTypeID getRange(TypeID type) {
69 69
 		RangeTypeID id = new RangeTypeID(this, type);
70 70
 		return internalize(rangeTypes, id);
71 71
 	}
@@ -76,11 +76,11 @@ public class GlobalTypeRegistry {
76 76
 	}
77 77
 	
78 78
 	public DefinitionTypeID getForMyDefinition(HighLevelDefinition definition) {
79
-		StoredType[] typeArguments = StoredType.NONE;
79
+		TypeID[] typeArguments = TypeID.NONE;
80 80
 		if (definition.getNumberOfGenericParameters() > 0) {
81
-			typeArguments = new StoredType[definition.getNumberOfGenericParameters()];
81
+			typeArguments = new TypeID[definition.getNumberOfGenericParameters()];
82 82
 			for (int i = 0; i < definition.typeParameters.length; i++)
83
-				typeArguments[i] = new StoredType(getGeneric(definition.typeParameters[i]), definition.typeParameters[i].storage);
83
+				typeArguments[i] = getGeneric(definition.typeParameters[i]);
84 84
 		}
85 85
 		DefinitionTypeID outer = null;
86 86
 		if (definition.outerDefinition != null)
@@ -89,11 +89,11 @@ public class GlobalTypeRegistry {
89 89
 		return getForDefinition(definition, typeArguments, outer);
90 90
 	}
91 91
 	
92
-	public DefinitionTypeID getForDefinition(HighLevelDefinition definition, StoredType... typeArguments) {
92
+	public DefinitionTypeID getForDefinition(HighLevelDefinition definition, TypeID... typeArguments) {
93 93
 		return this.getForDefinition(definition, typeArguments, null);
94 94
 	}
95 95
 	
96
-	public DefinitionTypeID getForDefinition(HighLevelDefinition definition, StoredType[] typeArguments, DefinitionTypeID outer) {
96
+	public DefinitionTypeID getForDefinition(HighLevelDefinition definition, TypeID[] typeArguments, DefinitionTypeID outer) {
97 97
 		DefinitionTypeID id = new DefinitionTypeID(this, definition, typeArguments, definition.isStatic() ? null : outer);
98 98
 		return internalize(definitionTypes, id);
99 99
 	}

+ 10
- 11
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/IteratorTypeID.java View File

@@ -11,17 +11,16 @@ import java.util.Set;
11 11
 import org.openzen.zenscript.codemodel.GenericMapper;
12 12
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
13 13
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
14
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
15 14
 
16 15
 /**
17 16
  *
18 17
  * @author Hoofdgebruiker
19 18
  */
20 19
 public class IteratorTypeID implements TypeID {
21
-	public final StoredType[] iteratorTypes;
20
+	public final TypeID[] iteratorTypes;
22 21
 	private final IteratorTypeID normalized;
23 22
 	
24
-	public IteratorTypeID(GlobalTypeRegistry registry, StoredType[] iteratorTypes) {
23
+	public IteratorTypeID(GlobalTypeRegistry registry, TypeID[] iteratorTypes) {
25 24
 		this.iteratorTypes = iteratorTypes;
26 25
 		
27 26
 		normalized = isDenormalized() ? normalize(registry) : this;
@@ -33,7 +32,7 @@ public class IteratorTypeID implements TypeID {
33 32
 	}
34 33
 	
35 34
 	private boolean isDenormalized() {
36
-		for (StoredType type : iteratorTypes)
35
+		for (TypeID type : iteratorTypes)
37 36
 			if (type.getNormalized() != type)
38 37
 				return true;
39 38
 		
@@ -41,7 +40,7 @@ public class IteratorTypeID implements TypeID {
41 40
 	}
42 41
 	
43 42
 	private IteratorTypeID normalize(GlobalTypeRegistry registry) {
44
-		StoredType[] normalizedTypes = new StoredType[iteratorTypes.length];
43
+		TypeID[] normalizedTypes = new TypeID[iteratorTypes.length];
45 44
 		for (int i = 0; i < normalizedTypes.length; i++)
46 45
 			normalizedTypes[i] = iteratorTypes[i].getNormalized();
47 46
 		return registry.getIterator(normalizedTypes);
@@ -78,14 +77,14 @@ public class IteratorTypeID implements TypeID {
78 77
 	}
79 78
 	
80 79
 	@Override
81
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
82
-		StoredType[] instanced = mapper.map(iteratorTypes);
83
-		return mapper.registry.getIterator(instanced).stored(storage);
80
+	public TypeID instance(GenericMapper mapper) {
81
+		TypeID[] instanced = mapper.map(iteratorTypes);
82
+		return mapper.registry.getIterator(instanced);
84 83
 	}
85 84
 
86 85
 	@Override
87 86
 	public boolean hasInferenceBlockingTypeParameters(TypeParameter[] parameters) {
88
-		for (StoredType type : iteratorTypes)
87
+		for (TypeID type : iteratorTypes)
89 88
 			if (type.hasInferenceBlockingTypeParameters(parameters))
90 89
 				return true;
91 90
 		
@@ -99,8 +98,8 @@ public class IteratorTypeID implements TypeID {
99 98
 
100 99
 	@Override
101 100
 	public void extractTypeParameters(List<TypeParameter> typeParameters) {
102
-		for (StoredType type : iteratorTypes)
103
-			type.type.extractTypeParameters(typeParameters);
101
+		for (TypeID type : iteratorTypes)
102
+			type.extractTypeParameters(typeParameters);
104 103
 	}
105 104
 
106 105
 	@Override

+ 3
- 9
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/OptionalTypeID.java View File

@@ -14,7 +14,6 @@ import org.openzen.zenscript.codemodel.HighLevelDefinition;
14 14
 import org.openzen.zenscript.codemodel.expression.Expression;
15 15
 import org.openzen.zenscript.codemodel.expression.NullExpression;
16 16
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
17
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
18 17
 
19 18
 /**
20 19
  *
@@ -41,9 +40,9 @@ public class OptionalTypeID implements TypeID {
41 40
 	}
42 41
 	
43 42
 	@Override
44
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
45
-		StoredType base = baseType.instance(mapper, storage);
46
-		return mapper.registry.getOptional(base.type).stored(StorageTag.union(mapper.position, base.getSpecifiedStorage(), storage));
43
+	public TypeID instance(GenericMapper mapper) {
44
+		TypeID base = baseType.instance(mapper);
45
+		return mapper.registry.getOptional(base);
47 46
 	}
48 47
 	
49 48
 	@Override
@@ -119,9 +118,4 @@ public class OptionalTypeID implements TypeID {
119 118
 	public String toString() {
120 119
 		return baseType.toString() + "?";
121 120
 	}
122
-	
123
-	@Override
124
-	public String toString(StorageTag storage) {
125
-		return baseType.toString(storage) + '?';
126
-	}
127 121
 }

+ 9
- 13
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/RangeTypeID.java View File

@@ -10,21 +10,19 @@ import java.util.Set;
10 10
 import org.openzen.zenscript.codemodel.GenericMapper;
11 11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12 12
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
13
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
14 13
 
15 14
 /**
16 15
  *
17 16
  * @author Hoofdgebruiker
18 17
  */
19 18
 public class RangeTypeID implements TypeID {
20
-	public static final RangeTypeID INT = new RangeTypeID(null, BasicTypeID.INT.stored);
21
-	public static final RangeTypeID USIZE = new RangeTypeID(null, BasicTypeID.USIZE.stored);
19
+	public static final RangeTypeID INT = new RangeTypeID(null, BasicTypeID.INT);
20
+	public static final RangeTypeID USIZE = new RangeTypeID(null, BasicTypeID.USIZE);
22 21
 	
23
-	public final StoredType baseType;
22
+	public final TypeID baseType;
24 23
 	private final RangeTypeID normalized;
25
-	public final StoredType stored;
26
-	
27
-	public RangeTypeID(GlobalTypeRegistry registry, StoredType baseType) {
24
+
25
+	public RangeTypeID(GlobalTypeRegistry registry, TypeID baseType) {
28 26
 		this.baseType = baseType;
29 27
 		
30 28
 		if (baseType.getNormalized().equals(baseType)) {
@@ -32,8 +30,6 @@ public class RangeTypeID implements TypeID {
32 30
 		} else {
33 31
 			normalized = registry.getRange(baseType.getNormalized());
34 32
 		}
35
-		
36
-		stored = new StoredType(this, baseType.getSpecifiedStorage());
37 33
 	}
38 34
 	
39 35
 	@Override
@@ -42,8 +38,8 @@ public class RangeTypeID implements TypeID {
42 38
 	}
43 39
 	
44 40
 	@Override
45
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
46
-		return mapper.registry.getRange(baseType.instance(mapper)).stored(storage);
41
+	public TypeID instance(GenericMapper mapper) {
42
+		return mapper.registry.getRange(baseType.instance(mapper));
47 43
 	}
48 44
 	
49 45
 	@Override
@@ -63,7 +59,7 @@ public class RangeTypeID implements TypeID {
63 59
 	
64 60
 	@Override
65 61
 	public boolean isValueType() {
66
-		return baseType.type.isValueType();
62
+		return baseType.isValueType();
67 63
 	}
68 64
 	
69 65
 	@Override
@@ -88,7 +84,7 @@ public class RangeTypeID implements TypeID {
88 84
 
89 85
 	@Override
90 86
 	public void extractTypeParameters(List<TypeParameter> typeParameters) {
91
-		baseType.type.extractTypeParameters(typeParameters);
87
+		baseType.extractTypeParameters(typeParameters);
92 88
 	}
93 89
 
94 90
 	@Override

+ 12
- 13
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/StoredType.java View File

@@ -22,17 +22,17 @@ import org.openzen.zenscript.codemodel.type.storage.ValueStorageTag;
22 22
  * @author Hoofdgebruiker
23 23
  */
24 24
 public class StoredType {
25
-	public static Map<TypeParameter, StoredType> getMapping(TypeParameter[] parameters, StoredType[] arguments) {
26
-		Map<TypeParameter, StoredType> typeArguments = new HashMap<>();
25
+	public static Map<TypeParameter, TypeID> getMapping(TypeParameter[] parameters, TypeID[] arguments) {
26
+		Map<TypeParameter, TypeID> typeArguments = new HashMap<>();
27 27
 		for (int i = 0; i < parameters.length; i++)
28 28
 			typeArguments.put(parameters[i], arguments[i]);
29 29
 		return typeArguments;
30 30
 	}
31 31
 	
32
-	public static Map<TypeParameter, StoredType> getSelfMapping(GlobalTypeRegistry registry, TypeParameter[] parameters) {
33
-		Map<TypeParameter, StoredType> typeArguments = new HashMap<>();
32
+	public static Map<TypeParameter, TypeID> getSelfMapping(GlobalTypeRegistry registry, TypeParameter[] parameters) {
33
+		Map<TypeParameter, TypeID> typeArguments = new HashMap<>();
34 34
 		for (TypeParameter parameter : parameters)
35
-			typeArguments.put(parameter, registry.getGeneric(parameter).stored(parameter.storage));
35
+			typeArguments.put(parameter, registry.getGeneric(parameter));
36 36
 		return typeArguments;
37 37
 	}
38 38
 	
@@ -64,13 +64,13 @@ public class StoredType {
64 64
 		return type.getNormalized() == type ? this : new StoredType(type.getNormalized(), storage);
65 65
 	}
66 66
 	
67
-	public StoredType getSuperType(GlobalTypeRegistry registry) {
67
+	public TypeID getSuperType(GlobalTypeRegistry registry) {
68 68
 		TypeID superType = type.getSuperType(registry);
69
-		return superType == null ? null : superType.stored(storage);
69
+		return superType == null ? null : superType;
70 70
 	}
71 71
 	
72
-	public StoredType instance(GenericMapper mapper) {
73
-		return type.instance(mapper, storage);
72
+	public TypeID instance(GenericMapper mapper) {
73
+		return type.instance(mapper);
74 74
 	}
75 75
 	
76 76
 	public boolean isDestructible() {
@@ -115,7 +115,7 @@ public class StoredType {
115 115
 	
116 116
 	// Infers type parameters for this type so it matches with targetType
117 117
 	// returns false if that isn't possible
118
-	public Map<TypeParameter, StoredType> inferTypeParameters(LocalMemberCache cache, StoredType targetType) {
118
+	public Map<TypeParameter, TypeID> inferTypeParameters(LocalMemberCache cache, TypeID targetType) {
119 119
 		return type.inferTypeParameters(cache, targetType);
120 120
 	}
121 121
 	
@@ -146,9 +146,8 @@ public class StoredType {
146 146
 		if (obj == null || getClass() != obj.getClass())
147 147
 			return false;
148 148
 		
149
-		final StoredType other = (StoredType) obj;
150
-		return Objects.equals(this.type, other.type)
151
-				&& Objects.equals(this.storage, other.storage);
149
+		final TypeID other = (TypeID) obj;
150
+		return Objects.equals(this.type, other);
152 151
 	}
153 152
 	
154 153
 	@Override

+ 2
- 14
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/StringTypeID.java View File

@@ -13,12 +13,6 @@ import org.openzen.zenscript.codemodel.HighLevelDefinition;
13 13
 import org.openzen.zenscript.codemodel.expression.ConstantStringExpression;
14 14
 import org.openzen.zenscript.codemodel.expression.Expression;
15 15
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
16
-import org.openzen.zenscript.codemodel.type.storage.AutoStorageTag;
17
-import org.openzen.zenscript.codemodel.type.storage.BorrowStorageTag;
18
-import org.openzen.zenscript.codemodel.type.storage.SharedStorageTag;
19
-import org.openzen.zenscript.codemodel.type.storage.StaticStorageTag;
20
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
21
-import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
22 16
 
23 17
 /**
24 18
  *
@@ -27,12 +21,6 @@ import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
27 21
 public class StringTypeID implements TypeID {
28 22
 	public static final StringTypeID INSTANCE = new StringTypeID();
29 23
 	
30
-	public static final StoredType AUTO = new StoredType(INSTANCE, AutoStorageTag.INSTANCE);
31
-	public static final StoredType STATIC = new StoredType(INSTANCE, StaticStorageTag.INSTANCE);
32
-	public static final StoredType UNIQUE = new StoredType(INSTANCE, UniqueStorageTag.INSTANCE);
33
-	public static final StoredType BORROW = new StoredType(INSTANCE, BorrowStorageTag.INVOCATION);
34
-	public static final StoredType SHARED = new StoredType(INSTANCE, SharedStorageTag.INSTANCE);
35
-	
36 24
 	private StringTypeID() {}
37 25
 	
38 26
 	@Override
@@ -76,8 +64,8 @@ public class StringTypeID implements TypeID {
76 64
 	}
77 65
 
78 66
 	@Override
79
-	public StoredType instance(GenericMapper mapper, StorageTag storage) {
80
-		return new StoredType(this, storage);
67
+	public TypeID instance(GenericMapper mapper) {
68
+		return this;
81 69
 	}
82 70
 
83 71
 	@Override

+ 18
- 20
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeID.java View File

@@ -5,6 +5,7 @@
5 5
  */
6 6
 package org.openzen.zenscript.codemodel.type;
7 7
 
8
+import java.util.HashMap;
8 9
 import java.util.List;
9 10
 import java.util.Map;
10 11
 import java.util.Set;
@@ -13,21 +14,33 @@ import org.openzen.zenscript.codemodel.HighLevelDefinition;
13 14
 import org.openzen.zenscript.codemodel.expression.Expression;
14 15
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
15 16
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
16
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
17
-import org.openzen.zenscript.codemodel.type.storage.ValueStorageTag;
18 17
 
19 18
 /**
20 19
  *
21 20
  * @author Hoofdgebruiker
22 21
  */
23 22
 public interface TypeID {
23
+	static Map<TypeParameter, TypeID> getMapping(TypeParameter[] parameters, TypeID[] arguments) {
24
+		Map<TypeParameter, TypeID> typeArguments = new HashMap<>();
25
+		for (int i = 0; i < parameters.length; i++)
26
+			typeArguments.put(parameters[i], arguments[i]);
27
+		return typeArguments;
28
+	}
29
+
30
+	static Map<TypeParameter, TypeID> getSelfMapping(GlobalTypeRegistry registry, TypeParameter[] parameters) {
31
+		Map<TypeParameter, TypeID> typeArguments = new HashMap<>();
32
+		for (TypeParameter parameter : parameters)
33
+			typeArguments.put(parameter, registry.getGeneric(parameter));
34
+		return typeArguments;
35
+	}
36
+
24 37
 	TypeID[] NONE = new TypeID[0];
25 38
 	
26 39
 	default TypeID getSuperType(GlobalTypeRegistry registry) {
27 40
 		return null;
28 41
 	}
29 42
 	
30
-	StoredType instance(GenericMapper mapper, StorageTag storage);
43
+	TypeID instance(GenericMapper mapper);
31 44
 	
32 45
 	TypeID getNormalized();
33 46
 	
@@ -45,8 +58,8 @@ public interface TypeID {
45 58
 	
46 59
 	// Infers type parameters for this type so it matches with targetType
47 60
 	// returns false if that isn't possible
48
-	default Map<TypeParameter, StoredType> inferTypeParameters(LocalMemberCache cache, StoredType targetType) {
49
-		return TypeMatcher.match(cache, stored(), targetType);
61
+	default Map<TypeParameter, TypeID> inferTypeParameters(LocalMemberCache cache, TypeID targetType) {
62
+		return TypeMatcher.match(cache, this, targetType);
50 63
 	}
51 64
 	
52 65
 	void extractTypeParameters(List<TypeParameter> typeParameters);
@@ -55,14 +68,6 @@ public interface TypeID {
55 68
 	
56 69
 	<C, R, E extends Exception> R accept(C context, TypeVisitorWithContext<C, R, E> visitor) throws E;
57 70
 	
58
-	default StoredType stored(StorageTag storage) {
59
-		return new StoredType(this, storage);
60
-	}
61
-	
62
-	default StoredType stored() {
63
-		return new StoredType(this, null);
64
-	}
65
-	
66 71
 	default boolean isOptional() {
67 72
 		return false;
68 73
 	}
@@ -88,11 +93,4 @@ public interface TypeID {
88 93
 	default boolean isDefinition(HighLevelDefinition definition) {
89 94
 		return false;
90 95
 	}
91
-	
92
-	default String toString(StorageTag storage) {
93
-		if (storage == ValueStorageTag.INSTANCE)
94
-			return toString();
95
-		
96
-		return toString() + "`" + storage.toString();
97
-	}
98 96
 }

+ 29
- 37
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeMatcher.java View File

@@ -15,9 +15,9 @@ import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
15 15
  * @author Hoofdgebruiker
16 16
  */
17 17
 public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching, Boolean, RuntimeException> {
18
-	public static Map<TypeParameter, StoredType> match(LocalMemberCache cache, StoredType type, StoredType pattern) {
18
+	public static Map<TypeParameter, TypeID> match(LocalMemberCache cache, TypeID type, TypeID pattern) {
19 19
 		Matching matching = new Matching(cache, type);
20
-		if (pattern.type.accept(matching, INSTANCE))
20
+		if (pattern.accept(matching, INSTANCE))
21 21
 			return matching.mapping;
22 22
 		
23 23
 		return null;
@@ -29,18 +29,13 @@ public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching,
29 29
 	
30 30
 	@Override
31 31
 	public Boolean visitBasic(Matching context, BasicTypeID basic) {
32
-		return context.type.isBasic(basic);
33
-	}
34
-
35
-	@Override
36
-	public Boolean visitString(Matching context, StringTypeID string) {
37
-		return context.type.type == StringTypeID.INSTANCE;
32
+		return context.type == basic;
38 33
 	}
39 34
 
40 35
 	@Override
41 36
 	public Boolean visitArray(Matching context, ArrayTypeID array) {
42
-		if (context.type.type instanceof ArrayTypeID) {
43
-			ArrayTypeID arrayType = (ArrayTypeID) context.type.type;
37
+		if (context.type instanceof ArrayTypeID) {
38
+			ArrayTypeID arrayType = (ArrayTypeID) context.type;
44 39
 			if (arrayType.dimension != array.dimension)
45 40
 				return false;
46 41
 
@@ -52,8 +47,8 @@ public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching,
52 47
 
53 48
 	@Override
54 49
 	public Boolean visitAssoc(Matching context, AssocTypeID assoc) {
55
-		if (context.type.type instanceof AssocTypeID) {
56
-			AssocTypeID assocType = (AssocTypeID) context.type.type;
50
+		if (context.type instanceof AssocTypeID) {
51
+			AssocTypeID assocType = (AssocTypeID) context.type;
57 52
 			return match(context, assocType.keyType, assoc.keyType)
58 53
 					&& match(context, assocType.valueType, assoc.valueType);
59 54
 		} else {
@@ -68,8 +63,8 @@ public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching,
68 63
 
69 64
 	@Override
70 65
 	public Boolean visitIterator(Matching context, IteratorTypeID iterator) {
71
-		if (context.type.type instanceof IteratorTypeID) {
72
-			IteratorTypeID iteratorType = (IteratorTypeID) context.type.type;
66
+		if (context.type instanceof IteratorTypeID) {
67
+			IteratorTypeID iteratorType = (IteratorTypeID) context.type;
73 68
 			if (iteratorType.iteratorTypes.length != iterator.iteratorTypes.length)
74 69
 				return false;
75 70
 
@@ -85,8 +80,8 @@ public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching,
85 80
 
86 81
 	@Override
87 82
 	public Boolean visitFunction(Matching context, FunctionTypeID function) {
88
-		if (context.type.type instanceof FunctionTypeID) {
89
-			FunctionTypeID functionType = (FunctionTypeID) context.type.type;
83
+		if (context.type instanceof FunctionTypeID) {
84
+			FunctionTypeID functionType = (FunctionTypeID) context.type;
90 85
 			if (functionType.header.parameters.length != function.header.parameters.length)
91 86
 				return false;
92 87
 
@@ -106,8 +101,8 @@ public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching,
106 101
 
107 102
 	@Override
108 103
 	public Boolean visitDefinition(Matching context, DefinitionTypeID definition) {
109
-		if (context.type.type instanceof DefinitionTypeID) {
110
-			DefinitionTypeID definitionType = (DefinitionTypeID) context.type.type;
104
+		if (context.type instanceof DefinitionTypeID) {
105
+			DefinitionTypeID definitionType = (DefinitionTypeID) context.type;
111 106
 			if (definitionType.definition != definition.definition)
112 107
 				return false;
113 108
 
@@ -127,9 +122,9 @@ public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching,
127 122
 	@Override
128 123
 	public Boolean visitGeneric(Matching context, GenericTypeID generic) {
129 124
 		if (context.mapping.containsKey(generic.parameter)) {
130
-			StoredType argument = context.mapping.get(generic.parameter);
131
-			return argument.type == context.type && (argument.getSpecifiedStorage() == null || argument.getSpecifiedStorage() == context.type.getSpecifiedStorage());
132
-		} else if (context.type.type == generic || generic.matches(context.cache, context.type)) {
125
+			TypeID argument = context.mapping.get(generic.parameter);
126
+			return argument == context.type;
127
+		} else if (context.type == generic || generic.matches(context.cache, context.type)) {
133 128
 			context.mapping.put(generic.parameter, context.type);
134 129
 			return true;
135 130
 		} else {
@@ -139,8 +134,8 @@ public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching,
139 134
 
140 135
 	@Override
141 136
 	public Boolean visitRange(Matching context, RangeTypeID range) {
142
-		if (context.type.type instanceof RangeTypeID) {
143
-			RangeTypeID rangeType = (RangeTypeID) context.type.type;
137
+		if (context.type instanceof RangeTypeID) {
138
+			RangeTypeID rangeType = (RangeTypeID) context.type;
144 139
 			return match(context, rangeType.baseType, range.baseType);
145 140
 		} else {
146 141
 			return false;
@@ -149,44 +144,41 @@ public class TypeMatcher implements TypeVisitorWithContext<TypeMatcher.Matching,
149 144
 
150 145
 	@Override
151 146
 	public Boolean visitOptional(Matching context, OptionalTypeID type) {
152
-		if (context.type.type instanceof OptionalTypeID) {
153
-			OptionalTypeID modified = (OptionalTypeID) context.type.type;
154
-			return match(context, modified.baseType.stored(), type.baseType.stored());
147
+		if (context.type instanceof OptionalTypeID) {
148
+			OptionalTypeID modified = (OptionalTypeID) context.type;
149
+			return match(context, modified.baseType, type.baseType);
155 150
 		} else {
156 151
 			return false;
157 152
 		}
158 153
 	}
159 154
 
160
-	private boolean match(Matching context, StoredType type, StoredType pattern) {
161
-		if (pattern.getSpecifiedStorage() != null && !pattern.getSpecifiedStorage().equals(type.getSpecifiedStorage()))
162
-			return false;
163
-		
164
-		return pattern.type.accept(context.withType(type), this);
155
+	private boolean match(Matching context, TypeID type, TypeID pattern) {
156
+		return pattern.accept(context.withType(type), this);
165 157
 	}
166 158
 
167 159
 	@Override
168 160
 	public Boolean visitGenericMap(Matching context, GenericMapTypeID map) {
169
-		return map == context.type.type; // TODO: improve this
161
+		return map == context.type; // TODO: improve this
170 162
 	}
171 163
 		
172 164
 	public static final class Matching {
173 165
 		public final LocalMemberCache cache;
174
-		public final StoredType type;
175
-		public final Map<TypeParameter, StoredType> mapping;
166
+		public final TypeID type;
167
+		public final Map<TypeParameter, TypeID> mapping;
176 168
 		
177
-		public Matching(LocalMemberCache cache, StoredType type) {
169
+		public Matching(LocalMemberCache cache, TypeID type) {
178 170
 			this.cache = cache;
179 171
 			this.type = type;
180 172
 			mapping = new HashMap<>();
181 173
 		}
182 174
 		
183
-		private Matching(LocalMemberCache cache, StoredType type, Map<TypeParameter, StoredType> mapping) {
175
+		private Matching(LocalMemberCache cache, TypeID type, Map<TypeParameter, TypeID> mapping) {
184 176
 			this.cache = cache;
185 177
 			this.type = type;
186 178
 			this.mapping = mapping;
187 179
 		}
188 180
 		
189
-		public Matching withType(StoredType type) {
181
+		public Matching withType(TypeID type) {
190 182
 			return new Matching(cache, type, mapping);
191 183
 		}
192 184
 	}

+ 0
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeVisitor.java View File

@@ -12,8 +12,6 @@ package org.openzen.zenscript.codemodel.type;
12 12
 public interface TypeVisitor<T> {
13 13
 	T visitBasic(BasicTypeID basic);
14 14
 	
15
-	T visitString(StringTypeID string);
16
-	
17 15
 	T visitArray(ArrayTypeID array);
18 16
 	
19 17
 	T visitAssoc(AssocTypeID assoc);

+ 1
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/TypeVisitorWithContext.java View File

@@ -11,9 +11,7 @@ package org.openzen.zenscript.codemodel.type;
11 11
  */
12 12
 public interface TypeVisitorWithContext<C, R, E extends Exception> {
13 13
 	R visitBasic(C context, BasicTypeID basic) throws E;
14
-	
15
-	R visitString(C context, StringTypeID string) throws E;
16
-	
14
+
17 15
 	R visitArray(C context, ArrayTypeID array) throws E;
18 16
 	
19 17
 	R visitAssoc(C context, AssocTypeID assoc) throws E;

+ 4
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/LocalMemberCache.java View File

@@ -11,7 +11,7 @@ import java.util.List;
11 11
 import java.util.Map;
12 12
 import org.openzen.zenscript.codemodel.definition.ExpansionDefinition;
13 13
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
14
-import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15 15
 
16 16
 /**
17 17
  *
@@ -19,7 +19,7 @@ import org.openzen.zenscript.codemodel.type.StoredType;
19 19
  */
20 20
 public class LocalMemberCache {
21 21
 	private final GlobalTypeRegistry registry;
22
-	private final Map<StoredType, TypeMembers> types = new HashMap<>();
22
+	private final Map<TypeID, TypeMembers> types = new HashMap<>();
23 23
 	private final List<ExpansionDefinition> expansions = new ArrayList<>();
24 24
 	
25 25
 	public LocalMemberCache(
@@ -33,7 +33,7 @@ public class LocalMemberCache {
33 33
 		return registry;
34 34
 	}
35 35
 	
36
-	public TypeMembers get(StoredType type) {
36
+	public TypeMembers get(TypeID type) {
37 37
 		type = type.getNormalized();
38 38
 		if (types.containsKey(type)) {
39 39
 			return types.get(type);
@@ -46,7 +46,7 @@ public class LocalMemberCache {
46 46
 	}
47 47
 	
48 48
 	private void registerMembers(TypeMembers members) {
49
-		members.type.type.accept(null, new TypeMemberBuilder(registry, members, this));
49
+		members.type.accept(null, new TypeMemberBuilder(registry, members, this));
50 50
 	}
51 51
 	
52 52
 	public List<ExpansionDefinition> getExpansions() {

+ 237
- 287
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberBuilder.java
File diff suppressed because it is too large
View File


+ 9
- 12
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberGroup.java View File

@@ -32,7 +32,6 @@ import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
32 32
 import org.openzen.zenscript.codemodel.member.ref.GetterMemberRef;
33 33
 import org.openzen.zenscript.codemodel.member.ref.SetterMemberRef;
34 34
 import org.openzen.zenscript.codemodel.scope.TypeScope;
35
-import org.openzen.zenscript.codemodel.type.StoredType;
36 35
 import org.openzen.zenscript.codemodel.type.TypeID;
37 36
 
38 37
 /**
@@ -116,7 +115,7 @@ public class TypeMemberGroup {
116 115
 		return false;
117 116
 	}
118 117
 	
119
-	public FunctionalMemberRef getStaticMethod(int arguments, StoredType returnType) {
118
+	public FunctionalMemberRef getStaticMethod(int arguments, TypeID returnType) {
120 119
 		for (TypeMember<FunctionalMemberRef> method : methods) {
121 120
 			if (method.member.isStatic() && method.member.getHeader().accepts(arguments) && method.member.getHeader().getReturnType().equals(returnType))
122 121
 				return method.member;
@@ -261,8 +260,8 @@ public class TypeMemberGroup {
261 260
 		}
262 261
 	}
263 262
 	
264
-	public List<StoredType>[] predictCallTypes(CodePosition position, TypeScope scope, List<StoredType> typeHints, int arguments) {
265
-		List<StoredType>[] result = (List<StoredType>[])(new List[arguments]);
263
+	public List<TypeID>[] predictCallTypes(CodePosition position, TypeScope scope, List<TypeID> typeHints, int arguments) {
264
+		List<TypeID>[] result = (List<TypeID>[])(new List[arguments]);
266 265
 		for (int i = 0; i < result.length; i++)
267 266
 			result[i] = new ArrayList<>();
268 267
 		
@@ -271,16 +270,14 @@ public class TypeMemberGroup {
271 270
 			if (header.parameters.length != arguments)
272 271
 				continue;
273 272
 			
274
-			if (header.typeParameters != null) {
275
-				for (StoredType resultHint : typeHints) {
276
-					Map<TypeParameter, StoredType> mapping = header.getReturnType().inferTypeParameters(scope.getMemberCache(), resultHint);
277
-					if (mapping != null) {
278
-						header = header.withGenericArguments(scope.getLocalTypeParameters().getInner(position, scope.getTypeRegistry(), mapping));
279
-						break;
280
-					}
273
+			for (TypeID resultHint : typeHints) {
274
+				Map<TypeParameter, TypeID> mapping = header.getReturnType().inferTypeParameters(scope.getMemberCache(), resultHint);
275
+				if (mapping != null) {
276
+					header = header.withGenericArguments(scope.getLocalTypeParameters().getInner(position, scope.getTypeRegistry(), mapping));
277
+					break;
281 278
 				}
282 279
 			}
283
-			
280
+
284 281
 			for (int i = 0; i < header.parameters.length; i++) {
285 282
 				if (!result[i].contains(header.parameters[i].type))
286 283
 					result[i].add(header.parameters[i].type);

+ 44
- 67
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMembers.java View File

@@ -21,7 +21,6 @@ import org.openzen.zenscript.codemodel.expression.Expression;
21 21
 import org.openzen.zenscript.codemodel.expression.InterfaceCastExpression;
22 22
 import org.openzen.zenscript.codemodel.expression.InvalidExpression;
23 23
 import org.openzen.zenscript.codemodel.expression.NullExpression;
24
-import org.openzen.zenscript.codemodel.expression.StorageCastExpression;
25 24
 import org.openzen.zenscript.codemodel.expression.SupertypeCastExpression;
26 25
 import org.openzen.zenscript.codemodel.expression.WrapOptionalExpression;
27 26
 import org.openzen.zenscript.codemodel.member.EnumConstantMember;
@@ -56,7 +55,7 @@ import org.openzen.zenscript.codemodel.type.TypeID;
56 55
  */
57 56
 public final class TypeMembers {
58 57
 	private final LocalMemberCache cache;
59
-	public final StoredType type;
58
+	public final TypeID type;
60 59
 	
61 60
 	private final List<TypeMember<CasterMemberRef>> casters = new ArrayList<>();
62 61
 	private final List<TypeMember<ImplementationMemberRef>> implementations = new ArrayList<>();
@@ -68,10 +67,10 @@ public final class TypeMembers {
68 67
 	private final Map<String, InnerDefinition> innerTypes = new HashMap<>();
69 68
 	private final Map<OperatorType, TypeMemberGroup> operators = new HashMap<>();
70 69
 	
71
-	public TypeMembers(LocalMemberCache cache, StoredType type) {
70
+	public TypeMembers(LocalMemberCache cache, TypeID type) {
72 71
 		if (type == null)
73 72
 			throw new NullPointerException("Type must not be null!");
74
-		if (type.type == BasicTypeID.UNDETERMINED)
73
+		if (type == BasicTypeID.UNDETERMINED)
75 74
 			throw new IllegalArgumentException("Cannot retrieve members of undetermined type");
76 75
 		
77 76
 		this.cache = cache;
@@ -84,16 +83,16 @@ public final class TypeMembers {
84 83
 	
85 84
 	public boolean extendsOrImplements(TypeID other) {
86 85
 		other = other.getNormalized();
87
-		TypeID superType = type.type.getSuperType(cache.getRegistry());
86
+		TypeID superType = type.getSuperType(cache.getRegistry());
88 87
 		if (superType != null) {
89 88
 			if (superType == other)
90 89
 				return true;
91
-			if (cache.get(superType.stored(type.getActualStorage())).extendsOrImplements(other))
90
+			if (cache.get(superType).extendsOrImplements(other))
92 91
 				return true;
93 92
 		}
94 93
 		
95 94
 		for (TypeMember<ImplementationMemberRef> implementation : implementations) {
96
-			if (implementation.member.implementsType.type == other)
95
+			if (implementation.member.implementsType == other)
97 96
 				return true;
98 97
 			if (cache.get(implementation.member.implementsType).extendsOrImplements(other))
99 98
 				return true;
@@ -104,11 +103,11 @@ public final class TypeMembers {
104 103
 	
105 104
 	public boolean extendsType(TypeID other) {
106 105
 		other = other.getNormalized();
107
-		TypeID superType = type.type.getSuperType(cache.getRegistry());
106
+		TypeID superType = type.getSuperType(cache.getRegistry());
108 107
 		if (superType != null) {
109 108
 			if (superType == other)
110 109
 				return true;
111
-			if (cache.get(superType.stored(type.getActualStorage())).extendsType(other))
110
+			if (cache.get(superType).extendsType(other))
112 111
 				return true;
113 112
 		}
114 113
 		
@@ -163,7 +162,7 @@ public final class TypeMembers {
163 162
 		return null;
164 163
 	}
165 164
 	
166
-	public StoredType union(StoredType other) {
165
+	public TypeID union(TypeID other) {
167 166
 		other = other.getNormalized();
168 167
 		if (type == other)
169 168
 			return type;
@@ -386,7 +385,7 @@ public final class TypeMembers {
386 385
 		return null;
387 386
 	}
388 387
 	
389
-	public StoredType[] getLoopTypes(int variables) {
388
+	public TypeID[] getLoopTypes(int variables) {
390 389
 		for (TypeMember<IteratorMemberRef> iterator : iterators)
391 390
 			if (iterator.member.getLoopVariableCount() == variables)
392 391
 				return iterator.member.types;
@@ -394,62 +393,50 @@ public final class TypeMembers {
394 393
 		return null;
395 394
 	}
396 395
 	
397
-	public boolean canCastImplicit(StoredType toType) {
396
+	public boolean canCastImplicit(TypeID toType) {
398 397
 		toType = toType.getNormalized();
399
-		if (areEquivalent(type, toType))
398
+		if (type == toType)
400 399
 			return true;
401
-		if (toType.type == BasicTypeID.UNDETERMINED)
400
+		if (toType == BasicTypeID.UNDETERMINED)
402 401
 			throw new IllegalArgumentException("Cannot cast to undetermined type!");
403
-		if (type.type == BasicTypeID.NULL && toType.type.isOptional())
402
+		if (type == BasicTypeID.NULL && toType.isOptional())
404 403
 			return true;
405 404
 		
406
-		if (!type.getActualStorage().canCastTo(toType.getActualStorage()) && !toType.getActualStorage().canCastFrom(type.getActualStorage()))
407
-			return false;
408
-		
409 405
 		if (toType.isOptional() && canCastImplicit(toType.withoutOptional()))
410 406
 			return true;
411
-		if (type.isOptional() && areEquivalent(type.withoutOptional(), toType))
412
-			return true;
413
-		
414
-		return getImplicitCaster(toType) != null || extendsOrImplements(toType.type);
415
-	}
416
-	
417
-	private boolean areEquivalent(StoredType fromType, StoredType toType) {
418
-		if (fromType == toType)
407
+		if (type.isOptional() && type.withoutOptional() == toType)
419 408
 			return true;
420
-		if (!fromType.getActualStorage().canCastTo(toType.getActualStorage()) && !toType.getActualStorage().canCastFrom(fromType.getActualStorage()))
421
-			return false;
422 409
 		
423
-		return fromType.type == toType.type;
410
+		return getImplicitCaster(toType) != null || extendsOrImplements(toType);
424 411
 	}
425 412
 	
426
-	public CasterMemberRef getImplicitCaster(StoredType toType) {
413
+	public CasterMemberRef getImplicitCaster(TypeID toType) {
427 414
 		toType = toType.getNormalized();
428 415
 		for (TypeMember<CasterMemberRef> caster : casters) {
429
-			if (caster.member.isImplicit() && areEquivalent(caster.member.toType, toType))
416
+			if (caster.member.isImplicit() && caster.member.toType == toType)
430 417
 				return caster.member;
431 418
 		}
432 419
 		
433 420
 		return null;
434 421
 	}
435 422
 	
436
-	public CasterMemberRef getCaster(StoredType toType) {
423
+	public CasterMemberRef getCaster(TypeID toType) {
437 424
 		toType = toType.getNormalized();
438 425
 		for (TypeMember<CasterMemberRef> caster : casters) {
439
-			if (areEquivalent(caster.member.toType, toType))
426
+			if (caster.member.toType == toType)
440 427
 				return caster.member;
441 428
 		}
442 429
 		
443 430
 		return null;
444 431
 	}
445 432
 	
446
-	public boolean canCast(StoredType toType) {
433
+	public boolean canCast(TypeID toType) {
447 434
 		toType = toType.getNormalized();
448 435
 		if (canCastImplicit(toType))
449 436
 			return true;
450 437
 		
451 438
 		for (TypeMember<CasterMemberRef> caster : casters) {
452
-			if (areEquivalent(caster.member.toType, toType))
439
+			if (caster.member.toType == toType)
453 440
 				return true;
454 441
 		}
455 442
 		
@@ -524,56 +511,46 @@ public final class TypeMembers {
524 511
 		return result;
525 512
 	}
526 513
 	
527
-	private Expression castEquivalent(CodePosition position, Expression value, StoredType toType) {
528
-		if (toType.equals(value.type))
529
-			return value;
530
-		
531
-		//if (!(toType.type instanceof StringTypeID))
532
-		//	System.out.println(position + ": " + value.type.getActualStorage() + " -> " + toType.getActualStorage());
533
-		
534
-		return new StorageCastExpression(position, value, toType);
535
-	}
536
-	
537
-	public Expression castImplicit(CodePosition position, Expression value, StoredType toType, boolean implicit) {
514
+	public Expression castImplicit(CodePosition position, Expression value, TypeID toType, boolean implicit) {
538 515
 		if (toType == null)
539 516
 			throw new NullPointerException();
540 517
 		
541 518
 		toType = toType.getNormalized();
542
-		if (toType.type == BasicTypeID.UNDETERMINED)
519
+		if (toType == BasicTypeID.UNDETERMINED)
543 520
 			return value;
544
-		if (areEquivalent(type, toType))
545
-			return castEquivalent(position, value, toType);
546
-		
547
-		if (type.type == BasicTypeID.NULL && toType.isOptional())
521
+		if (type == toType)
522
+			return value;
523
+
524
+		if (type == BasicTypeID.NULL && toType.isOptional())
548 525
 			return new NullExpression(position, toType);
549 526
 		if (toType.isOptional() && canCastImplicit(toType.withoutOptional()))
550
-			return castEquivalent(position, new WrapOptionalExpression(position, castImplicit(position, value, toType.withoutOptional(), implicit), toType), toType);
551
-		if (type.isOptional() && areEquivalent(type.withoutOptional(), toType))
552
-			return castEquivalent(position, new CheckNullExpression(position, value), toType);
527
+			return new WrapOptionalExpression(position, castImplicit(position, value, toType.withoutOptional(), implicit), toType);
528
+		if (type.isOptional() && type.withoutOptional() == toType)
529
+			return new CheckNullExpression(position, value);
553 530
 		
554 531
 		for (TypeMember<CasterMemberRef> caster : casters) {
555
-			if (caster.member.isImplicit() && areEquivalent(caster.member.toType, toType))
556
-				return castEquivalent(position, caster.member.cast(position, value, implicit), toType);
532
+			if (caster.member.isImplicit() && caster.member.toType == toType)
533
+				return caster.member.cast(position, value, implicit);
557 534
 		}
558 535
 		for (TypeMember<ImplementationMemberRef> implementation : implementations) {
559
-			if (implementation.member.implementsType.type.getNormalized() == toType.type)
560
-				return castEquivalent(position, new InterfaceCastExpression(position, value, implementation.member), toType);
536
+			if (implementation.member.implementsType.getNormalized() == toType)
537
+				return new InterfaceCastExpression(position, value, implementation.member);
561 538
 		}
562
-		if (extendsType(toType.type))
539
+		if (extendsType(toType))
563 540
 			return new SupertypeCastExpression(position, value, toType);
564 541
 		
565 542
 		return new InvalidExpression(position, toType, CompileExceptionCode.INVALID_CAST, "Could not cast " + toString() + " to " + toType);
566 543
 	}
567 544
 	
568
-	public Expression castExplicit(CodePosition position, Expression value, StoredType toType, boolean optional) {
545
+	public Expression castExplicit(CodePosition position, Expression value, TypeID toType, boolean optional) {
569 546
 		toType = toType.getNormalized();
570 547
 		if (this.canCastImplicit(toType))
571 548
 			return castImplicit(position, value, toType, false);
572 549
 		
573 550
 		for (TypeMember<CasterMemberRef> caster : casters)
574
-			if (areEquivalent(caster.member.toType, toType))
575
-				return castEquivalent(position, caster.member.cast(position, value, false), toType);
576
-		
551
+			if (caster.member.toType == toType)
552
+				return value;
553
+
577 554
 		return new InvalidExpression(position, toType, CompileExceptionCode.INVALID_CAST, "Cannot cast " + toString() + " to " + toType + ", even explicitly");
578 555
 	}
579 556
 	
@@ -586,7 +563,7 @@ public final class TypeMembers {
586 563
 			TypeMemberGroup group = members.get(name.name);
587 564
 			
588 565
 			if (group.isStatic)
589
-				return new PartialStaticMemberGroupExpression(position, scope, type.type, group, name.arguments);
566
+				return new PartialStaticMemberGroupExpression(position, scope, type, group, name.arguments);
590 567
 			else
591 568
 				return new PartialMemberGroupExpression(position, scope, target, group, name.arguments, allowStatic);
592 569
 		}
@@ -596,9 +573,9 @@ public final class TypeMembers {
596 573
 	
597 574
 	public IPartialExpression getStaticMemberExpression(CodePosition position, TypeScope scope, GenericName name) {
598 575
 		if (members.containsKey(name.name))
599
-			return new PartialStaticMemberGroupExpression(position, scope, type.type, members.get(name.name), name.arguments);
576
+			return new PartialStaticMemberGroupExpression(position, scope, type, members.get(name.name), name.arguments);
600 577
 		if (innerTypes.containsKey(name.name))
601
-			return new PartialTypeExpression(position, innerTypes.get(name.name).instance(cache.getRegistry(), name.arguments, (DefinitionTypeID)type.type), name.arguments);
578
+			return new PartialTypeExpression(position, innerTypes.get(name.name).instance(cache.getRegistry(), name.arguments, (DefinitionTypeID)type), name.arguments);
602 579
 		if (variantOptions.containsKey(name.name))
603 580
 			return new PartialVariantOptionExpression(position, scope, variantOptions.get(name.name));
604 581
 		
@@ -613,7 +590,7 @@ public final class TypeMembers {
613 590
 		if (!innerTypes.containsKey(name.name))
614 591
 			throw new RuntimeException("No such inner type in " + type + ": " + name.name);
615 592
 		
616
-		return innerTypes.get(name.name).instance(cache.getRegistry(), name.arguments, (DefinitionTypeID)type.type);
593
+		return innerTypes.get(name.name).instance(cache.getRegistry(), name.arguments, (DefinitionTypeID)type);
617 594
 	}
618 595
 	
619 596
 	@Override

+ 0
- 0
JavaBytecodeCompiler/src/main/java/org/openzen/zenscript/javabytecode/JavaBytecodeContext.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save