Browse Source

WIP on storage tags and improved error handling

Stan Hebben 6 years ago
parent
commit
e1b48ad7c8
100 changed files with 812 additions and 419 deletions
  1. 1
    1
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/DefinitionFormatter.java
  2. 10
    10
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/ExpressionFormatter.java
  3. 6
    6
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/FormattingUtils.java
  4. 5
    5
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/MemberFormatter.java
  5. 2
    2
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/StatementFormatter.java
  6. 18
    40
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/TypeFormatter.java
  7. 57
    40
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionHeader.java
  8. 17
    18
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionParameter.java
  9. 17
    16
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/GenericMapper.java
  10. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/HighLevelDefinition.java
  11. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/AnnotationDefinition.java
  12. 102
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidAnnotationDefinition.java
  13. 56
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidDefinitionAnnotation.java
  14. 70
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidMemberAnnotation.java
  15. 42
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidParameterAnnotation.java
  16. 44
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidStatementAnnotation.java
  17. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/NativeAnnotationDefinition.java
  18. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/ParameterAnnotation.java
  19. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/PreconditionAnnotationDefinition.java
  20. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/PreconditionForMethod.java
  21. 6
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/CompilingPackage.java
  22. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/CompilingType.java
  23. 8
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/FileResolutionContext.java
  24. 8
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/LocalTypeResolutionContext.java
  25. 9
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/ModuleTypeResolutionContext.java
  26. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/StatementContext.java
  27. 9
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/TypeContext.java
  28. 4
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/TypeResolutionContext.java
  29. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/AliasDefinition.java
  30. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/ExpansionDefinition.java
  31. 5
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/FunctionDefinition.java
  32. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/InterfaceDefinition.java
  33. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/VariantDefinition.java
  34. 12
    13
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/ZSPackage.java
  35. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/AndAndExpression.java
  36. 5
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ArrayExpression.java
  37. 12
    11
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CallArguments.java
  38. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CallStaticExpression.java
  39. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedExpression.java
  40. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedThisExpression.java
  41. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CompareExpression.java
  42. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConditionalExpression.java
  43. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantBoolExpression.java
  44. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantByteExpression.java
  45. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantCharExpression.java
  46. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantDoubleExpression.java
  47. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantFloatExpression.java
  48. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantIntExpression.java
  49. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantLongExpression.java
  50. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantSByteExpression.java
  51. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantShortExpression.java
  52. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantUIntExpression.java
  53. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantULongExpression.java
  54. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantUShortExpression.java
  55. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantUSizeExpression.java
  56. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstructorSuperCallExpression.java
  57. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstructorThisCallExpression.java
  58. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/DummyExpression.java
  59. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/EnumConstantExpression.java
  60. 23
    21
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/Expression.java
  61. 9
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionBuilder.java
  62. 4
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionVisitor.java
  63. 2
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionVisitorWithContext.java
  64. 4
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/FunctionExpression.java
  65. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetFieldExpression.java
  66. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetStaticFieldExpression.java
  67. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/InterfaceCastExpression.java
  68. 57
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/InvalidExpression.java
  69. 6
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/IsExpression.java
  70. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MakeConstExpression.java
  71. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MapExpression.java
  72. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MatchExpression.java
  73. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NewExpression.java
  74. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NullExpression.java
  75. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/OrOrExpression.java
  76. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/PanicExpression.java
  77. 7
    7
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/RangeExpression.java
  78. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SameObjectExpression.java
  79. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/StorageCastExpression.java
  80. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SupertypeCastExpression.java
  81. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThisExpression.java
  82. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThrowExpression.java
  83. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryConvertExpression.java
  84. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryRethrowAsExceptionExpression.java
  85. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryRethrowAsResultExpression.java
  86. 4
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/VariantValueExpression.java
  87. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/WrapOptionalExpression.java
  88. 7
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/ParameterSuperBound.java
  89. 11
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/ParameterTypeBound.java
  90. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/TypeParameter.java
  91. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/TypeParameterBound.java
  92. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/CasterMember.java
  93. 3
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ConstMember.java
  94. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ConstructorMember.java
  95. 1
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/DefinitionMember.java
  96. 9
    8
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FieldMember.java
  97. 6
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FunctionalMember.java
  98. 5
    5
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/GetterMember.java
  99. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/IDefinitionMember.java
  100. 0
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ImplementationMember.java

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

195
 				for (int i = 0; i < option.types.length; i++) {
195
 				for (int i = 0; i < option.types.length; i++) {
196
 					if (i > 0)
196
 					if (i > 0)
197
 						output.append(", ");
197
 						output.append(", ");
198
-					output.append(option.types[i].accept(typeFormatter));
198
+					output.append(typeFormatter.format(option.types[i]));
199
 				}
199
 				}
200
 			}
200
 			}
201
 		}
201
 		}

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

312
 		result.append(expression.target.accept(this).value);
312
 		result.append(expression.target.accept(this).value);
313
 		if (!expression.isImplicit) {
313
 		if (!expression.isImplicit) {
314
 			result.append(" as ");
314
 			result.append(" as ");
315
-			result.append(expression.member.toType.accept(typeFormatter));
315
+			result.append(typeFormatter.format(expression.member.toType));
316
 		}
316
 		}
317
 		return new ExpressionString(result.toString(), ZenScriptOperator.PRIMARY);
317
 		return new ExpressionString(result.toString(), ZenScriptOperator.PRIMARY);
318
 	}
318
 	}
341
 	@Override
341
 	@Override
342
 	public ExpressionString visitConst(ConstExpression expression) {
342
 	public ExpressionString visitConst(ConstExpression expression) {
343
 		StringBuilder result = new StringBuilder();
343
 		StringBuilder result = new StringBuilder();
344
-		result.append(expression.type.accept(typeFormatter));
344
+		result.append(typeFormatter.format(expression.type));
345
 		result.append('.');
345
 		result.append('.');
346
 		result.append(expression.constant.member.name);
346
 		result.append(expression.constant.member.name);
347
 		return new ExpressionString(result.toString(), ZenScriptOperator.MEMBER);
347
 		return new ExpressionString(result.toString(), ZenScriptOperator.MEMBER);
440
 
440
 
441
 	@Override
441
 	@Override
442
 	public ExpressionString visitEnumConstant(EnumConstantExpression expression) {
442
 	public ExpressionString visitEnumConstant(EnumConstantExpression expression) {
443
-		return new ExpressionString(expression.type.accept(typeFormatter) + "." + expression.value.name, ZenScriptOperator.MEMBER);
443
+		return new ExpressionString(typeFormatter.format(expression.type) + "." + expression.value.name, ZenScriptOperator.MEMBER);
444
 	}
444
 	}
445
 
445
 
446
 	@Override
446
 	@Override
497
 	@Override
497
 	@Override
498
 	public ExpressionString visitGetStaticField(GetStaticFieldExpression expression) {
498
 	public ExpressionString visitGetStaticField(GetStaticFieldExpression expression) {
499
 		StringBuilder result = new StringBuilder();
499
 		StringBuilder result = new StringBuilder();
500
-		result.append(expression.type.accept(typeFormatter));
500
+		result.append(typeFormatter.format(expression.type));
501
 		result.append('.');
501
 		result.append('.');
502
 		result.append(expression.field.member.name);
502
 		result.append(expression.field.member.name);
503
 		return new ExpressionString(result.toString(), ZenScriptOperator.MEMBER);
503
 		return new ExpressionString(result.toString(), ZenScriptOperator.MEMBER);
530
 		StringBuilder result = new StringBuilder();
530
 		StringBuilder result = new StringBuilder();
531
 		result.append(expression.value.accept(this).value);
531
 		result.append(expression.value.accept(this).value);
532
 		result.append(" as ");
532
 		result.append(" as ");
533
-		result.append(expression.type.accept(typeFormatter));
533
+		result.append(typeFormatter.format(expression.type));
534
 		return new ExpressionString(result.toString(), ZenScriptOperator.CAST);
534
 		return new ExpressionString(result.toString(), ZenScriptOperator.CAST);
535
 	}
535
 	}
536
 
536
 
539
 		StringBuilder result = new StringBuilder();
539
 		StringBuilder result = new StringBuilder();
540
 		result.append(expression.value.accept(this).value);
540
 		result.append(expression.value.accept(this).value);
541
 		result.append(" is ");
541
 		result.append(" is ");
542
-		result.append(expression.type.accept(typeFormatter));
542
+		result.append(typeFormatter.format(expression.type));
543
 		return new ExpressionString(result.toString(), ZenScriptOperator.IS);
543
 		return new ExpressionString(result.toString(), ZenScriptOperator.IS);
544
 	}
544
 	}
545
 
545
 
577
 	public ExpressionString visitNew(NewExpression expression) {
577
 	public ExpressionString visitNew(NewExpression expression) {
578
 		StringBuilder result = new StringBuilder();
578
 		StringBuilder result = new StringBuilder();
579
 		result.append("new ");
579
 		result.append("new ");
580
-		result.append(expression.type.accept(typeFormatter));
580
+		result.append(typeFormatter.format(expression.type));
581
 		FormattingUtils.formatCall(result, typeFormatter, this, expression.arguments);
581
 		FormattingUtils.formatCall(result, typeFormatter, this, expression.arguments);
582
 		return new ExpressionString(result.toString(), ZenScriptOperator.PRIMARY);
582
 		return new ExpressionString(result.toString(), ZenScriptOperator.PRIMARY);
583
 	}
583
 	}
636
 	@Override
636
 	@Override
637
 	public ExpressionString visitSetStaticField(SetStaticFieldExpression expression) {
637
 	public ExpressionString visitSetStaticField(SetStaticFieldExpression expression) {
638
 		return new ExpressionString(
638
 		return new ExpressionString(
639
-				expression.type.accept(typeFormatter) + "." + expression.field.member.name + " = " + expression.value.accept(this).value,
639
+				typeFormatter.format(expression.type) + "." + expression.field.member.name + " = " + expression.value.accept(this).value,
640
 				ZenScriptOperator.ASSIGN);
640
 				ZenScriptOperator.ASSIGN);
641
 	}
641
 	}
642
 
642
 
650
 	@Override
650
 	@Override
651
 	public ExpressionString visitStaticGetter(StaticGetterExpression expression) {
651
 	public ExpressionString visitStaticGetter(StaticGetterExpression expression) {
652
 		return new ExpressionString(
652
 		return new ExpressionString(
653
-				expression.type.accept(typeFormatter) + "." + expression.getter.member.name, 
653
+				typeFormatter.format(expression.type) + "." + expression.getter.member.name, 
654
 				ZenScriptOperator.MEMBER);
654
 				ZenScriptOperator.MEMBER);
655
 	}
655
 	}
656
 
656
 
657
 	@Override
657
 	@Override
658
 	public ExpressionString visitStaticSetter(StaticSetterExpression expression) {
658
 	public ExpressionString visitStaticSetter(StaticSetterExpression expression) {
659
 		return new ExpressionString(
659
 		return new ExpressionString(
660
-				expression.type.accept(typeFormatter) + "." + expression.setter.member.name + " = " + expression.setter.member.name,
660
+				typeFormatter.format(expression.type) + "." + expression.setter.member.name + " = " + expression.setter.member.name,
661
 				ZenScriptOperator.ASSIGN);
661
 				ZenScriptOperator.ASSIGN);
662
 	}
662
 	}
663
 	
663
 	

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

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

+ 5
- 5
CodeFormatter/src/main/java/org/openzen/zenscript/formatter/MemberFormatter.java View File

62
 		output.append("const")
62
 		output.append("const")
63
 				.append(member.name)
63
 				.append(member.name)
64
 				.append(" as ")
64
 				.append(" as ")
65
-				.append(member.type.accept(typeFormatter))
65
+				.append(typeFormatter.format(member.type))
66
 				.append(" = ")
66
 				.append(" = ")
67
 				.append(member.value.accept(new ExpressionFormatter(settings, typeFormatter, indent)))
67
 				.append(member.value.accept(new ExpressionFormatter(settings, typeFormatter, indent)))
68
 				.append(";\n");
68
 				.append(";\n");
76
 		output.append(member.isFinal() ? "val " : "var ")
76
 		output.append(member.isFinal() ? "val " : "var ")
77
 				.append(member.name)
77
 				.append(member.name)
78
 				.append(" as ")
78
 				.append(" as ")
79
-				.append(member.type.accept(typeFormatter));
79
+				.append(typeFormatter.format(member.type));
80
 		
80
 		
81
 		if (member.initializer != null) {
81
 		if (member.initializer != null) {
82
 			output.append(" = ")
82
 			output.append(" = ")
122
 		output.append("get ");
122
 		output.append("get ");
123
 		output.append(member.name);
123
 		output.append(member.name);
124
 		output.append(" as ");
124
 		output.append(" as ");
125
-		output.append(member.type.accept(typeFormatter));
125
+		output.append(typeFormatter.format(member.type));
126
 		formatBody(member.body);
126
 		formatBody(member.body);
127
 		return null;
127
 		return null;
128
 	}
128
 	}
134
 		output.append("set ");
134
 		output.append("set ");
135
 		output.append(member.name);
135
 		output.append(member.name);
136
 		output.append(" as ");
136
 		output.append(" as ");
137
-		output.append(member.type.accept(typeFormatter));
137
+		output.append(typeFormatter.format(member.type));
138
 		formatBody(member.body);
138
 		formatBody(member.body);
139
 		return null;
139
 		return null;
140
 	}
140
 	}
186
 		visit(false);
186
 		visit(false);
187
 		FormattingUtils.formatModifiers(output, member.modifiers & ~Modifiers.FINAL);
187
 		FormattingUtils.formatModifiers(output, member.modifiers & ~Modifiers.FINAL);
188
 		output.append(" as ");
188
 		output.append(" as ");
189
-		output.append(member.toType.accept(typeFormatter));
189
+		output.append(typeFormatter.format(member.toType));
190
 		formatBody(member.body);
190
 		formatBody(member.body);
191
 		return null;
191
 		return null;
192
 	}
192
 	}

+ 2
- 2
CodeFormatter/src/main/java/org/openzen/zenscript/formatter/StatementFormatter.java View File

252
 		for (CatchClause catchClause : statement.catchClauses) {
252
 		for (CatchClause catchClause : statement.catchClauses) {
253
 			output.append(indent).append("catch ");
253
 			output.append(indent).append("catch ");
254
 			if (catchClause.exceptionVariable != null)
254
 			if (catchClause.exceptionVariable != null)
255
-				output.append(catchClause.exceptionVariable.name).append(" as ").append(catchClause.exceptionVariable.type.accept(expressionFormatter.typeFormatter));
255
+				output.append(catchClause.exceptionVariable.name).append(" as ").append(expressionFormatter.typeFormatter.format(catchClause.exceptionVariable.type));
256
 			
256
 			
257
 			format(ParentStatementType.CATCH, catchClause.content);
257
 			format(ParentStatementType.CATCH, catchClause.content);
258
 		}
258
 		}
274
 		
274
 		
275
 		if (statement.initializer == null || statement.initializer.type != statement.type) {
275
 		if (statement.initializer == null || statement.initializer.type != statement.type) {
276
 			output.append(" as ");
276
 			output.append(" as ");
277
-			output.append(statement.type.accept(expressionFormatter.typeFormatter));
277
+			output.append(expressionFormatter.typeFormatter.format(statement.type));
278
 		}
278
 		}
279
 		if (statement.initializer != null) {
279
 		if (statement.initializer != null) {
280
 			output.append(" = ");
280
 			output.append(" = ");

+ 18
- 40
CodeFormatter/src/main/java/org/openzen/zenscript/formatter/TypeFormatter.java View File

18
 import org.openzen.zenscript.codemodel.type.FunctionTypeID;
18
 import org.openzen.zenscript.codemodel.type.FunctionTypeID;
19
 import org.openzen.zenscript.codemodel.type.GenericMapTypeID;
19
 import org.openzen.zenscript.codemodel.type.GenericMapTypeID;
20
 import org.openzen.zenscript.codemodel.type.GenericTypeID;
20
 import org.openzen.zenscript.codemodel.type.GenericTypeID;
21
-import org.openzen.zenscript.codemodel.type.ITypeID;
22
 import org.openzen.zenscript.codemodel.type.IteratorTypeID;
21
 import org.openzen.zenscript.codemodel.type.IteratorTypeID;
23
 import org.openzen.zenscript.codemodel.type.RangeTypeID;
22
 import org.openzen.zenscript.codemodel.type.RangeTypeID;
23
+import org.openzen.zenscript.codemodel.type.StoredType;
24
 import org.openzen.zenscript.codemodel.type.StringTypeID;
24
 import org.openzen.zenscript.codemodel.type.StringTypeID;
25
+import org.openzen.zenscript.codemodel.type.TypeID;
25
 import stdlib.Chars;
26
 import stdlib.Chars;
26
 import org.openzen.zenscript.codemodel.type.TypeVisitor;
27
 import org.openzen.zenscript.codemodel.type.TypeVisitor;
27
 
28
 
37
 		this.settings = settings;
38
 		this.settings = settings;
38
 		this.importer = importer;
39
 		this.importer = importer;
39
 	}
40
 	}
41
+	
42
+	public String format(TypeID type) {
43
+		return type.accept(this);
44
+	}
45
+	
46
+	public String format(StoredType type) {
47
+		return type.type.accept(this) + "`" + type.storage.toString();
48
+	}
40
 
49
 
41
 	@Override
50
 	@Override
42
 	public String visitBasic(BasicTypeID basic) {
51
 	public String visitBasic(BasicTypeID basic) {
45
 	
54
 	
46
 	@Override
55
 	@Override
47
 	public String visitString(StringTypeID string) {
56
 	public String visitString(StringTypeID string) {
48
-		if (string.storage == null)
49
-			return "string";
50
-		else
51
-			return "string`" + string.storage.toString();
57
+		return "string";
52
 	}
58
 	}
53
 
59
 
54
 	@Override
60
 	@Override
55
 	public String visitArray(ArrayTypeID array) {
61
 	public String visitArray(ArrayTypeID array) {
56
-		String element = array.elementType.accept(this);
62
+		String element = format(array.elementType);
57
 		String result;
63
 		String result;
58
 		if (array.dimension == 1) {
64
 		if (array.dimension == 1) {
59
 			result = element + "[]";
65
 			result = element + "[]";
60
 		} else {
66
 		} else {
61
 			result = element + "[" + Chars.times(',', array.dimension - 1) + "]";
67
 			result = element + "[" + Chars.times(',', array.dimension - 1) + "]";
62
 		}
68
 		}
63
-		if (array.storage == null)
64
-			return result;
65
-		
66
-		return result + '`' + array.storage.toString();
69
+		return result;
67
 	}
70
 	}
68
 
71
 
69
 	@Override
72
 	@Override
70
 	public String visitAssoc(AssocTypeID assoc) {
73
 	public String visitAssoc(AssocTypeID assoc) {
71
-		String result = assoc.valueType.accept(this) + "[" + assoc.keyType.accept(this) + "]";
72
-		if (assoc.storage == null)
73
-			return result;
74
-		
75
-		return result + '`' + assoc.storage.toString();
74
+		return format(assoc.valueType) + "[" + format(assoc.keyType) + "]";
76
 	}
75
 	}
77
 
76
 
78
 	@Override
77
 	@Override
85
 		StringBuilder result = new StringBuilder();
84
 		StringBuilder result = new StringBuilder();
86
 		result.append("function");
85
 		result.append("function");
87
 		FormattingUtils.formatHeader(result, settings, function.header, this);
86
 		FormattingUtils.formatHeader(result, settings, function.header, this);
88
-		
89
-		if (function.storage != null) {
90
-			result.append('`');
91
-			result.append(function.storage.toString());
92
-		}
93
-		
94
 		return result.toString();
87
 		return result.toString();
95
 	}
88
 	}
96
 
89
 
104
 		result.append(importedName);
97
 		result.append(importedName);
105
 		result.append("<");
98
 		result.append("<");
106
 		int index = 0;
99
 		int index = 0;
107
-		for (ITypeID typeParameter : definition.typeArguments) {
100
+		for (TypeID typeParameter : definition.typeArguments) {
108
 			if (index > 0)
101
 			if (index > 0)
109
 				result.append(", ");
102
 				result.append(", ");
110
 			
103
 			
111
 			result.append(typeParameter.accept(this));
104
 			result.append(typeParameter.accept(this));
112
 		}
105
 		}
113
 		result.append(">");
106
 		result.append(">");
114
-		
115
-		if (definition.storage != null) {
116
-			result.append('`');
117
-			result.append(definition.storage.toString());
118
-		}
119
-		
120
 		return result.toString();
107
 		return result.toString();
121
 	}
108
 	}
122
 
109
 
123
 	@Override
110
 	@Override
124
 	public String visitGeneric(GenericTypeID generic) {
111
 	public String visitGeneric(GenericTypeID generic) {
125
-		if (generic.storage == null)
126
-			return generic.parameter.name;
127
-		
128
-		return generic.parameter.name + '`' + generic.storage.toString();
112
+		return generic.parameter.name;
129
 	}
113
 	}
130
 
114
 
131
 	@Override
115
 	@Override
132
 	public String visitRange(RangeTypeID range) {
116
 	public String visitRange(RangeTypeID range) {
133
-		return range.baseType.accept(this) + " .. " + range.baseType.accept(this);
117
+		return format(range.baseType) + " .. " + format(range.baseType);
134
 	}
118
 	}
135
 
119
 
136
 	@Override
120
 	@Override
160
 	@Override
144
 	@Override
161
 	public String visitGenericMap(GenericMapTypeID map) {
145
 	public String visitGenericMap(GenericMapTypeID map) {
162
 		StringBuilder result = new StringBuilder();
146
 		StringBuilder result = new StringBuilder();
163
-		result.append(map.value.accept(this));
147
+		result.append(format(map.value));
164
 		result.append("[<");
148
 		result.append("[<");
165
 		FormattingUtils.formatTypeParameters(result, new TypeParameter[] { map.key }, this);
149
 		FormattingUtils.formatTypeParameters(result, new TypeParameter[] { map.key }, this);
166
 		result.append("]>");
150
 		result.append("]>");
167
-		
168
-		if (map.storage != null) {
169
-			result.append('`');
170
-			result.append(map.storage.toString());
171
-		}
172
-		
173
 		return result.toString();
151
 		return result.toString();
174
 	}
152
 	}
175
 }
153
 }

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

14
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
14
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
15
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
15
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
16
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
16
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
17
-import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.scope.TypeScope;
17
 import org.openzen.zenscript.codemodel.scope.TypeScope;
18
+import org.openzen.zenscript.codemodel.type.StoredType;
19
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
19
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
20
+import org.openzen.zenscript.codemodel.type.TypeID;
20
 
21
 
21
 /**
22
 /**
22
  *
23
  *
24
  */
25
  */
25
 public class FunctionHeader {
26
 public class FunctionHeader {
26
 	public final TypeParameter[] typeParameters;
27
 	public final TypeParameter[] typeParameters;
27
-	private ITypeID returnType;
28
+	private StoredType returnType;
28
 	public final FunctionParameter[] parameters;
29
 	public final FunctionParameter[] parameters;
29
-	public final ITypeID thrownType;
30
+	public final StoredType thrownType;
30
 	
31
 	
31
 	public final int minParameters;
32
 	public final int minParameters;
32
 	public final int maxParameters;
33
 	public final int maxParameters;
33
 	public final boolean hasUnknowns;
34
 	public final boolean hasUnknowns;
34
 	
35
 	
35
-	public FunctionHeader(ITypeID returnType) {
36
+	public FunctionHeader(StoredType returnType) {
36
 		if (returnType == null)
37
 		if (returnType == null)
37
 			throw new NullPointerException();
38
 			throw new NullPointerException();
38
 		
39
 		
43
 		
44
 		
44
 		minParameters = 0;
45
 		minParameters = 0;
45
 		maxParameters = 0;
46
 		maxParameters = 0;
46
-		hasUnknowns = returnType == BasicTypeID.UNDETERMINED;
47
+		hasUnknowns = returnType == BasicTypeID.UNDETERMINED.stored;
47
 	}
48
 	}
48
 	
49
 	
49
-	public FunctionHeader(ITypeID returnType, ITypeID... parameterTypes) {
50
+	public FunctionHeader(BasicTypeID returnType) {
51
+		this(returnType.stored);
52
+	}
53
+	
54
+	public FunctionHeader(StoredType returnType, StoredType... parameterTypes) {
50
 		if (returnType == null)
55
 		if (returnType == null)
51
 			throw new NullPointerException();
56
 			throw new NullPointerException();
52
 		
57
 		
63
 		hasUnknowns = hasUnknowns(parameterTypes, returnType);
68
 		hasUnknowns = hasUnknowns(parameterTypes, returnType);
64
 	}
69
 	}
65
 	
70
 	
66
-	public FunctionHeader(ITypeID returnType, FunctionParameter... parameters) {
71
+	public FunctionHeader(BasicTypeID returnType, StoredType... parameterTypes) {
72
+		this(returnType.stored, parameterTypes);
73
+	}
74
+	
75
+	public FunctionHeader(StoredType returnType, FunctionParameter... parameters) {
67
 		if (returnType == null)
76
 		if (returnType == null)
68
 			throw new NullPointerException();
77
 			throw new NullPointerException();
69
 		
78
 		
77
 		hasUnknowns = hasUnknowns(parameters, returnType);
86
 		hasUnknowns = hasUnknowns(parameters, returnType);
78
 	}
87
 	}
79
 	
88
 	
80
-	public FunctionHeader(TypeParameter[] typeParameters, ITypeID returnType, ITypeID thrownType, FunctionParameter... parameters) {
89
+	public FunctionHeader(BasicTypeID returnType, FunctionParameter... parameters) {
90
+		this(returnType.stored, parameters);
91
+	}
92
+	
93
+	public FunctionHeader(TypeParameter[] typeParameters, StoredType returnType, StoredType thrownType, FunctionParameter... parameters) {
81
 		if (returnType == null)
94
 		if (returnType == null)
82
 			throw new NullPointerException();
95
 			throw new NullPointerException();
83
 		if (typeParameters == null)
96
 		if (typeParameters == null)
93
 		hasUnknowns = hasUnknowns(parameters, returnType);
106
 		hasUnknowns = hasUnknowns(parameters, returnType);
94
 	}
107
 	}
95
 	
108
 	
96
-	public ITypeID getReturnType() {
109
+	public StoredType getReturnType() {
97
 		return returnType;
110
 		return returnType;
98
 	}
111
 	}
99
 	
112
 	
100
-	public void setReturnType(ITypeID returnType) {
113
+	public void setReturnType(StoredType returnType) {
101
 		if (returnType == null)
114
 		if (returnType == null)
102
 			throw new NullPointerException();
115
 			throw new NullPointerException();
103
 		
116
 		
136
 		return false;
149
 		return false;
137
 	}
150
 	}
138
 	
151
 	
139
-	public FunctionHeader withReturnType(ITypeID returnType) {
152
+	public FunctionHeader withReturnType(StoredType returnType) {
140
 		return new FunctionHeader(typeParameters, returnType, thrownType, parameters);
153
 		return new FunctionHeader(typeParameters, returnType, thrownType, parameters);
141
 	}
154
 	}
142
 	
155
 	
143
 	public FunctionHeader inferFromOverride(GlobalTypeRegistry registry, FunctionHeader overridden) {
156
 	public FunctionHeader inferFromOverride(GlobalTypeRegistry registry, FunctionHeader overridden) {
144
 		TypeParameter[] resultTypeParameters = typeParameters;
157
 		TypeParameter[] resultTypeParameters = typeParameters;
145
-		ITypeID resultReturnType = this.returnType;
146
-		if (resultReturnType == BasicTypeID.UNDETERMINED)
158
+		StoredType resultReturnType = this.returnType;
159
+		if (resultReturnType.type == BasicTypeID.UNDETERMINED)
147
 			resultReturnType = overridden.returnType;
160
 			resultReturnType = overridden.returnType;
148
 		
161
 		
149
-		ITypeID resultThrownType = this.thrownType;
162
+		StoredType resultThrownType = this.thrownType;
150
 		if (resultThrownType == null && overridden.thrownType != null)
163
 		if (resultThrownType == null && overridden.thrownType != null)
151
 			resultThrownType = overridden.thrownType;
164
 			resultThrownType = overridden.thrownType;
152
 		
165
 		
153
 		FunctionParameter[] resultParameters = Arrays.copyOf(parameters, parameters.length);
166
 		FunctionParameter[] resultParameters = Arrays.copyOf(parameters, parameters.length);
154
 		for (int i = 0; i < resultParameters.length; i++) {
167
 		for (int i = 0; i < resultParameters.length; i++) {
155
-			if (resultParameters[i].type == BasicTypeID.UNDETERMINED) {
168
+			if (resultParameters[i].type.type == BasicTypeID.UNDETERMINED) {
156
 				FunctionParameter parameter = resultParameters[i];
169
 				FunctionParameter parameter = resultParameters[i];
157
 				FunctionParameter original = overridden.parameters[i];
170
 				FunctionParameter original = overridden.parameters[i];
158
 				resultParameters[i] = new FunctionParameter(original.type, parameter.name, parameter.defaultValue, original.variadic);
171
 				resultParameters[i] = new FunctionParameter(original.type, parameter.name, parameter.defaultValue, original.variadic);
209
 		return result.toString();
222
 		return result.toString();
210
 	}
223
 	}
211
 	
224
 	
212
-	public ITypeID[] inferTypes(LocalMemberCache cache, CallArguments arguments, List<ITypeID> resultHint) {
225
+	public TypeID[] inferTypes(LocalMemberCache cache, CallArguments arguments, List<StoredType> resultHint) {
213
 		if (arguments.arguments.length != this.parameters.length)
226
 		if (arguments.arguments.length != this.parameters.length)
214
 			return null;
227
 			return null;
215
 		
228
 		
216
-		Map<TypeParameter, ITypeID> mapping = new HashMap<>();
229
+		Map<TypeParameter, TypeID> mapping = new HashMap<>();
217
 		if (!resultHint.isEmpty()) {
230
 		if (!resultHint.isEmpty()) {
218
-			Map<TypeParameter, ITypeID> temp = new HashMap<>();
219
-			for (ITypeID hint : resultHint) {
220
-				if (returnType.inferTypeParameters(cache, hint, temp)) {
231
+			for (StoredType hint : resultHint) {
232
+				Map<TypeParameter, TypeID> temp = returnType.inferTypeParameters(cache, hint);
233
+				if (temp != null) {
221
 					mapping = temp;
234
 					mapping = temp;
222
 					break;
235
 					break;
223
 				}
236
 				}
225
 		}
238
 		}
226
 		
239
 		
227
 		// TODO: lambda header inference
240
 		// TODO: lambda header inference
228
-		for (int i = 0; i < parameters.length; i++)
229
-			if (!parameters[i].type.inferTypeParameters(cache, arguments.arguments[i].type, mapping))
241
+		for (int i = 0; i < parameters.length; i++) {
242
+			Map<TypeParameter, TypeID> forParameter = parameters[i].type.inferTypeParameters(cache, arguments.arguments[i].type);
243
+			if (forParameter == null)
230
 				return null;
244
 				return null;
245
+			
246
+			mapping.putAll(forParameter);
247
+		}
231
 		
248
 		
232
 		if (mapping.size() > typeParameters.length)
249
 		if (mapping.size() > typeParameters.length)
233
 			return null;
250
 			return null;
234
 		
251
 		
235
-		ITypeID[] result = new ITypeID[typeParameters.length];
252
+		TypeID[] result = new TypeID[typeParameters.length];
236
 		for (int i = 0; i < typeParameters.length; i++) {
253
 		for (int i = 0; i < typeParameters.length; i++) {
237
 			TypeParameter typeParameter = typeParameters[i];
254
 			TypeParameter typeParameter = typeParameters[i];
238
 			if (!mapping.containsKey(typeParameter)) {
255
 			if (!mapping.containsKey(typeParameter)) {
270
 			throw new NullPointerException();
287
 			throw new NullPointerException();
271
 		if (parameters.length != other.parameters.length)
288
 		if (parameters.length != other.parameters.length)
272
 			return false;
289
 			return false;
273
-		if (returnType != BasicTypeID.UNDETERMINED && !scope.getTypeMembers(returnType).canCastImplicit(other.returnType))
290
+		if (returnType.type != BasicTypeID.UNDETERMINED && !scope.getTypeMembers(returnType).canCastImplicit(other.returnType))
274
 			return false;
291
 			return false;
275
 		
292
 		
276
 		for (int i = 0; i < parameters.length; i++) {
293
 		for (int i = 0; i < parameters.length; i++) {
277
-			if (parameters[i].type == BasicTypeID.UNDETERMINED)
294
+			if (parameters[i].type.type == BasicTypeID.UNDETERMINED)
278
 				continue;
295
 				continue;
279
 			
296
 			
280
 			if (parameters[i].variadic != other.parameters[i].variadic)
297
 			if (parameters[i].variadic != other.parameters[i].variadic)
339
 	
356
 	
340
 	public FunctionHeader instanceForCall(GlobalTypeRegistry registry, CallArguments arguments) {
357
 	public FunctionHeader instanceForCall(GlobalTypeRegistry registry, CallArguments arguments) {
341
 		if (arguments.getNumberOfTypeArguments() > 0) {
358
 		if (arguments.getNumberOfTypeArguments() > 0) {
342
-			Map<TypeParameter, ITypeID> typeParameters = new HashMap<>();
359
+			Map<TypeParameter, TypeID> typeParameters = new HashMap<>();
343
 			for (int i = 0; i < this.typeParameters.length; i++) {
360
 			for (int i = 0; i < this.typeParameters.length; i++) {
344
 				typeParameters.put(this.typeParameters[i], arguments.typeArguments[i]);
361
 				typeParameters.put(this.typeParameters[i], arguments.typeArguments[i]);
345
 			}
362
 			}
353
 	
370
 	
354
 	public FunctionHeader withGenericArguments(GlobalTypeRegistry registry, GenericMapper mapper) {
371
 	public FunctionHeader withGenericArguments(GlobalTypeRegistry registry, GenericMapper mapper) {
355
 		if (typeParameters.length > 0) {
372
 		if (typeParameters.length > 0) {
356
-			Map<TypeParameter, ITypeID> innerMap = new HashMap<>();
373
+			Map<TypeParameter, TypeID> innerMap = new HashMap<>();
357
 			for (TypeParameter parameter : typeParameters)
374
 			for (TypeParameter parameter : typeParameters)
358
-				innerMap.put(parameter, mapper.registry.getGeneric(parameter, null));
375
+				innerMap.put(parameter, mapper.registry.getGeneric(parameter));
359
 			
376
 			
360
 			mapper = mapper.getInner(registry, innerMap);
377
 			mapper = mapper.getInner(registry, innerMap);
361
 		}
378
 		}
362
 		
379
 		
363
-		ITypeID returnType = this.returnType.instance(mapper);
380
+		StoredType returnType = this.returnType.instance(mapper);
364
 		FunctionParameter[] parameters = new FunctionParameter[this.parameters.length];
381
 		FunctionParameter[] parameters = new FunctionParameter[this.parameters.length];
365
 		for (int i = 0; i < parameters.length; i++) {
382
 		for (int i = 0; i < parameters.length; i++) {
366
 			parameters[i] = this.parameters[i].withGenericArguments(mapper);
383
 			parameters[i] = this.parameters[i].withGenericArguments(mapper);
368
 		return new FunctionHeader(typeParameters, returnType, thrownType == null ? null : thrownType.instance(mapper), parameters);
385
 		return new FunctionHeader(typeParameters, returnType, thrownType == null ? null : thrownType.instance(mapper), parameters);
369
 	}
386
 	}
370
 	
387
 	
371
-	public FunctionHeader fillGenericArguments(GlobalTypeRegistry registry, ITypeID[] arguments, GenericMapper typeParameterMapping) {
388
+	public FunctionHeader fillGenericArguments(GlobalTypeRegistry registry, TypeID[] arguments, GenericMapper typeParameterMapping) {
372
 		if (arguments == null || arguments.length == 0)
389
 		if (arguments == null || arguments.length == 0)
373
 			return this;
390
 			return this;
374
 		
391
 		
375
-		Map<TypeParameter, ITypeID> typeArguments = new HashMap<>();
392
+		Map<TypeParameter, TypeID> typeArguments = new HashMap<>();
376
 		for (int i = 0; i < typeParameters.length; i++)
393
 		for (int i = 0; i < typeParameters.length; i++)
377
 			typeArguments.put(typeParameters[i], arguments[i]);
394
 			typeArguments.put(typeParameters[i], arguments[i]);
378
 		GenericMapper mapper = typeParameterMapping.getInner(registry, typeArguments);
395
 		GenericMapper mapper = typeParameterMapping.getInner(registry, typeArguments);
379
 		
396
 		
380
-		ITypeID returnType = this.returnType.instance(mapper);
397
+		StoredType returnType = this.returnType.instance(mapper);
381
 		FunctionParameter[] parameters = new FunctionParameter[this.parameters.length];
398
 		FunctionParameter[] parameters = new FunctionParameter[this.parameters.length];
382
 		for (int i = 0; i < parameters.length; i++) {
399
 		for (int i = 0; i < parameters.length; i++) {
383
 			parameters[i] = this.parameters[i].withGenericArguments(mapper);
400
 			parameters[i] = this.parameters[i].withGenericArguments(mapper);
386
 	}
403
 	}
387
 	
404
 	
388
 	public FunctionHeader forTypeParameterInference() {
405
 	public FunctionHeader forTypeParameterInference() {
389
-		return new FunctionHeader(BasicTypeID.UNDETERMINED, parameters);
406
+		return new FunctionHeader(BasicTypeID.UNDETERMINED.stored, parameters);
390
 	}
407
 	}
391
 	
408
 	
392
 	public FunctionHeader forLambda(FunctionHeader lambdaHeader) {
409
 	public FunctionHeader forLambda(FunctionHeader lambdaHeader) {
460
 		return parameters[parameters.length - 1].variadic ? Integer.MAX_VALUE : parameters.length;
477
 		return parameters[parameters.length - 1].variadic ? Integer.MAX_VALUE : parameters.length;
461
 	}
478
 	}
462
 	
479
 	
463
-	private static boolean hasUnknowns(ITypeID[] types, ITypeID returnType) {
464
-		if (returnType == BasicTypeID.UNDETERMINED)
480
+	private static boolean hasUnknowns(StoredType[] types, StoredType returnType) {
481
+		if (returnType.type == BasicTypeID.UNDETERMINED)
465
 			return true;
482
 			return true;
466
 		
483
 		
467
-		for (ITypeID type : types)
468
-			if (type == BasicTypeID.UNDETERMINED)
484
+		for (StoredType type : types)
485
+			if (type.type == BasicTypeID.UNDETERMINED)
469
 				return true;
486
 				return true;
470
 		
487
 		
471
 		return false;
488
 		return false;
472
 	}
489
 	}
473
 	
490
 	
474
-	private static boolean hasUnknowns(FunctionParameter[] parameters, ITypeID returnType) {
475
-		if (returnType == BasicTypeID.UNDETERMINED)
491
+	private static boolean hasUnknowns(FunctionParameter[] parameters, StoredType returnType) {
492
+		if (returnType.type == BasicTypeID.UNDETERMINED)
476
 			return true;
493
 			return true;
477
 		
494
 		
478
 		for (FunctionParameter parameter : parameters)
495
 		for (FunctionParameter parameter : parameters)
479
-			if (parameter.type == BasicTypeID.UNDETERMINED)
496
+			if (parameter.type.type == BasicTypeID.UNDETERMINED)
480
 				return true;
497
 				return true;
481
 		
498
 		
482
 		return false;
499
 		return false;

+ 17
- 18
CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionParameter.java View File

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

+ 17
- 16
CodeModel/src/main/java/org/openzen/zenscript/codemodel/GenericMapper.java View File

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

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

25
 import org.openzen.zenscript.codemodel.member.ImplementationMember;
25
 import org.openzen.zenscript.codemodel.member.ImplementationMember;
26
 import org.openzen.zenscript.codemodel.member.InnerDefinitionMember;
26
 import org.openzen.zenscript.codemodel.member.InnerDefinitionMember;
27
 import org.openzen.zenscript.codemodel.scope.TypeScope;
27
 import org.openzen.zenscript.codemodel.scope.TypeScope;
28
-import org.openzen.zenscript.codemodel.type.ITypeID;
28
+import org.openzen.zenscript.codemodel.type.TypeID;
29
 
29
 
30
 /**
30
 /**
31
  *
31
  *
42
 	public DefinitionAnnotation[] annotations = DefinitionAnnotation.NONE;
42
 	public DefinitionAnnotation[] annotations = DefinitionAnnotation.NONE;
43
 	
43
 	
44
 	public HighLevelDefinition outerDefinition;
44
 	public HighLevelDefinition outerDefinition;
45
-	private ITypeID superType;
45
+	private TypeID superType;
46
 	
46
 	
47
 	private boolean isDestructible = false;
47
 	private boolean isDestructible = false;
48
 	
48
 	
72
 		return pkg.fullName + '.' + name;
72
 		return pkg.fullName + '.' + name;
73
 	}
73
 	}
74
 	
74
 	
75
-	public ITypeID getSuperType() {
75
+	public TypeID getSuperType() {
76
 		return superType;
76
 		return superType;
77
 	}
77
 	}
78
 	
78
 	
79
-	public void setSuperType(ITypeID superType) {
79
+	public void setSuperType(TypeID superType) {
80
 		this.superType = superType;
80
 		this.superType = superType;
81
 		if (outerDefinition != null)
81
 		if (outerDefinition != null)
82
 			isDestructible |= outerDefinition.isDestructible;
82
 			isDestructible |= outerDefinition.isDestructible;

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

43
 	
43
 	
44
 	public StatementAnnotation createForStatement(CodePosition position, CallArguments arguments);
44
 	public StatementAnnotation createForStatement(CodePosition position, CallArguments arguments);
45
 	
45
 	
46
-	public Annotation createForParameter(CodePosition position, CallArguments arguments);
46
+	public ParameterAnnotation createForParameter(CodePosition position, CallArguments arguments);
47
 	
47
 	
48
 	public MemberAnnotation deserializeForMember(CodeSerializationInput input, TypeContext context, IDefinitionMember member);
48
 	public MemberAnnotation deserializeForMember(CodeSerializationInput input, TypeContext context, IDefinitionMember member);
49
 	
49
 	
51
 	
51
 	
52
 	public StatementAnnotation deserializeForStatement(CodeSerializationInput input, StatementContext context);
52
 	public StatementAnnotation deserializeForStatement(CodeSerializationInput input, StatementContext context);
53
 	
53
 	
54
-	public Annotation deserializeForParameter(CodeSerializationInput input, TypeContext context);
54
+	public ParameterAnnotation deserializeForParameter(CodeSerializationInput input, TypeContext context);
55
 }
55
 }

+ 102
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidAnnotationDefinition.java View File

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.annotations;
7
+
8
+import java.util.Collections;
9
+import java.util.List;
10
+import org.openzen.zencode.shared.CodePosition;
11
+import org.openzen.zenscript.codemodel.FunctionHeader;
12
+import org.openzen.zenscript.codemodel.FunctionParameter;
13
+import org.openzen.zenscript.codemodel.HighLevelDefinition;
14
+import org.openzen.zenscript.codemodel.context.StatementContext;
15
+import org.openzen.zenscript.codemodel.context.TypeContext;
16
+import org.openzen.zenscript.codemodel.expression.CallArguments;
17
+import org.openzen.zenscript.codemodel.member.IDefinitionMember;
18
+import org.openzen.zenscript.codemodel.scope.BaseScope;
19
+import org.openzen.zenscript.codemodel.scope.ExpressionScope;
20
+import org.openzen.zenscript.codemodel.scope.StatementScope;
21
+import org.openzen.zenscript.codemodel.serialization.CodeSerializationInput;
22
+import org.openzen.zenscript.codemodel.statement.Statement;
23
+
24
+/**
25
+ *
26
+ * @author Hoofdgebruiker
27
+ */
28
+public class InvalidAnnotationDefinition implements AnnotationDefinition {
29
+	public static final InvalidAnnotationDefinition INSTANCE = new InvalidAnnotationDefinition();
30
+	
31
+	private InvalidAnnotationDefinition() {}
32
+
33
+	@Override
34
+	public String getAnnotationName() {
35
+		return "Invalid";
36
+	}
37
+
38
+	@Override
39
+	public List<FunctionHeader> getInitializers(BaseScope scope) {
40
+		return Collections.emptyList();
41
+	}
42
+
43
+	@Override
44
+	public ExpressionScope getScopeForMember(IDefinitionMember member, BaseScope scope) {
45
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
46
+	}
47
+
48
+	@Override
49
+	public ExpressionScope getScopeForType(HighLevelDefinition definition, BaseScope scope) {
50
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
51
+	}
52
+
53
+	@Override
54
+	public ExpressionScope getScopeForStatement(Statement statement, StatementScope scope) {
55
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
56
+	}
57
+
58
+	@Override
59
+	public ExpressionScope getScopeForParameter(FunctionHeader header, FunctionParameter parameter, BaseScope scope) {
60
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
61
+	}
62
+
63
+	@Override
64
+	public MemberAnnotation createForMember(CodePosition position, CallArguments arguments) {
65
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
66
+	}
67
+
68
+	@Override
69
+	public DefinitionAnnotation createForDefinition(CodePosition position, CallArguments arguments) {
70
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
71
+	}
72
+
73
+	@Override
74
+	public StatementAnnotation createForStatement(CodePosition position, CallArguments arguments) {
75
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
76
+	}
77
+
78
+	@Override
79
+	public ParameterAnnotation createForParameter(CodePosition position, CallArguments arguments) {
80
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
81
+	}
82
+
83
+	@Override
84
+	public MemberAnnotation deserializeForMember(CodeSerializationInput input, TypeContext context, IDefinitionMember member) {
85
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
86
+	}
87
+
88
+	@Override
89
+	public DefinitionAnnotation deserializeForDefinition(CodeSerializationInput input, TypeContext context) {
90
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
91
+	}
92
+
93
+	@Override
94
+	public StatementAnnotation deserializeForStatement(CodeSerializationInput input, StatementContext context) {
95
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
96
+	}
97
+
98
+	@Override
99
+	public ParameterAnnotation deserializeForParameter(CodeSerializationInput input, TypeContext context) {
100
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
101
+	}
102
+}

+ 56
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidDefinitionAnnotation.java View File

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.annotations;
7
+
8
+import org.openzen.zencode.shared.CodePosition;
9
+import org.openzen.zencode.shared.CompileException;
10
+import org.openzen.zencode.shared.CompileExceptionCode;
11
+import org.openzen.zenscript.codemodel.HighLevelDefinition;
12
+import org.openzen.zenscript.codemodel.context.TypeContext;
13
+import org.openzen.zenscript.codemodel.scope.BaseScope;
14
+import org.openzen.zenscript.codemodel.serialization.CodeSerializationOutput;
15
+
16
+/**
17
+ *
18
+ * @author Hoofdgebruiker
19
+ */
20
+public class InvalidDefinitionAnnotation implements DefinitionAnnotation {
21
+	public final CodePosition position;
22
+	public final CompileExceptionCode code;
23
+	public final String message;
24
+	
25
+	public InvalidDefinitionAnnotation(CodePosition position, CompileExceptionCode code, String message) {
26
+		this.position = position;
27
+		this.code = code;
28
+		this.message = message;
29
+	}
30
+	
31
+	public InvalidDefinitionAnnotation(CompileException ex) {
32
+		this.position = ex.position;
33
+		this.code = ex.code;
34
+		this.message = ex.getMessage();
35
+	}
36
+
37
+	@Override
38
+	public AnnotationDefinition getDefinition() {
39
+		return InvalidAnnotationDefinition.INSTANCE;
40
+	}
41
+
42
+	@Override
43
+	public void apply(HighLevelDefinition definition, BaseScope scope) {
44
+		
45
+	}
46
+
47
+	@Override
48
+	public void applyOnSubtype(HighLevelDefinition definition, BaseScope scope) {
49
+		
50
+	}
51
+
52
+	@Override
53
+	public void serialize(CodeSerializationOutput output, HighLevelDefinition definition, TypeContext context) {
54
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
55
+	}
56
+}

+ 70
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidMemberAnnotation.java View File

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.annotations;
7
+
8
+import org.openzen.zencode.shared.CodePosition;
9
+import org.openzen.zencode.shared.CompileException;
10
+import org.openzen.zencode.shared.CompileExceptionCode;
11
+import org.openzen.zenscript.codemodel.HighLevelDefinition;
12
+import org.openzen.zenscript.codemodel.context.TypeContext;
13
+import org.openzen.zenscript.codemodel.member.FunctionalMember;
14
+import org.openzen.zenscript.codemodel.member.GetterMember;
15
+import org.openzen.zenscript.codemodel.member.IDefinitionMember;
16
+import org.openzen.zenscript.codemodel.member.SetterMember;
17
+import org.openzen.zenscript.codemodel.scope.BaseScope;
18
+import org.openzen.zenscript.codemodel.serialization.CodeSerializationOutput;
19
+
20
+/**
21
+ *
22
+ * @author Hoofdgebruiker
23
+ */
24
+public class InvalidMemberAnnotation implements MemberAnnotation {
25
+	public final CodePosition position;
26
+	public final CompileExceptionCode code;
27
+	public final String message;
28
+	
29
+	public InvalidMemberAnnotation(CodePosition position, CompileExceptionCode code, String message) {
30
+		this.position = position;
31
+		this.code = code;
32
+		this.message = message;
33
+	}
34
+	
35
+	public InvalidMemberAnnotation(CompileException ex) {
36
+		this.position = ex.position;
37
+		this.code = ex.code;
38
+		this.message = ex.getMessage();
39
+	}
40
+
41
+	@Override
42
+	public AnnotationDefinition getDefinition() {
43
+		return InvalidAnnotationDefinition.INSTANCE;
44
+	}
45
+
46
+	@Override
47
+	public void apply(IDefinitionMember member, BaseScope scope) {
48
+		
49
+	}
50
+
51
+	@Override
52
+	public void applyOnOverridingMethod(FunctionalMember member, BaseScope scope) {
53
+		
54
+	}
55
+
56
+	@Override
57
+	public void applyOnOverridingGetter(GetterMember member, BaseScope scope) {
58
+		
59
+	}
60
+
61
+	@Override
62
+	public void applyOnOverridingSetter(SetterMember member, BaseScope scope) {
63
+		
64
+	}
65
+
66
+	@Override
67
+	public void serialize(CodeSerializationOutput output, IDefinitionMember member, TypeContext context) {
68
+		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
69
+	}
70
+}

+ 42
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidParameterAnnotation.java View File

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.annotations;
7
+
8
+import org.openzen.zencode.shared.CodePosition;
9
+import org.openzen.zencode.shared.CompileException;
10
+import org.openzen.zencode.shared.CompileExceptionCode;
11
+
12
+/**
13
+ *
14
+ * @author Hoofdgebruiker
15
+ */
16
+public class InvalidParameterAnnotation implements ParameterAnnotation {
17
+	public final CodePosition position;
18
+	public final CompileExceptionCode code;
19
+	public final String message;
20
+	
21
+	public InvalidParameterAnnotation(CodePosition position, CompileExceptionCode code, String message) {
22
+		this.position = position;
23
+		this.code = code;
24
+		this.message = message;
25
+	}
26
+	
27
+	public InvalidParameterAnnotation(CompileException ex) {
28
+		this.position = ex.position;
29
+		this.code = ex.code;
30
+		this.message = ex.getMessage();
31
+	}
32
+
33
+	@Override
34
+	public AnnotationDefinition getDefinition() {
35
+		return InvalidAnnotationDefinition.INSTANCE;
36
+	}
37
+
38
+	@Override
39
+	public void apply() {
40
+		
41
+	}
42
+}

+ 44
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/InvalidStatementAnnotation.java View File

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.annotations;
7
+
8
+import org.openzen.zencode.shared.CodePosition;
9
+import org.openzen.zencode.shared.CompileException;
10
+import org.openzen.zencode.shared.CompileExceptionCode;
11
+import org.openzen.zenscript.codemodel.scope.StatementScope;
12
+import org.openzen.zenscript.codemodel.statement.Statement;
13
+
14
+/**
15
+ *
16
+ * @author Hoofdgebruiker
17
+ */
18
+public class InvalidStatementAnnotation implements StatementAnnotation {
19
+	public final CodePosition position;
20
+	public final CompileExceptionCode code;
21
+	public final String message;
22
+	
23
+	public InvalidStatementAnnotation(CodePosition position, CompileExceptionCode code, String message) {
24
+		this.position = position;
25
+		this.code = code;
26
+		this.message = message;
27
+	}
28
+	
29
+	public InvalidStatementAnnotation(CompileException ex) {
30
+		this.position = ex.position;
31
+		this.code = ex.code;
32
+		this.message = ex.getMessage();
33
+	}
34
+
35
+	@Override
36
+	public AnnotationDefinition getDefinition() {
37
+		return InvalidAnnotationDefinition.INSTANCE;
38
+	}
39
+
40
+	@Override
41
+	public Statement apply(Statement statement, StatementScope scope) {
42
+		return statement;
43
+	}
44
+}

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

86
 	}
86
 	}
87
 
87
 
88
 	@Override
88
 	@Override
89
-	public Annotation createForParameter(CodePosition position, CallArguments arguments) {
89
+	public ParameterAnnotation createForParameter(CodePosition position, CallArguments arguments) {
90
 		throw new UnsupportedOperationException("Not supported");
90
 		throw new UnsupportedOperationException("Not supported");
91
 	}
91
 	}
92
 
92
 
108
 	}
108
 	}
109
 
109
 
110
 	@Override
110
 	@Override
111
-	public Annotation deserializeForParameter(CodeSerializationInput input, TypeContext context) {
111
+	public ParameterAnnotation deserializeForParameter(CodeSerializationInput input, TypeContext context) {
112
 		throw new UnsupportedOperationException("Not supported");
112
 		throw new UnsupportedOperationException("Not supported");
113
 	}
113
 	}
114
 }
114
 }

CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/Annotation.java → CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/ParameterAnnotation.java View File

9
  *
9
  *
10
  * @author Hoofdgebruiker
10
  * @author Hoofdgebruiker
11
  */
11
  */
12
-public interface Annotation {
13
-	public static final Annotation[] NONE = new Annotation[0];
12
+public interface ParameterAnnotation {
13
+	public static final ParameterAnnotation[] NONE = new ParameterAnnotation[0];
14
 	
14
 	
15
 	public AnnotationDefinition getDefinition();
15
 	public AnnotationDefinition getDefinition();
16
 	
16
 	

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

51
 	@Override
51
 	@Override
52
 	public List<FunctionHeader> getInitializers(BaseScope scope) {
52
 	public List<FunctionHeader> getInitializers(BaseScope scope) {
53
 		return Collections.singletonList(new FunctionHeader(
53
 		return Collections.singletonList(new FunctionHeader(
54
-				BasicTypeID.VOID,
55
-				scope.getType(CodePosition.BUILTIN, enforcementLevelName, StaticStorageTag.INSTANCE),
56
-				BasicTypeID.BOOL,
54
+				BasicTypeID.VOID.stored,
55
+				scope.getType(CodePosition.BUILTIN, enforcementLevelName).stored(StaticStorageTag.INSTANCE),
56
+				BasicTypeID.BOOL.stored,
57
 				StringTypeID.UNIQUE));
57
 				StringTypeID.UNIQUE));
58
 	}
58
 	}
59
 
59
 
106
 	}
106
 	}
107
 
107
 
108
 	@Override
108
 	@Override
109
-	public Annotation createForParameter(CodePosition position, CallArguments arguments) {
109
+	public ParameterAnnotation createForParameter(CodePosition position, CallArguments arguments) {
110
 		throw new UnsupportedOperationException("Not supported");
110
 		throw new UnsupportedOperationException("Not supported");
111
 	}
111
 	}
112
 
112
 
131
 	}
131
 	}
132
 
132
 
133
 	@Override
133
 	@Override
134
-	public Annotation deserializeForParameter(CodeSerializationInput input, TypeContext context) {
134
+	public ParameterAnnotation deserializeForParameter(CodeSerializationInput input, TypeContext context) {
135
 		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
135
 		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
136
 	}
136
 	}
137
 }
137
 }

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

83
 		if (body == null)
83
 		if (body == null)
84
 			return body;
84
 			return body;
85
 		
85
 		
86
-		ExpressionScope expressionScope = new ExpressionScope(scope, BasicTypeID.BOOL);
86
+		ExpressionScope expressionScope = new ExpressionScope(scope, BasicTypeID.BOOL.stored);
87
 		List<Statement> statements = new ArrayList<>();
87
 		List<Statement> statements = new ArrayList<>();
88
 		ExpressionBuilder expressionBuilder = new ExpressionBuilder(position, expressionScope);
88
 		ExpressionBuilder expressionBuilder = new ExpressionBuilder(position, expressionScope);
89
 		Expression inverseCondition = expressionBuilder.not(condition);
89
 		Expression inverseCondition = expressionBuilder.not(condition);
90
-		Statement throwStatement = new ExpressionStatement(position, new PanicExpression(position, BasicTypeID.VOID, message));
90
+		Statement throwStatement = new ExpressionStatement(position, new PanicExpression(position, BasicTypeID.VOID.stored, message));
91
 		statements.add(new IfStatement(position, inverseCondition, throwStatement, null));
91
 		statements.add(new IfStatement(position, inverseCondition, throwStatement, null));
92
 		
92
 		
93
 		if (body instanceof BlockStatement) {
93
 		if (body instanceof BlockStatement) {

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

13
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
13
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
14
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
14
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
15
 import org.openzen.zenscript.codemodel.type.GenericName;
15
 import org.openzen.zenscript.codemodel.type.GenericName;
16
-import org.openzen.zenscript.codemodel.type.ITypeID;
16
+import org.openzen.zenscript.codemodel.type.TypeID;
17
 
17
 
18
 /**
18
 /**
19
  *
19
  *
71
 		return getImportType(context, type.getInner(name.get(index)), name, index + 1);
71
 		return getImportType(context, type.getInner(name.get(index)), name, index + 1);
72
 	}
72
 	}
73
 	
73
 	
74
-	public ITypeID getType(TypeResolutionContext context, List<GenericName> name) {
74
+	public TypeID getType(TypeResolutionContext context, List<GenericName> name) {
75
 		return getType(context, name, 0);
75
 		return getType(context, name, 0);
76
 	}
76
 	}
77
 	
77
 	
78
-	private ITypeID getType(TypeResolutionContext context, List<GenericName> name, int index) {
78
+	private TypeID getType(TypeResolutionContext context, List<GenericName> name, int index) {
79
 		if (index == name.size())
79
 		if (index == name.size())
80
 			return null;
80
 			return null;
81
 		
81
 		
84
 		
84
 		
85
 		if (types.containsKey(name.get(index).name)) {
85
 		if (types.containsKey(name.get(index).name)) {
86
 			CompilingType type = types.get(name.get(index).name);
86
 			CompilingType type = types.get(name.get(index).name);
87
-			DefinitionTypeID result = context.getTypeRegistry().getForDefinition(type.load(), null, name.get(index).arguments);
87
+			DefinitionTypeID result = context.getTypeRegistry().getForDefinition(type.load(), name.get(index).arguments);
88
 			return getInner(context, name, index + 1, type, result);
88
 			return getInner(context, name, index + 1, type, result);
89
 		}
89
 		}
90
 		
90
 		
91
 		return null;
91
 		return null;
92
 	}
92
 	}
93
 	
93
 	
94
-	private ITypeID getInner(TypeResolutionContext context, List<GenericName> name, int index, CompilingType type, DefinitionTypeID result) {
94
+	private TypeID getInner(TypeResolutionContext context, List<GenericName> name, int index, CompilingType type, DefinitionTypeID result) {
95
 		if (index == name.size())
95
 		if (index == name.size())
96
 			return result;
96
 			return result;
97
 		
97
 		
99
 		if (innerType == null)
99
 		if (innerType == null)
100
 			return null;
100
 			return null;
101
 		
101
 		
102
-		DefinitionTypeID innerResult = context.getTypeRegistry().getForDefinition(innerType.load(), name.get(index).arguments, result, null);
102
+		DefinitionTypeID innerResult = context.getTypeRegistry().getForDefinition(innerType.load(), name.get(index).arguments, result);
103
 		return getInner(context, name, index + 1, innerType, innerResult);
103
 		return getInner(context, name, index + 1, innerType, innerResult);
104
 	}
104
 	}
105
 }
105
 }

+ 1
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/CompilingType.java View File

21
 	HighLevelDefinition load();
21
 	HighLevelDefinition load();
22
 	
22
 	
23
 	default DefinitionTypeID getInnerType(GlobalTypeRegistry registry, List<GenericName> name, int index, DefinitionTypeID outer) {
23
 	default DefinitionTypeID getInnerType(GlobalTypeRegistry registry, List<GenericName> name, int index, DefinitionTypeID outer) {
24
-		DefinitionTypeID type = registry.getForDefinition(load(), name.get(index).arguments, outer, null);
24
+		DefinitionTypeID type = registry.getForDefinition(load(), name.get(index).arguments, outer);
25
 		index++;
25
 		index++;
26
 		if (index == name.size())
26
 		if (index == name.size())
27
 			return type;
27
 			return type;

+ 8
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/FileResolutionContext.java View File

13
 import org.openzen.zenscript.codemodel.annotations.AnnotationDefinition;
13
 import org.openzen.zenscript.codemodel.annotations.AnnotationDefinition;
14
 import org.openzen.zenscript.codemodel.type.GenericName;
14
 import org.openzen.zenscript.codemodel.type.GenericName;
15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
16
-import org.openzen.zenscript.codemodel.type.ITypeID;
16
+import org.openzen.zenscript.codemodel.type.StoredType;
17
+import org.openzen.zenscript.codemodel.type.TypeID;
17
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
18
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
18
 
19
 
19
 /**
20
 /**
45
 	}
46
 	}
46
 
47
 
47
 	@Override
48
 	@Override
48
-	public ITypeID getType(CodePosition position, List<GenericName> name, StorageTag storage) {
49
+	public TypeID getType(CodePosition position, List<GenericName> name) {
49
 		if (imports.containsKey(name.get(0).name)) {
50
 		if (imports.containsKey(name.get(0).name)) {
50
 			return GenericName.getInnerType(
51
 			return GenericName.getInnerType(
51
 					getTypeRegistry(),
52
 					getTypeRegistry(),
52
-					getTypeRegistry().getForDefinition(imports.get(name.get(0).name), null, name.get(0).arguments),
53
+					getTypeRegistry().getForDefinition(imports.get(name.get(0).name), name.get(0).arguments),
53
 					name,
54
 					name,
54
-					1,
55
-					storage);
55
+					1);
56
 		}
56
 		}
57
 		
57
 		
58
-		ITypeID moduleType = modulePackage.getType(this, name);
58
+		TypeID moduleType = modulePackage.getType(this, name);
59
 		if (moduleType != null)
59
 		if (moduleType != null)
60
 			return moduleType;
60
 			return moduleType;
61
 		
61
 		
62
-		return module.getType(position, name, storage);
62
+		return module.getType(position, name);
63
 	}
63
 	}
64
 	
64
 	
65
 	@Override
65
 	@Override
68
 	}
68
 	}
69
 
69
 
70
 	@Override
70
 	@Override
71
-	public ITypeID getThisType() {
71
+	public StoredType getThisType() {
72
 		return null;
72
 		return null;
73
 	}
73
 	}
74
 }
74
 }

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

12
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
12
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
13
 import org.openzen.zenscript.codemodel.type.GenericName;
13
 import org.openzen.zenscript.codemodel.type.GenericName;
14
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
14
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
-import org.openzen.zenscript.codemodel.type.ITypeID;
15
+import org.openzen.zenscript.codemodel.type.StoredType;
16
+import org.openzen.zenscript.codemodel.type.TypeID;
17
+import org.openzen.zenscript.codemodel.type.storage.BorrowStorageTag;
16
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
18
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
17
 
19
 
18
 /**
20
 /**
41
 	}
43
 	}
42
 
44
 
43
 	@Override
45
 	@Override
44
-	public ITypeID getType(CodePosition position, List<GenericName> name, StorageTag storage) {
46
+	public TypeID getType(CodePosition position, List<GenericName> name) {
45
 		if (type != null) {
47
 		if (type != null) {
46
 			CompilingType compiling = type.getInner(name.get(0).name);
48
 			CompilingType compiling = type.getInner(name.get(0).name);
47
 			if (compiling != null) {
49
 			if (compiling != null) {
53
 		if (name.size() == 1 && name.get(0).hasNoArguments()) {
55
 		if (name.size() == 1 && name.get(0).hasNoArguments()) {
54
 			for (TypeParameter parameter : parameters)
56
 			for (TypeParameter parameter : parameters)
55
 				if (parameter.name.equals(name.get(0).name))
57
 				if (parameter.name.equals(name.get(0).name))
56
-					return getTypeRegistry().getGeneric(parameter, storage);
58
+					return getTypeRegistry().getGeneric(parameter);
57
 		}
59
 		}
58
 		
60
 		
59
-		return outer.getType(position, name, storage);
61
+		return outer.getType(position, name);
60
 	}
62
 	}
61
 
63
 
62
 	@Override
64
 	@Override
65
 	}
67
 	}
66
 	
68
 	
67
 	@Override
69
 	@Override
68
-	public ITypeID getThisType() {
69
-		return type == null ? null : getTypeRegistry().getForMyDefinition(type.load());
70
+	public StoredType getThisType() {
71
+		return type == null ? null : getTypeRegistry().getForMyDefinition(type.load()).stored(BorrowStorageTag.THIS);
70
 	}
72
 	}
71
 }
73
 }

+ 9
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/context/ModuleTypeResolutionContext.java View File

9
 import java.util.List;
9
 import java.util.List;
10
 import java.util.Map;
10
 import java.util.Map;
11
 import org.openzen.zencode.shared.CodePosition;
11
 import org.openzen.zencode.shared.CodePosition;
12
-import org.openzen.zencode.shared.CompileException;
13
 import org.openzen.zencode.shared.CompileExceptionCode;
12
 import org.openzen.zencode.shared.CompileExceptionCode;
14
 import org.openzen.zenscript.codemodel.annotations.AnnotationDefinition;
13
 import org.openzen.zenscript.codemodel.annotations.AnnotationDefinition;
15
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
14
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
16
 import org.openzen.zenscript.codemodel.type.GenericName;
15
 import org.openzen.zenscript.codemodel.type.GenericName;
17
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
16
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
18
 import org.openzen.zenscript.codemodel.type.ISymbol;
17
 import org.openzen.zenscript.codemodel.type.ISymbol;
19
-import org.openzen.zenscript.codemodel.type.ITypeID;
18
+import org.openzen.zenscript.codemodel.type.StoredType;
19
+import org.openzen.zenscript.codemodel.type.TypeID;
20
+import org.openzen.zenscript.codemodel.type.storage.InvalidStorageTag;
20
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
21
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
21
 import org.openzen.zenscript.codemodel.type.storage.StorageType;
22
 import org.openzen.zenscript.codemodel.type.storage.StorageType;
22
 
23
 
63
 	}
64
 	}
64
 
65
 
65
 	@Override
66
 	@Override
66
-	public ITypeID getType(CodePosition position, List<GenericName> name, StorageTag storage) {
67
+	public TypeID getType(CodePosition position, List<GenericName> name) {
67
 		if (rootCompiling != null) {
68
 		if (rootCompiling != null) {
68
-			ITypeID compiling = rootCompiling.getType(this, name);
69
+			TypeID compiling = rootCompiling.getType(this, name);
69
 			if (compiling != null)
70
 			if (compiling != null)
70
 				return compiling;
71
 				return compiling;
71
 		}
72
 		}
72
 		
73
 		
73
 		if (name.size() == 1 && globals.containsKey(name.get(0).name))
74
 		if (name.size() == 1 && globals.containsKey(name.get(0).name))
74
-			return globals.get(name.get(0).name).getType(position, this, name.get(0).arguments, storage);
75
+			return globals.get(name.get(0).name).getType(position, this, name.get(0).arguments);
75
 		
76
 		
76
-		return rootPackage.getType(position, this, name, storage);
77
+		return rootPackage.getType(position, this, name);
77
 	}
78
 	}
78
 	
79
 	
79
 	@Override
80
 	@Override
80
 	public StorageTag getStorageTag(CodePosition position, String name, String[] arguments) {
81
 	public StorageTag getStorageTag(CodePosition position, String name, String[] arguments) {
81
 		if (!storageTypes.containsKey(name))
82
 		if (!storageTypes.containsKey(name))
82
-			throw new CompileException(position, CompileExceptionCode.NO_SUCH_STORAGE_TYPE, "No such storage type: " + name);
83
+			return new InvalidStorageTag(position, CompileExceptionCode.NO_SUCH_STORAGE_TYPE, "No such storage type: " + name);
83
 		
84
 		
84
 		return storageTypes.get(name).instance(position, arguments);
85
 		return storageTypes.get(name).instance(position, arguments);
85
 	}
86
 	}
86
 	
87
 	
87
 	@Override
88
 	@Override
88
-	public ITypeID getThisType() {
89
+	public StoredType getThisType() {
89
 		return null;
90
 		return null;
90
 	}
91
 	}
91
 }
92
 }

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

15
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
15
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
16
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
16
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
17
 import org.openzen.zenscript.codemodel.statement.VarStatement;
17
 import org.openzen.zenscript.codemodel.statement.VarStatement;
18
-import org.openzen.zenscript.codemodel.type.ITypeID;
18
+import org.openzen.zenscript.codemodel.type.StoredType;
19
 
19
 
20
 /**
20
 /**
21
  *
21
  *
30
 	
30
 	
31
 	public VariantOptionSwitchValue variantOptionSwitchValue;
31
 	public VariantOptionSwitchValue variantOptionSwitchValue;
32
 	
32
 	
33
-	public StatementContext(ModuleContext module, ITypeID thisType) {
33
+	public StatementContext(ModuleContext module, StoredType thisType) {
34
 		super(module, TypeParameter.NONE, thisType);
34
 		super(module, TypeParameter.NONE, thisType);
35
 		
35
 		
36
 		loops = LoopStatement.NONE;
36
 		loops = LoopStatement.NONE;
39
 		lambdaOuter = null;
39
 		lambdaOuter = null;
40
 	}
40
 	}
41
 	
41
 	
42
-	public StatementContext(ModuleContext module, ITypeID thisType, FunctionHeader header) {
42
+	public StatementContext(ModuleContext module, StoredType thisType, FunctionHeader header) {
43
 		super(module, header.typeParameters, thisType);
43
 		super(module, header.typeParameters, thisType);
44
 		
44
 		
45
 		loops = LoopStatement.NONE;
45
 		loops = LoopStatement.NONE;

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

11
 import java.util.Map;
11
 import java.util.Map;
12
 import org.openzen.zenscript.codemodel.GenericMapper;
12
 import org.openzen.zenscript.codemodel.GenericMapper;
13
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
13
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
14
-import org.openzen.zenscript.codemodel.type.ITypeID;
14
+import org.openzen.zenscript.codemodel.type.StoredType;
15
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
15
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
17
+import org.openzen.zenscript.codemodel.type.TypeID;
17
 
18
 
18
 /**
19
 /**
19
  *
20
  *
21
  */
22
  */
22
 public class TypeContext {
23
 public class TypeContext {
23
 	protected final TypeParameter[] typeParameters;
24
 	protected final TypeParameter[] typeParameters;
24
-	public final ITypeID thisType;
25
+	public final StoredType thisType;
25
 	private final LocalMemberCache memberCache;
26
 	private final LocalMemberCache memberCache;
26
 	public final ModuleContext moduleContext;
27
 	public final ModuleContext moduleContext;
27
 	
28
 	
28
-	public TypeContext(ModuleContext context, TypeParameter[] parameters, ITypeID thisType) {
29
+	public TypeContext(ModuleContext context, TypeParameter[] parameters, StoredType thisType) {
29
 		this.typeParameters = parameters;
30
 		this.typeParameters = parameters;
30
 		this.thisType = thisType;
31
 		this.thisType = thisType;
31
 		memberCache = new LocalMemberCache(context.registry, context.expansions);
32
 		memberCache = new LocalMemberCache(context.registry, context.expansions);
32
 		moduleContext = context;
33
 		moduleContext = context;
33
 	}
34
 	}
34
 	
35
 	
35
-	public TypeContext(TypeContext outer, ITypeID thisType, TypeParameter... inner) {
36
+	public TypeContext(TypeContext outer, StoredType thisType, TypeParameter... inner) {
36
 		typeParameters = concat(outer.typeParameters, inner);
37
 		typeParameters = concat(outer.typeParameters, inner);
37
 		this.thisType = thisType;
38
 		this.thisType = thisType;
38
 		moduleContext = outer.moduleContext;
39
 		moduleContext = outer.moduleContext;
39
 		memberCache = new LocalMemberCache(moduleContext.registry, moduleContext.expansions);
40
 		memberCache = new LocalMemberCache(moduleContext.registry, moduleContext.expansions);
40
 	}
41
 	}
41
 	
42
 	
42
-	public TypeContext(TypeContext outer, ITypeID thisType, List<TypeParameter> inner) {
43
+	public TypeContext(TypeContext outer, StoredType thisType, List<TypeParameter> inner) {
43
 		this(outer, thisType, inner.toArray(new TypeParameter[inner.size()]));
44
 		this(outer, thisType, inner.toArray(new TypeParameter[inner.size()]));
44
 	}
45
 	}
45
 	
46
 	
55
 		return typeParameters[index];
56
 		return typeParameters[index];
56
 	}
57
 	}
57
 	
58
 	
58
-	public TypeMembers getTypeMembers(ITypeID type) {
59
+	public TypeMembers getTypeMembers(StoredType type) {
59
 		return memberCache.get(type);
60
 		return memberCache.get(type);
60
 	}
61
 	}
61
 	
62
 	
62
 	public GenericMapper getMapper() {
63
 	public GenericMapper getMapper() {
63
-		Map<TypeParameter, ITypeID> mapper = new HashMap<>();
64
+		Map<TypeParameter, TypeID> mapper = new HashMap<>();
64
 		for (TypeParameter parameter : typeParameters)
65
 		for (TypeParameter parameter : typeParameters)
65
-			mapper.put(parameter, moduleContext.registry.getGeneric(parameter, null));
66
+			mapper.put(parameter, moduleContext.registry.getGeneric(parameter));
66
 		return new GenericMapper(moduleContext.registry, mapper);
67
 		return new GenericMapper(moduleContext.registry, mapper);
67
 	}
68
 	}
68
 	
69
 	

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

10
 import org.openzen.zenscript.codemodel.annotations.AnnotationDefinition;
10
 import org.openzen.zenscript.codemodel.annotations.AnnotationDefinition;
11
 import org.openzen.zenscript.codemodel.type.GenericName;
11
 import org.openzen.zenscript.codemodel.type.GenericName;
12
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
12
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
13
-import org.openzen.zenscript.codemodel.type.ITypeID;
13
+import org.openzen.zenscript.codemodel.type.StoredType;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
14
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
15
 import org.openzen.zenscript.codemodel.type.storage.StorageTag;
15
 
16
 
16
 /**
17
 /**
22
 	
23
 	
23
 	AnnotationDefinition getAnnotation(String name);
24
 	AnnotationDefinition getAnnotation(String name);
24
 	
25
 	
25
-	ITypeID getType(CodePosition position, List<GenericName> name, StorageTag storage);
26
+	TypeID getType(CodePosition position, List<GenericName> name);
26
 	
27
 	
27
 	StorageTag getStorageTag(CodePosition position, String name, String[] parameters);
28
 	StorageTag getStorageTag(CodePosition position, String name, String[] parameters);
28
 	
29
 	
29
-	ITypeID getThisType();
30
+	StoredType getThisType();
30
 }
31
 }

+ 3
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/AliasDefinition.java View File

9
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
9
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
10
 import org.openzen.zenscript.codemodel.Module;
10
 import org.openzen.zenscript.codemodel.Module;
11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
12
-import org.openzen.zenscript.codemodel.type.ITypeID;
12
+import org.openzen.zenscript.codemodel.type.TypeID;
13
 
13
 
14
 /**
14
 /**
15
  *
15
  *
16
  * @author Hoofdgebruiker
16
  * @author Hoofdgebruiker
17
  */
17
  */
18
 public class AliasDefinition extends HighLevelDefinition {
18
 public class AliasDefinition extends HighLevelDefinition {
19
-	public ITypeID type;
19
+	public TypeID type;
20
 	
20
 	
21
 	public AliasDefinition(CodePosition position, Module module, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
21
 	public AliasDefinition(CodePosition position, Module module, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
22
 		super(position, module, pkg, name, modifiers, outerDefinition);
22
 		super(position, module, pkg, name, modifiers, outerDefinition);
23
 	}
23
 	}
24
 	
24
 	
25
-	public void setType(ITypeID type) {
25
+	public void setType(TypeID type) {
26
 		if (type == null)
26
 		if (type == null)
27
 			throw new NullPointerException("type cannot be null!");
27
 			throw new NullPointerException("type cannot be null!");
28
 		
28
 		

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

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

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

15
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
16
 import org.openzen.zenscript.codemodel.statement.Statement;
16
 import org.openzen.zenscript.codemodel.statement.Statement;
17
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
17
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
18
-import org.openzen.zenscript.codemodel.type.member.DefinitionMemberGroup;
18
+import org.openzen.zenscript.codemodel.type.member.TypeMemberGroup;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
20
+import org.openzen.zenscript.codemodel.type.storage.StaticStorageTag;
20
 
21
 
21
 /**
22
 /**
22
  *
23
  *
26
 	public FunctionHeader header;
27
 	public FunctionHeader header;
27
 	public Statement statement;
28
 	public Statement statement;
28
 	public CallerMember caller;
29
 	public CallerMember caller;
29
-	public final DefinitionMemberGroup callerGroup;
30
+	public final TypeMemberGroup callerGroup;
30
 	
31
 	
31
 	public FunctionDefinition(CodePosition position, Module module, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
32
 	public FunctionDefinition(CodePosition position, Module module, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
32
 		super(position, module, pkg, name, modifiers, outerDefinition);
33
 		super(position, module, pkg, name, modifiers, outerDefinition);
33
-		callerGroup = new DefinitionMemberGroup(true, name);
34
+		callerGroup = new TypeMemberGroup(true, name);
34
 	}
35
 	}
35
 	
36
 	
36
 	public FunctionDefinition(CodePosition position, Module module, ZSPackage pkg, String name, int modifiers, FunctionHeader header, GlobalTypeRegistry registry) {
37
 	public FunctionDefinition(CodePosition position, Module module, ZSPackage pkg, String name, int modifiers, FunctionHeader header, GlobalTypeRegistry registry) {
41
 	public void setHeader(GlobalTypeRegistry registry, FunctionHeader header) {
42
 	public void setHeader(GlobalTypeRegistry registry, FunctionHeader header) {
42
 		this.header = header;
43
 		this.header = header;
43
 		addMember(caller = new CallerMember(position, this, modifiers | Modifiers.STATIC, header, null));
44
 		addMember(caller = new CallerMember(position, this, modifiers | Modifiers.STATIC, header, null));
44
-		callerGroup.addMethod(new FunctionalMemberRef(caller, registry.getFunction(header, null), GenericMapper.EMPTY), TypeMemberPriority.SPECIFIED);
45
+		callerGroup.addMethod(new FunctionalMemberRef(caller, registry.getFunction(header).stored(StaticStorageTag.INSTANCE), GenericMapper.EMPTY), TypeMemberPriority.SPECIFIED);
45
 	}
46
 	}
46
 	
47
 	
47
 	public void setCode(Statement statement) {
48
 	public void setCode(Statement statement) {

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

10
 import org.openzen.zencode.shared.CodePosition;
10
 import org.openzen.zencode.shared.CodePosition;
11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12
 import org.openzen.zenscript.codemodel.Module;
12
 import org.openzen.zenscript.codemodel.Module;
13
-import org.openzen.zenscript.codemodel.type.ITypeID;
13
+import org.openzen.zenscript.codemodel.type.TypeID;
14
 
14
 
15
 /**
15
 /**
16
  *
16
  *
17
  * @author Hoofdgebruiker
17
  * @author Hoofdgebruiker
18
  */
18
  */
19
 public class InterfaceDefinition extends HighLevelDefinition {
19
 public class InterfaceDefinition extends HighLevelDefinition {
20
-	public final List<ITypeID> baseInterfaces = new ArrayList<>();
20
+	public final List<TypeID> baseInterfaces = new ArrayList<>();
21
 	
21
 	
22
 	public InterfaceDefinition(CodePosition position, Module module, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
22
 	public InterfaceDefinition(CodePosition position, Module module, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
23
 		super(position, module, pkg, name, modifiers, outerDefinition);
23
 		super(position, module, pkg, name, modifiers, outerDefinition);
24
 	}
24
 	}
25
 	
25
 	
26
-	public void addBaseInterface(ITypeID baseInterface) {
26
+	public void addBaseInterface(TypeID baseInterface) {
27
 		baseInterfaces.add(baseInterface);
27
 		baseInterfaces.add(baseInterface);
28
 	}
28
 	}
29
 	
29
 	
30
 	@Override
30
 	@Override
31
 	public boolean isDestructible() {
31
 	public boolean isDestructible() {
32
-		for (ITypeID baseInterface : baseInterfaces)
32
+		for (TypeID baseInterface : baseInterfaces)
33
 			if (baseInterface.isDestructible())
33
 			if (baseInterface.isDestructible())
34
 				return true;
34
 				return true;
35
 		
35
 		

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

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

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

9
 import java.util.List;
9
 import java.util.List;
10
 import java.util.Map;
10
 import java.util.Map;
11
 import org.openzen.zencode.shared.CodePosition;
11
 import org.openzen.zencode.shared.CodePosition;
12
-import org.openzen.zencode.shared.CompileException;
13
 import org.openzen.zencode.shared.CompileExceptionCode;
12
 import org.openzen.zencode.shared.CompileExceptionCode;
14
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
13
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
15
 import org.openzen.zenscript.codemodel.context.TypeResolutionContext;
14
 import org.openzen.zenscript.codemodel.context.TypeResolutionContext;
15
+import org.openzen.zenscript.codemodel.expression.InvalidExpression;
16
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
16
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
17
 import org.openzen.zenscript.codemodel.partial.PartialPackageExpression;
17
 import org.openzen.zenscript.codemodel.partial.PartialPackageExpression;
18
 import org.openzen.zenscript.codemodel.partial.PartialTypeExpression;
18
 import org.openzen.zenscript.codemodel.partial.PartialTypeExpression;
19
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
19
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
20
 import org.openzen.zenscript.codemodel.type.GenericName;
20
 import org.openzen.zenscript.codemodel.type.GenericName;
21
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
21
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
22
-import org.openzen.zenscript.codemodel.type.ITypeID;
23
-import org.openzen.zenscript.codemodel.type.storage.StorageTag;
22
+import org.openzen.zenscript.codemodel.type.TypeID;
24
 
23
 
25
 /**
24
 /**
26
  *
25
  *
57
 		
56
 		
58
 		if (types.containsKey(name.name)) {
57
 		if (types.containsKey(name.name)) {
59
 			if (types.get(name.name).typeParameters.length != name.getNumberOfArguments())
58
 			if (types.get(name.name).typeParameters.length != name.getNumberOfArguments())
60
-				throw new CompileException(position, CompileExceptionCode.TYPE_ARGUMENTS_INVALID_NUMBER, "Invalid number of type arguments");
59
+				return new InvalidExpression(position, CompileExceptionCode.TYPE_ARGUMENTS_INVALID_NUMBER, "Invalid number of type arguments");
61
 			
60
 			
62
-			return new PartialTypeExpression(position, registry.getForDefinition(types.get(name.name), null, name.arguments), name.arguments);
61
+			return new PartialTypeExpression(position, registry.getForDefinition(types.get(name.name), name.arguments), name.arguments);
63
 		}
62
 		}
64
 		
63
 		
65
 		return null;
64
 		return null;
86
 		return null;
85
 		return null;
87
 	}
86
 	}
88
 	
87
 	
89
-	public ITypeID getType(CodePosition position, TypeResolutionContext context, List<GenericName> nameParts, StorageTag storage) {
90
-		return getType(position, context, nameParts, 0, storage);
88
+	public TypeID getType(CodePosition position, TypeResolutionContext context, List<GenericName> nameParts) {
89
+		return getType(position, context, nameParts, 0);
91
 	}
90
 	}
92
 	
91
 	
93
-	public ITypeID getType(CodePosition position, TypeResolutionContext context, GenericName name, StorageTag storage) {
92
+	public TypeID getType(CodePosition position, TypeResolutionContext context, GenericName name) {
94
 		if (types.containsKey(name.name)) {
93
 		if (types.containsKey(name.name)) {
95
-			return context.getTypeRegistry().getForDefinition(types.get(name.name), storage, name.arguments);
94
+			return context.getTypeRegistry().getForDefinition(types.get(name.name), name.arguments);
96
 		}
95
 		}
97
 		
96
 		
98
 		return null;
97
 		return null;
99
 	}
98
 	}
100
 	
99
 	
101
-	private ITypeID getType(CodePosition position, TypeResolutionContext context, List<GenericName> nameParts, int depth, StorageTag storage) {
100
+	private TypeID getType(CodePosition position, TypeResolutionContext context, List<GenericName> nameParts, int depth) {
102
 		if (depth >= nameParts.size())
101
 		if (depth >= nameParts.size())
103
 			return null;
102
 			return null;
104
 		
103
 		
105
 		GenericName name = nameParts.get(depth);
104
 		GenericName name = nameParts.get(depth);
106
 		if (subPackages.containsKey(name.name) && name.hasNoArguments())
105
 		if (subPackages.containsKey(name.name) && name.hasNoArguments())
107
-			return subPackages.get(name.name).getType(position, context, nameParts, depth + 1, storage);
106
+			return subPackages.get(name.name).getType(position, context, nameParts, depth + 1);
108
 		
107
 		
109
 		if (types.containsKey(name.name)) {
108
 		if (types.containsKey(name.name)) {
110
-			DefinitionTypeID type = context.getTypeRegistry().getForDefinition(types.get(name.name), null, name.arguments);
111
-			return GenericName.getInnerType(context.getTypeRegistry(), type, nameParts, depth + 1, storage);
109
+			DefinitionTypeID type = context.getTypeRegistry().getForDefinition(types.get(name.name), name.arguments);
110
+			return GenericName.getInnerType(context.getTypeRegistry(), type, nameParts, depth + 1);
112
 		}
111
 		}
113
 		
112
 		
114
 		return null;
113
 		return null;

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

18
 	public final Expression right;
18
 	public final Expression right;
19
 	
19
 	
20
 	public AndAndExpression(CodePosition position, Expression left, Expression right) {
20
 	public AndAndExpression(CodePosition position, Expression left, Expression right) {
21
-		super(position, BasicTypeID.BOOL, binaryThrow(position, left.thrownType, right.thrownType));
21
+		super(position, BasicTypeID.BOOL.stored, binaryThrow(position, left.thrownType, right.thrownType));
22
 		
22
 		
23
 		this.left = left;
23
 		this.left = left;
24
 		this.right = right;
24
 		this.right = right;

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

8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
10
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
11
+import org.openzen.zenscript.codemodel.type.StoredType;
11
 
12
 
12
 /**
13
 /**
13
  *
14
  *
17
 	public final Expression[] expressions;
18
 	public final Expression[] expressions;
18
 	public final ArrayTypeID arrayType;
19
 	public final ArrayTypeID arrayType;
19
 	
20
 	
20
-	public ArrayExpression(CodePosition position, Expression[] expressions, ArrayTypeID type) {
21
+	public ArrayExpression(CodePosition position, Expression[] expressions, StoredType type) {
21
 		super(position, type, multiThrow(position, expressions));
22
 		super(position, type, multiThrow(position, expressions));
22
 		
23
 		
23
 		this.expressions = expressions;
24
 		this.expressions = expressions;
24
-		this.arrayType = type;
25
+		this.arrayType = (ArrayTypeID)type.type;
25
 	}
26
 	}
26
 
27
 
27
 	@Override
28
 	@Override
37
 	@Override
38
 	@Override
38
 	public Expression transform(ExpressionTransformer transformer) {
39
 	public Expression transform(ExpressionTransformer transformer) {
39
 		Expression[] tExpressions = Expression.transform(expressions, transformer);
40
 		Expression[] tExpressions = Expression.transform(expressions, transformer);
40
-		return tExpressions == expressions ? this : new ArrayExpression(position, tExpressions, (ArrayTypeID)type);
41
+		return tExpressions == expressions ? this : new ArrayExpression(position, tExpressions, type);
41
 	}
42
 	}
42
 
43
 
43
 	@Override
44
 	@Override
45
 		Expression[] normalized = new Expression[expressions.length];
46
 		Expression[] normalized = new Expression[expressions.length];
46
 		for (int i = 0; i < normalized.length; i++)
47
 		for (int i = 0; i < normalized.length; i++)
47
 			normalized[i] = expressions[i].normalize(scope);
48
 			normalized[i] = expressions[i].normalize(scope);
48
-		return new ArrayExpression(position, normalized, arrayType.getNormalized());
49
+		return new ArrayExpression(position, normalized, type.getNormalized());
49
 	}
50
 	}
50
 }
51
 }

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

7
 
7
 
8
 import java.util.Arrays;
8
 import java.util.Arrays;
9
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zencode.shared.CodePosition;
10
-import org.openzen.zencode.shared.CompileException;
11
 import org.openzen.zencode.shared.CompileExceptionCode;
10
 import org.openzen.zencode.shared.CompileExceptionCode;
12
 import org.openzen.zenscript.codemodel.FunctionHeader;
11
 import org.openzen.zenscript.codemodel.FunctionHeader;
13
 import org.openzen.zenscript.codemodel.scope.TypeScope;
12
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
-import org.openzen.zenscript.codemodel.type.ITypeID;
13
+import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15
 
15
 
16
 /**
16
 /**
17
  *
17
  *
20
 public class CallArguments {
20
 public class CallArguments {
21
 	public static final CallArguments EMPTY = new CallArguments(new Expression[0]);
21
 	public static final CallArguments EMPTY = new CallArguments(new Expression[0]);
22
 	
22
 	
23
-	public final ITypeID[] typeArguments;
23
+	public final TypeID[] typeArguments;
24
 	public final Expression[] arguments;
24
 	public final Expression[] arguments;
25
 	
25
 	
26
 	public CallArguments(Expression... arguments) {
26
 	public CallArguments(Expression... arguments) {
27
-		this.typeArguments = ITypeID.NONE;
27
+		this.typeArguments = TypeID.NONE;
28
 		this.arguments = arguments;
28
 		this.arguments = arguments;
29
 	}
29
 	}
30
 	
30
 	
31
-	public CallArguments(ITypeID[] typeArguments, Expression[] arguments) {
31
+	public CallArguments(TypeID[] typeArguments, Expression[] arguments) {
32
 		if (typeArguments == null)
32
 		if (typeArguments == null)
33
-			typeArguments = ITypeID.NONE;
33
+			typeArguments = TypeID.NONE;
34
 		if (arguments == null)
34
 		if (arguments == null)
35
 			throw new IllegalArgumentException("Arguments cannot be null!");
35
 			throw new IllegalArgumentException("Arguments cannot be null!");
36
 		
36
 		
38
 		this.arguments = arguments;
38
 		this.arguments = arguments;
39
 	}
39
 	}
40
 	
40
 	
41
-	public CallArguments(ITypeID... dummy) {
42
-		this.typeArguments = ITypeID.NONE;
41
+	public CallArguments(TypeID... dummy) {
42
+		this.typeArguments = TypeID.NONE;
43
 		this.arguments = new Expression[dummy.length];
43
 		this.arguments = new Expression[dummy.length];
44
 		for (int i = 0; i < dummy.length; i++)
44
 		for (int i = 0; i < dummy.length; i++)
45
-			arguments[i] = new DummyExpression(dummy[i]);
45
+			arguments[i] = new DummyExpression(dummy[i].stored(UniqueStorageTag.INSTANCE));
46
 	}
46
 	}
47
 	
47
 	
48
 	public int getNumberOfTypeArguments() {
48
 	public int getNumberOfTypeArguments() {
65
 			Expression[] newArguments = Arrays.copyOf(arguments, header.parameters.length);
65
 			Expression[] newArguments = Arrays.copyOf(arguments, header.parameters.length);
66
 			for (int i = arguments.length; i < header.parameters.length; i++) {
66
 			for (int i = arguments.length; i < header.parameters.length; i++) {
67
 				if (header.parameters[i].defaultValue == null)
67
 				if (header.parameters[i].defaultValue == null)
68
-					throw new CompileException(position, CompileExceptionCode.MISSING_PARAMETER, "Parameter missing and no default value specified");
69
-				newArguments[i] = header.parameters[i].defaultValue;
68
+					newArguments[i] = new InvalidExpression(position, header.parameters[i].type, CompileExceptionCode.MISSING_PARAMETER, "Parameter missing and no default value specified");
69
+				else
70
+					newArguments[i] = header.parameters[i].defaultValue;
70
 			}
71
 			}
71
 			result = new CallArguments(typeArguments, newArguments);
72
 			result = new CallArguments(typeArguments, newArguments);
72
 		}
73
 		}

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

9
 import org.openzen.zenscript.codemodel.FunctionHeader;
9
 import org.openzen.zenscript.codemodel.FunctionHeader;
10
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
10
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
12
-import org.openzen.zenscript.codemodel.type.ITypeID;
12
+import org.openzen.zenscript.codemodel.type.TypeID;
13
 
13
 
14
 /**
14
 /**
15
  *
15
  *
17
  */
17
  */
18
 public class CallStaticExpression extends Expression {
18
 public class CallStaticExpression extends Expression {
19
 	public final FunctionalMemberRef member;
19
 	public final FunctionalMemberRef member;
20
-	public final ITypeID target;
20
+	public final TypeID target;
21
 	public final CallArguments arguments;
21
 	public final CallArguments arguments;
22
 	public final FunctionHeader instancedHeader;
22
 	public final FunctionHeader instancedHeader;
23
 	
23
 	
24
-	public CallStaticExpression(CodePosition position, ITypeID target, FunctionalMemberRef member, FunctionHeader instancedHeader, CallArguments arguments) {
24
+	public CallStaticExpression(CodePosition position, TypeID target, FunctionalMemberRef member, FunctionHeader instancedHeader, CallArguments arguments) {
25
 		super(position, instancedHeader.getReturnType(), multiThrow(position, arguments.arguments));
25
 		super(position, instancedHeader.getReturnType(), multiThrow(position, arguments.arguments));
26
 		
26
 		
27
 		this.member = member;
27
 		this.member = member;
50
 	public Expression normalize(TypeScope scope) {
50
 	public Expression normalize(TypeScope scope) {
51
 		return new CallStaticExpression(
51
 		return new CallStaticExpression(
52
 				position,
52
 				position,
53
-				target.getNormalized(),
53
+				target.getNormalizedUnstored(),
54
 				member,
54
 				member,
55
 				instancedHeader.normalize(scope.getTypeRegistry()),
55
 				instancedHeader.normalize(scope.getTypeRegistry()),
56
 				arguments.normalize(position, scope, instancedHeader));
56
 				arguments.normalize(position, scope, instancedHeader));

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

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

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

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

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

24
 	public final CompareType comparison;
24
 	public final CompareType comparison;
25
 	
25
 	
26
 	public CompareExpression(CodePosition position, Expression left, Expression right, FunctionalMemberRef operator, CompareType comparison) {
26
 	public CompareExpression(CodePosition position, Expression left, Expression right, FunctionalMemberRef operator, CompareType comparison) {
27
-		super(position, BasicTypeID.BOOL, binaryThrow(position, left.thrownType, right.thrownType));
27
+		super(position, BasicTypeID.BOOL.stored, binaryThrow(position, left.thrownType, right.thrownType));
28
 		
28
 		
29
 		this.left = left;
29
 		this.left = left;
30
 		this.right = right;
30
 		this.right = right;

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

7
 
7
 
8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.ITypeID;
10
+import org.openzen.zenscript.codemodel.type.StoredType;
11
 
11
 
12
 /**
12
 /**
13
  *
13
  *
23
 			Expression condition,
23
 			Expression condition,
24
 			Expression ifThen,
24
 			Expression ifThen,
25
 			Expression ifElse,
25
 			Expression ifElse,
26
-			ITypeID type) {
27
-		super(position, ifThen.type, binaryThrow(position, condition.thrownType, binaryThrow(position, ifThen.thrownType, ifElse.thrownType)));
26
+			StoredType type) {
27
+		super(position, type, binaryThrow(position, condition.thrownType, binaryThrow(position, ifThen.thrownType, ifElse.thrownType)));
28
 		
28
 		
29
 		if (ifThen.type != ifElse.type)
29
 		if (ifThen.type != ifElse.type)
30
 			throw new AssertionError();
30
 			throw new AssertionError();

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

17
 	public final boolean value;
17
 	public final boolean value;
18
 	
18
 	
19
 	public ConstantBoolExpression(CodePosition position, boolean value) {
19
 	public ConstantBoolExpression(CodePosition position, boolean value) {
20
-		super(position, BasicTypeID.BOOL, null);
20
+		super(position, BasicTypeID.BOOL.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final int value;
17
 	public final int value;
18
 	
18
 	
19
 	public ConstantByteExpression(CodePosition position, int value) {
19
 	public ConstantByteExpression(CodePosition position, int value) {
20
-		super(position, BasicTypeID.BYTE, null);
20
+		super(position, BasicTypeID.BYTE.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final char value;
17
 	public final char value;
18
 	
18
 	
19
 	public ConstantCharExpression(CodePosition position, char value) {
19
 	public ConstantCharExpression(CodePosition position, char value) {
20
-		super(position, BasicTypeID.CHAR, null);
20
+		super(position, BasicTypeID.CHAR.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final double value;
17
 	public final double value;
18
 	
18
 	
19
 	public ConstantDoubleExpression(CodePosition position, double value) {
19
 	public ConstantDoubleExpression(CodePosition position, double value) {
20
-		super(position, BasicTypeID.DOUBLE, null);
20
+		super(position, BasicTypeID.DOUBLE.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final float value;
17
 	public final float value;
18
 	
18
 	
19
 	public ConstantFloatExpression(CodePosition position, float value) {
19
 	public ConstantFloatExpression(CodePosition position, float value) {
20
-		super(position, BasicTypeID.FLOAT, null);
20
+		super(position, BasicTypeID.FLOAT.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final int value;
17
 	public final int value;
18
 	
18
 	
19
 	public ConstantIntExpression(CodePosition position, int value) {
19
 	public ConstantIntExpression(CodePosition position, int value) {
20
-		super(position, BasicTypeID.INT, null);
20
+		super(position, BasicTypeID.INT.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

18
 	public final long value;
18
 	public final long value;
19
 	
19
 	
20
 	public ConstantLongExpression(CodePosition position, long value) {
20
 	public ConstantLongExpression(CodePosition position, long value) {
21
-		super(position, BasicTypeID.LONG, null);
21
+		super(position, BasicTypeID.LONG.stored, null);
22
 		
22
 		
23
 		this.value = value;
23
 		this.value = value;
24
 	}
24
 	}

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

17
 	public final byte value;
17
 	public final byte value;
18
 	
18
 	
19
 	public ConstantSByteExpression(CodePosition position, byte value) {
19
 	public ConstantSByteExpression(CodePosition position, byte value) {
20
-		super(position, BasicTypeID.SBYTE, null);
20
+		super(position, BasicTypeID.SBYTE.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final short value;
17
 	public final short value;
18
 	
18
 	
19
 	public ConstantShortExpression(CodePosition position, short value) {
19
 	public ConstantShortExpression(CodePosition position, short value) {
20
-		super(position, BasicTypeID.SHORT, null);
20
+		super(position, BasicTypeID.SHORT.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final int value;
17
 	public final int value;
18
 	
18
 	
19
 	public ConstantUIntExpression(CodePosition position, int value) {
19
 	public ConstantUIntExpression(CodePosition position, int value) {
20
-		super(position, BasicTypeID.UINT, null);
20
+		super(position, BasicTypeID.UINT.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final long value;
17
 	public final long value;
18
 	
18
 	
19
 	public ConstantULongExpression(CodePosition position, long value) {
19
 	public ConstantULongExpression(CodePosition position, long value) {
20
-		super(position, BasicTypeID.ULONG, null);
20
+		super(position, BasicTypeID.ULONG.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final int value;
17
 	public final int value;
18
 	
18
 	
19
 	public ConstantUShortExpression(CodePosition position, int value) {
19
 	public ConstantUShortExpression(CodePosition position, int value) {
20
-		super(position, BasicTypeID.USHORT, null);
20
+		super(position, BasicTypeID.USHORT.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

17
 	public final long value;
17
 	public final long value;
18
 	
18
 	
19
 	public ConstantUSizeExpression(CodePosition position, long value) {
19
 	public ConstantUSizeExpression(CodePosition position, long value) {
20
-		super(position, BasicTypeID.USIZE, null);
20
+		super(position, BasicTypeID.USIZE.stored, null);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;
23
 	}
23
 	}

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

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

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

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

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

7
 
7
 
8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.ITypeID;
10
+import org.openzen.zenscript.codemodel.type.StoredType;
11
 
11
 
12
 /**
12
 /**
13
  *
13
  *
14
  * @author Hoofdgebruiker
14
  * @author Hoofdgebruiker
15
  */
15
  */
16
 public class DummyExpression extends Expression {
16
 public class DummyExpression extends Expression {
17
-	public DummyExpression(ITypeID type) {
17
+	public DummyExpression(StoredType type) {
18
 		super(CodePosition.BUILTIN, type, null);
18
 		super(CodePosition.BUILTIN, type, null);
19
 	}
19
 	}
20
 
20
 

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

10
 import org.openzen.zenscript.codemodel.member.EnumConstantMember;
10
 import org.openzen.zenscript.codemodel.member.EnumConstantMember;
11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
12
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
12
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
13
-import org.openzen.zenscript.codemodel.type.ITypeID;
13
+import org.openzen.zenscript.codemodel.type.TypeID;
14
 import org.openzen.zenscript.codemodel.type.storage.StaticStorageTag;
14
 import org.openzen.zenscript.codemodel.type.storage.StaticStorageTag;
15
 
15
 
16
 /**
16
 /**
20
 public class EnumConstantExpression extends Expression {
20
 public class EnumConstantExpression extends Expression {
21
 	public final EnumConstantMember value;
21
 	public final EnumConstantMember value;
22
 	
22
 	
23
-	public EnumConstantExpression(CodePosition position, ITypeID type, EnumConstantMember value) {
24
-		super(position, type, null);
23
+	public EnumConstantExpression(CodePosition position, TypeID type, EnumConstantMember value) {
24
+		super(position, type.stored(StaticStorageTag.INSTANCE), null);
25
 		
25
 		
26
 		this.value = value;
26
 		this.value = value;
27
 	}
27
 	}
28
 	
28
 	
29
 	public EnumConstantExpression(CodePosition position, GlobalTypeRegistry registry, EnumDefinition type, EnumConstantMember value) {
29
 	public EnumConstantExpression(CodePosition position, GlobalTypeRegistry registry, EnumDefinition type, EnumConstantMember value) {
30
-		super(position, registry.getForDefinition(type, StaticStorageTag.INSTANCE), null);
30
+		super(position, registry.getForDefinition(type).stored(StaticStorageTag.INSTANCE), null);
31
 		
31
 		
32
 		this.value = value;
32
 		this.value = value;
33
 	}
33
 	}

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

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

+ 9
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionBuilder.java View File

14
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
15
 import org.openzen.zenscript.codemodel.scope.ExpressionScope;
15
 import org.openzen.zenscript.codemodel.scope.ExpressionScope;
16
 import org.openzen.zenscript.codemodel.type.GenericName;
16
 import org.openzen.zenscript.codemodel.type.GenericName;
17
-import org.openzen.zenscript.codemodel.type.ITypeID;
18
-import org.openzen.zenscript.codemodel.type.member.DefinitionMemberGroup;
17
+import org.openzen.zenscript.codemodel.type.StoredType;
18
+import org.openzen.zenscript.codemodel.type.TypeID;
19
+import org.openzen.zenscript.codemodel.type.member.TypeMemberGroup;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
20
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
20
 import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
21
 import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
21
 import stdlib.Strings;
22
 import stdlib.Strings;
33
 		this.scope = scope;
34
 		this.scope = scope;
34
 	}
35
 	}
35
 	
36
 	
36
-	public Expression constructNew(String typename, Expression... arguments) {
37
+	public Expression constructNew(String typename, Expression... arguments) throws CompileException {
37
 		String[] nameParts = Strings.split(typename, '.');
38
 		String[] nameParts = Strings.split(typename, '.');
38
 		List<GenericName> name = new ArrayList<>();
39
 		List<GenericName> name = new ArrayList<>();
39
 		for (String namePart : nameParts)
40
 		for (String namePart : nameParts)
40
 			name.add(new GenericName(namePart));
41
 			name.add(new GenericName(namePart));
41
-		ITypeID type = scope.getType(position, name, UniqueStorageTag.INSTANCE);
42
+		TypeID type = scope.getType(position, name);
42
 		if (type == null)
43
 		if (type == null)
43
 			throw new CompileException(position, CompileExceptionCode.NO_SUCH_TYPE, "No such type: " + typename);
44
 			throw new CompileException(position, CompileExceptionCode.NO_SUCH_TYPE, "No such type: " + typename);
44
 		
45
 		
45
-		return constructNew(type, arguments);
46
+		return constructNew(type.stored(UniqueStorageTag.INSTANCE), arguments);
46
 	}
47
 	}
47
 	
48
 	
48
-	public Expression constructNew(ITypeID type, Expression... arguments) {
49
-		DefinitionMemberGroup constructors = scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CONSTRUCTOR);
50
-		List<ITypeID>[] predictedTypes = constructors.predictCallTypes(scope, scope.hints, arguments.length);
49
+	public Expression constructNew(StoredType type, Expression... arguments) throws CompileException {
50
+		TypeMemberGroup constructors = scope.getTypeMembers(type).getOrCreateGroup(OperatorType.CONSTRUCTOR);
51
+		List<StoredType>[] predictedTypes = constructors.predictCallTypes(scope, scope.hints, arguments.length);
51
 		CallArguments compiledArguments = new CallArguments(arguments);
52
 		CallArguments compiledArguments = new CallArguments(arguments);
52
 		FunctionalMemberRef member = constructors.selectMethod(position, scope, compiledArguments, true, true);
53
 		FunctionalMemberRef member = constructors.selectMethod(position, scope, compiledArguments, true, true);
53
 		if (member == null)
54
 		if (member == null)

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

94
 	
94
 	
95
 	public T visitInterfaceCast(InterfaceCastExpression expression);
95
 	public T visitInterfaceCast(InterfaceCastExpression expression);
96
 	
96
 	
97
+	public default T visitInvalid(InvalidExpression expression) {
98
+		throw new RuntimeException("Invalid expression");
99
+	}
100
+	
97
 	public T visitIs(IsExpression expression);
101
 	public T visitIs(IsExpression expression);
98
 	
102
 	
99
 	public T visitMakeConst(MakeConstExpression expression);
103
 	public T visitMakeConst(MakeConstExpression expression);

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

94
 	
94
 	
95
 	public R visitInterfaceCast(C context, InterfaceCastExpression expression);
95
 	public R visitInterfaceCast(C context, InterfaceCastExpression expression);
96
 	
96
 	
97
+	public R visitInvalid(C context, InvalidExpression expression);
98
+	
97
 	public R visitIs(C context, IsExpression expression);
99
 	public R visitIs(C context, IsExpression expression);
98
 	
100
 	
99
 	public R visitMakeConst(C context, MakeConstExpression expression);
101
 	public R visitMakeConst(C context, MakeConstExpression expression);

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

18
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
18
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
19
 import org.openzen.zenscript.codemodel.statement.Statement;
19
 import org.openzen.zenscript.codemodel.statement.Statement;
20
 import org.openzen.zenscript.codemodel.type.FunctionTypeID;
20
 import org.openzen.zenscript.codemodel.type.FunctionTypeID;
21
+import org.openzen.zenscript.codemodel.type.StoredType;
21
 
22
 
22
 /**
23
 /**
23
  *
24
  *
30
 	
31
 	
31
 	public FunctionExpression(
32
 	public FunctionExpression(
32
 			CodePosition position,
33
 			CodePosition position,
33
-			FunctionTypeID type,
34
+			StoredType type,
34
 			LambdaClosure closure,
35
 			LambdaClosure closure,
35
 			FunctionHeader header,
36
 			FunctionHeader header,
36
 			Statement body) {
37
 			Statement body) {
54
 	@Override
55
 	@Override
55
 	public FunctionExpression transform(ExpressionTransformer transformer) {
56
 	public FunctionExpression transform(ExpressionTransformer transformer) {
56
 		Statement tBody = body.transform(transformer, ConcatMap.empty(LoopStatement.class, LoopStatement.class));
57
 		Statement tBody = body.transform(transformer, ConcatMap.empty(LoopStatement.class, LoopStatement.class));
57
-		return tBody == body ? this : new FunctionExpression(position, (FunctionTypeID)type, closure, header, tBody);
58
+		return tBody == body ? this : new FunctionExpression(position, type, closure, header, tBody);
58
 	}
59
 	}
59
 	
60
 	
60
 	@Override
61
 	@Override
83
 
84
 
84
 	@Override
85
 	@Override
85
 	public Expression normalize(TypeScope scope) {
86
 	public Expression normalize(TypeScope scope) {
86
-		return new FunctionExpression(position, (FunctionTypeID)type, closure, header, body.normalize(scope, ConcatMap.empty(LoopStatement.class, LoopStatement.class)));
87
+		return new FunctionExpression(position, type, closure, header, body.normalize(scope, ConcatMap.empty(LoopStatement.class, LoopStatement.class)));
87
 	}
88
 	}
88
 	
89
 	
89
 	private static class ReturnExpressionTransformer implements ExpressionTransformer {
90
 	private static class ReturnExpressionTransformer implements ExpressionTransformer {

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

11
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
11
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
12
 import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
12
 import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
13
 import org.openzen.zenscript.codemodel.scope.TypeScope;
13
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
-import org.openzen.zenscript.codemodel.type.ITypeID;
14
+import org.openzen.zenscript.codemodel.type.StoredType;
15
 
15
 
16
 /**
16
 /**
17
  *
17
  *
29
 	}
29
 	}
30
 	
30
 	
31
 	@Override
31
 	@Override
32
-	public List<ITypeID> getAssignHints() {
32
+	public List<StoredType> getAssignHints() {
33
 		return Collections.singletonList(type);
33
 		return Collections.singletonList(type);
34
 	}
34
 	}
35
 	
35
 	

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

11
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
11
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
12
 import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
12
 import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
13
 import org.openzen.zenscript.codemodel.scope.TypeScope;
13
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
-import org.openzen.zenscript.codemodel.type.ITypeID;
14
+import org.openzen.zenscript.codemodel.type.StoredType;
15
 
15
 
16
 /**
16
 /**
17
  *
17
  *
27
 	}
27
 	}
28
 	
28
 	
29
 	@Override
29
 	@Override
30
-	public List<ITypeID> getAssignHints() {
30
+	public List<StoredType> getAssignHints() {
31
 		return Collections.singletonList(field.getType());
31
 		return Collections.singletonList(field.getType());
32
 	}
32
 	}
33
 	
33
 	

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

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

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

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.zencode.shared.CompileException;
10
+import org.openzen.zencode.shared.CompileExceptionCode;
11
+import org.openzen.zenscript.codemodel.scope.TypeScope;
12
+import org.openzen.zenscript.codemodel.type.BasicTypeID;
13
+import org.openzen.zenscript.codemodel.type.StoredType;
14
+
15
+/**
16
+ *
17
+ * @author Hoofdgebruiker
18
+ */
19
+public class InvalidExpression extends Expression {
20
+	public final CompileExceptionCode code;
21
+	public final String message;
22
+	
23
+	public InvalidExpression(CodePosition position, StoredType type, CompileExceptionCode code, String message) {
24
+		super(position, type, null);
25
+		
26
+		this.code = code;
27
+		this.message = message;
28
+	}
29
+	
30
+	public InvalidExpression(CodePosition position, CompileExceptionCode code, String message) {
31
+		this(position, BasicTypeID.UNDETERMINED.stored, code, message);
32
+	}
33
+	
34
+	public InvalidExpression(StoredType type, CompileException cause) {
35
+		this(cause.position, type, cause.code, cause.getMessage());
36
+	}
37
+
38
+	@Override
39
+	public <T> T accept(ExpressionVisitor<T> visitor) {
40
+		return visitor.visitInvalid(this);
41
+	}
42
+
43
+	@Override
44
+	public <C, R> R accept(C context, ExpressionVisitorWithContext<C, R> visitor) {
45
+		return visitor.visitInvalid(context, this);
46
+	}
47
+
48
+	@Override
49
+	public Expression transform(ExpressionTransformer transformer) {
50
+		return this;
51
+	}
52
+
53
+	@Override
54
+	public Expression normalize(TypeScope scope) {
55
+		return this;
56
+	}
57
+}

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

8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
11
-import org.openzen.zenscript.codemodel.type.ITypeID;
11
+import org.openzen.zenscript.codemodel.type.TypeID;
12
 
12
 
13
 /**
13
 /**
14
  *
14
  *
16
  */
16
  */
17
 public class IsExpression extends Expression {
17
 public class IsExpression extends Expression {
18
 	public final Expression value;
18
 	public final Expression value;
19
-	public final ITypeID isType;
19
+	public final TypeID isType;
20
 	
20
 	
21
-	public IsExpression(CodePosition position, Expression value, ITypeID type) {
22
-		super(position, BasicTypeID.BOOL, value.thrownType);
21
+	public IsExpression(CodePosition position, Expression value, TypeID type) {
22
+		super(position, BasicTypeID.BOOL.stored, value.thrownType);
23
 		
23
 		
24
 		this.value = value;
24
 		this.value = value;
25
 		this.isType = type;
25
 		this.isType = type;
38
 	@Override
38
 	@Override
39
 	public Expression transform(ExpressionTransformer transformer) {
39
 	public Expression transform(ExpressionTransformer transformer) {
40
 		Expression tValue = value.transform(transformer);
40
 		Expression tValue = value.transform(transformer);
41
-		return tValue == value ? this : new IsExpression(position, tValue, type);
41
+		return tValue == value ? this : new IsExpression(position, tValue, isType);
42
 	}
42
 	}
43
 
43
 
44
 	@Override
44
 	@Override
45
 	public Expression normalize(TypeScope scope) {
45
 	public Expression normalize(TypeScope scope) {
46
-		return new IsExpression(position, value.normalize(scope), type.getNormalized());
46
+		return new IsExpression(position, value.normalize(scope), isType.getNormalizedUnstored());
47
 	}
47
 	}
48
 }
48
 }

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

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

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

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

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

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

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

9
 import org.openzen.zenscript.codemodel.FunctionHeader;
9
 import org.openzen.zenscript.codemodel.FunctionHeader;
10
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
10
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
11
 import org.openzen.zenscript.codemodel.scope.TypeScope;
12
-import org.openzen.zenscript.codemodel.type.ITypeID;
12
+import org.openzen.zenscript.codemodel.type.StoredType;
13
 
13
 
14
 /**
14
 /**
15
  *
15
  *
22
 	
22
 	
23
 	public NewExpression(
23
 	public NewExpression(
24
 			CodePosition position,
24
 			CodePosition position,
25
-			ITypeID type,
25
+			StoredType type,
26
 			FunctionalMemberRef constructor,
26
 			FunctionalMemberRef constructor,
27
 			CallArguments arguments)
27
 			CallArguments arguments)
28
 	{
28
 	{
31
 	
31
 	
32
 	public NewExpression(
32
 	public NewExpression(
33
 			CodePosition position,
33
 			CodePosition position,
34
-			ITypeID type,
34
+			StoredType type,
35
 			FunctionalMemberRef constructor,
35
 			FunctionalMemberRef constructor,
36
 			CallArguments arguments,
36
 			CallArguments arguments,
37
 			FunctionHeader instancedHeader)
37
 			FunctionHeader instancedHeader)

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

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

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

18
 	public final Expression right;
18
 	public final Expression right;
19
 	
19
 	
20
 	public OrOrExpression(CodePosition position, Expression left, Expression right) {
20
 	public OrOrExpression(CodePosition position, Expression left, Expression right) {
21
-		super(position, BasicTypeID.BOOL, binaryThrow(position, left.thrownType, right.thrownType));
21
+		super(position, BasicTypeID.BOOL.stored, binaryThrow(position, left.thrownType, right.thrownType));
22
 		
22
 		
23
 		this.left = left;
23
 		this.left = left;
24
 		this.right = right;
24
 		this.right = right;

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

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

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

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

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

19
 	public final boolean inverted;
19
 	public final boolean inverted;
20
 	
20
 	
21
 	public SameObjectExpression(CodePosition position, Expression left, Expression right, boolean inverted) {
21
 	public SameObjectExpression(CodePosition position, Expression left, Expression right, boolean inverted) {
22
-		super(position, BasicTypeID.BOOL, binaryThrow(position, left.thrownType, right.thrownType));
22
+		super(position, BasicTypeID.BOOL.stored, binaryThrow(position, left.thrownType, right.thrownType));
23
 		
23
 		
24
 		this.left = left;
24
 		this.left = left;
25
 		this.right = right;
25
 		this.right = right;

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

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

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

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

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

8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
9
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
10
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 import org.openzen.zenscript.codemodel.scope.TypeScope;
11
-import org.openzen.zenscript.codemodel.type.ITypeID;
11
+import org.openzen.zenscript.codemodel.type.StoredType;
12
 
12
 
13
 /**
13
 /**
14
  *
14
  *
15
  * @author Hoofdgebruiker
15
  * @author Hoofdgebruiker
16
  */
16
  */
17
 public class ThisExpression extends Expression {
17
 public class ThisExpression extends Expression {
18
-	public ThisExpression(CodePosition position, ITypeID type) {
18
+	public ThisExpression(CodePosition position, StoredType type) {
19
 		super(position, type, null);
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
 
8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
9
 import org.openzen.zenscript.codemodel.scope.TypeScope;
10
-import org.openzen.zenscript.codemodel.type.ITypeID;
10
+import org.openzen.zenscript.codemodel.type.StoredType;
11
 
11
 
12
 /**
12
 /**
13
  *
13
  *
16
 public class ThrowExpression extends Expression {
16
 public class ThrowExpression extends Expression {
17
 	public final Expression value;
17
 	public final Expression value;
18
 	
18
 	
19
-	public ThrowExpression(CodePosition position, ITypeID type, Expression value) {
19
+	public ThrowExpression(CodePosition position, StoredType type, Expression value) {
20
 		super(position, type, value.type);
20
 		super(position, type, value.type);
21
 		
21
 		
22
 		this.value = value;
22
 		this.value = value;

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

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

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

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

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

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

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

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

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

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

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

7
 
7
 
8
 import org.openzen.zenscript.codemodel.GenericMapper;
8
 import org.openzen.zenscript.codemodel.GenericMapper;
9
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
9
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
10
-import org.openzen.zenscript.codemodel.type.ITypeID;
11
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
10
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
11
+import org.openzen.zenscript.codemodel.type.TypeID;
12
+import org.openzen.zenscript.codemodel.type.storage.BorrowStorageTag;
12
 
13
 
13
 /**
14
 /**
14
  *
15
  *
15
  * @author Hoofdgebruiker
16
  * @author Hoofdgebruiker
16
  */
17
  */
17
 public class ParameterSuperBound extends TypeParameterBound {
18
 public class ParameterSuperBound extends TypeParameterBound {
18
-	public final ITypeID type;
19
+	public final TypeID type;
19
 	
20
 	
20
-	public ParameterSuperBound(ITypeID type) {
21
+	public ParameterSuperBound(TypeID type) {
21
 		this.type = type;
22
 		this.type = type;
22
 	}
23
 	}
23
 	
24
 	
32
 	}
33
 	}
33
 
34
 
34
 	@Override
35
 	@Override
35
-	public boolean matches(LocalMemberCache cache, ITypeID type) {
36
-		return cache.get(this.type).extendsOrImplements(type);
36
+	public boolean matches(LocalMemberCache cache, TypeID type) {
37
+		return cache.get(this.type.stored(BorrowStorageTag.THIS)).extendsOrImplements(type);
37
 	}
38
 	}
38
 
39
 
39
 	@Override
40
 	@Override
40
 	public TypeParameterBound instance(GenericMapper mapper) {
41
 	public TypeParameterBound instance(GenericMapper mapper) {
41
-		ITypeID translated = type.instance(mapper);
42
+		TypeID translated = type.instanceUnstored(mapper);
42
 		if (translated == type)
43
 		if (translated == type)
43
 			return this;
44
 			return this;
44
 		
45
 		

+ 11
- 8
CodeModel/src/main/java/org/openzen/zenscript/codemodel/generic/ParameterTypeBound.java View File

8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zenscript.codemodel.GenericMapper;
9
 import org.openzen.zenscript.codemodel.GenericMapper;
10
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
10
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
11
-import org.openzen.zenscript.codemodel.type.ITypeID;
12
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
11
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
13
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
12
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
13
+import org.openzen.zenscript.codemodel.type.TypeID;
14
+import org.openzen.zenscript.codemodel.type.storage.BorrowStorageTag;
14
 
15
 
15
 /**
16
 /**
16
  *
17
  *
18
  */
19
  */
19
 public class ParameterTypeBound extends TypeParameterBound {
20
 public class ParameterTypeBound extends TypeParameterBound {
20
 	public final CodePosition position;
21
 	public final CodePosition position;
21
-	public final ITypeID type;
22
+	public final TypeID type;
22
 	
23
 	
23
-	public ParameterTypeBound(CodePosition position, ITypeID type) {
24
+	public ParameterTypeBound(CodePosition position, TypeID type) {
24
 		this.position = position;
25
 		this.position = position;
25
 		this.type = type;
26
 		this.type = type;
26
 	}
27
 	}
31
 	}
32
 	}
32
 
33
 
33
 	@Override
34
 	@Override
34
-	public void registerMembers(LocalMemberCache cache, TypeMembers type) {
35
-		cache.get(this.type).copyMembersTo(position, type, TypeMemberPriority.FROM_TYPE_BOUNDS);
35
+	public void registerMembers(LocalMemberCache cache, TypeMembers members) {
36
+		cache.get(this.type.stored(members.type.storage))
37
+				.copyMembersTo(position, members, TypeMemberPriority.FROM_TYPE_BOUNDS);
36
 	}
38
 	}
37
 
39
 
38
 	@Override
40
 	@Override
39
-	public boolean matches(LocalMemberCache cache, ITypeID type) {
40
-		return cache.get(type).extendsOrImplements(this.type);
41
+	public boolean matches(LocalMemberCache cache, TypeID type) {
42
+		return cache.get(type.stored(BorrowStorageTag.THIS))
43
+				.extendsOrImplements(this.type);
41
 	}
44
 	}
42
 
45
 
43
 	@Override
46
 	@Override
44
 	public TypeParameterBound instance(GenericMapper mapper) {
47
 	public TypeParameterBound instance(GenericMapper mapper) {
45
-		return new ParameterTypeBound(position, type.instance(mapper));
48
+		return new ParameterTypeBound(position, type.instanceUnstored(mapper));
46
 	}
49
 	}
47
 
50
 
48
 	@Override
51
 	@Override

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

11
 import org.openzen.zencode.shared.CodePosition;
11
 import org.openzen.zencode.shared.CodePosition;
12
 import org.openzen.zencode.shared.Taggable;
12
 import org.openzen.zencode.shared.Taggable;
13
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
13
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
14
-import org.openzen.zenscript.codemodel.type.ITypeID;
14
+import org.openzen.zenscript.codemodel.type.TypeID;
15
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
15
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
16
 
16
 
17
 /**
17
 /**
48
 		return false;
48
 		return false;
49
 	}
49
 	}
50
 	
50
 	
51
-	public boolean matches(LocalMemberCache cache, ITypeID type) {
51
+	public boolean matches(LocalMemberCache cache, TypeID type) {
52
 		for (TypeParameterBound bound : bounds) {
52
 		for (TypeParameterBound bound : bounds) {
53
 			if (!bound.matches(cache, type))
53
 			if (!bound.matches(cache, type))
54
 				return false;
54
 				return false;
57
 		return true;
57
 		return true;
58
 	}
58
 	}
59
 	
59
 	
60
-	public TypeParameter withGenericArguments(GlobalTypeRegistry registry, Map<TypeParameter, ITypeID> arguments) {
60
+	public TypeParameter withGenericArguments(GlobalTypeRegistry registry, Map<TypeParameter, TypeID> arguments) {
61
 		// TODO: think about this...
61
 		// TODO: think about this...
62
 		//List<GenericParameterBound> bounds = new ArrayList<>();
62
 		//List<GenericParameterBound> bounds = new ArrayList<>();
63
 		//for (GenericParameterBound bound : this.bounds)
63
 		//for (GenericParameterBound bound : this.bounds)

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

6
 package org.openzen.zenscript.codemodel.generic;
6
 package org.openzen.zenscript.codemodel.generic;
7
 
7
 
8
 import org.openzen.zenscript.codemodel.GenericMapper;
8
 import org.openzen.zenscript.codemodel.GenericMapper;
9
-import org.openzen.zenscript.codemodel.type.ITypeID;
9
+import org.openzen.zenscript.codemodel.type.TypeID;
10
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
10
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
11
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
11
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
12
 
12
 
23
 	
23
 	
24
 	public abstract void registerMembers(LocalMemberCache cache, TypeMembers type);
24
 	public abstract void registerMembers(LocalMemberCache cache, TypeMembers type);
25
 	
25
 	
26
-	public abstract boolean matches(LocalMemberCache cache, ITypeID type);
26
+	public abstract boolean matches(LocalMemberCache cache, TypeID type);
27
 	
27
 	
28
 	public abstract TypeParameterBound instance(GenericMapper mapper);
28
 	public abstract TypeParameterBound instance(GenericMapper mapper);
29
 	
29
 	

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

14
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
 import org.openzen.zenscript.codemodel.scope.TypeScope;
15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
17
-import org.openzen.zenscript.codemodel.type.ITypeID;
17
+import org.openzen.zenscript.codemodel.type.StoredType;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
20
 
20
 
23
  * @author Hoofdgebruiker
23
  * @author Hoofdgebruiker
24
  */
24
  */
25
 public class CasterMember extends FunctionalMember {
25
 public class CasterMember extends FunctionalMember {
26
-	public ITypeID toType;
26
+	public StoredType toType;
27
 	public CasterMemberRef overrides;
27
 	public CasterMemberRef overrides;
28
 	
28
 	
29
 	public CasterMember(
29
 	public CasterMember(
30
 			CodePosition position,
30
 			CodePosition position,
31
 			HighLevelDefinition definition,
31
 			HighLevelDefinition definition,
32
 			int modifiers,
32
 			int modifiers,
33
-			ITypeID toType,
33
+			StoredType toType,
34
 			BuiltinID builtin)
34
 			BuiltinID builtin)
35
 	{
35
 	{
36
 		super(position, definition, modifiers, new FunctionHeader(toType), builtin);
36
 		super(position, definition, modifiers, new FunctionHeader(toType), builtin);
50
 
50
 
51
 	@Override
51
 	@Override
52
 	public void registerTo(TypeMembers type, TypeMemberPriority priority, GenericMapper mapper) {
52
 	public void registerTo(TypeMembers type, TypeMemberPriority priority, GenericMapper mapper) {
53
-		type.addCaster(new CasterMemberRef(this, type.type, mapper == null ? toType : mapper.map(toType)), priority);
53
+		type.addCaster(new CasterMemberRef(this, type.type, mapper == null ? toType : toType.instance(mapper)), priority);
54
 	}
54
 	}
55
 
55
 
56
 	@Override
56
 	@Override
58
 		return "caster to " + toType.toString();
58
 		return "caster to " + toType.toString();
59
 	}
59
 	}
60
 	
60
 	
61
-	public ITypeID getTargetType() {
61
+	public StoredType getTargetType() {
62
 		return toType;
62
 		return toType;
63
 	}
63
 	}
64
 	
64
 	

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

13
 import org.openzen.zenscript.codemodel.member.ref.ConstMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.ConstMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
15
 import org.openzen.zenscript.codemodel.scope.TypeScope;
15
 import org.openzen.zenscript.codemodel.scope.TypeScope;
16
-import org.openzen.zenscript.codemodel.type.ITypeID;
16
+import org.openzen.zenscript.codemodel.type.StoredType;
17
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
17
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
18
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
18
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
26
 	public final String name;
26
 	public final String name;
27
 	public Expression value;
27
 	public Expression value;
28
 	
28
 	
29
-	public ConstMember(CodePosition position, HighLevelDefinition definition, int modifiers, String name, ITypeID type, BuiltinID builtin) {
29
+	public ConstMember(CodePosition position, HighLevelDefinition definition, int modifiers, String name, StoredType type, BuiltinID builtin) {
30
 		super(position, definition, modifiers, type, builtin);
30
 		super(position, definition, modifiers, type, builtin);
31
 		
31
 		
32
 		this.name = name;
32
 		this.name = name;
69
 	}
69
 	}
70
 
70
 
71
 	@Override
71
 	@Override
72
-	public DefinitionMemberRef ref(ITypeID type, GenericMapper mapper) {
72
+	public DefinitionMemberRef ref(StoredType type, GenericMapper mapper) {
73
 		return new ConstMemberRef(type, this, mapper);
73
 		return new ConstMemberRef(type, this, mapper);
74
 	}
74
 	}
75
 	
75
 	

+ 1
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ConstructorMember.java View File

38
 				position,
38
 				position,
39
 				definition,
39
 				definition,
40
 				modifiers,
40
 				modifiers,
41
-				new FunctionHeader(header.typeParameters, BasicTypeID.VOID, header.thrownType, header.parameters),
41
+				new FunctionHeader(header.typeParameters, BasicTypeID.VOID.stored, header.thrownType, header.parameters),
42
 				builtin);
42
 				builtin);
43
 	}
43
 	}
44
 	
44
 	

+ 1
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/DefinitionMember.java View File

42
 		return definition;
42
 		return definition;
43
 	}
43
 	}
44
 	
44
 	
45
+	@Override
45
 	public MemberAnnotation[] getAnnotations() {
46
 	public MemberAnnotation[] getAnnotations() {
46
 		return annotations;
47
 		return annotations;
47
 	}
48
 	}

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

21
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
21
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
22
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
22
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
23
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
23
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
24
-import org.openzen.zenscript.codemodel.type.ITypeID;
24
+import org.openzen.zenscript.codemodel.type.StoredType;
25
+import org.openzen.zenscript.codemodel.type.TypeID;
25
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
26
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
26
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
27
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
27
 
28
 
43
 			HighLevelDefinition definition,
44
 			HighLevelDefinition definition,
44
 			int modifiers,
45
 			int modifiers,
45
 			String name,
46
 			String name,
46
-			ITypeID thisType,
47
-			ITypeID type,
47
+			StoredType thisType,
48
+			StoredType type,
48
 			GlobalTypeRegistry registry,
49
 			GlobalTypeRegistry registry,
49
 			int autoGetterAccess,
50
 			int autoGetterAccess,
50
 			int autoSetterAccess,
51
 			int autoSetterAccess,
56
 		this.autoGetterAccess = autoGetterAccess;
57
 		this.autoGetterAccess = autoGetterAccess;
57
 		this.autoSetterAccess = autoSetterAccess;
58
 		this.autoSetterAccess = autoSetterAccess;
58
 		
59
 		
59
-		ITypeID[] parameters = null;
60
+		TypeID[] parameters = null;
60
 		if (definition.typeParameters != null) {
61
 		if (definition.typeParameters != null) {
61
-			parameters = new ITypeID[definition.typeParameters.length];
62
+			parameters = new TypeID[definition.typeParameters.length];
62
 			for (int i = 0; i < parameters.length; i++)
63
 			for (int i = 0; i < parameters.length; i++)
63
-				parameters[i] = registry.getGeneric(definition.typeParameters[i], null);
64
+				parameters[i] = registry.getGeneric(definition.typeParameters[i]);
64
 		}
65
 		}
65
 		
66
 		
66
 		if (autoGetterAccess != 0) {
67
 		if (autoGetterAccess != 0) {
89
 			HighLevelDefinition definition,
90
 			HighLevelDefinition definition,
90
 			int modifiers,
91
 			int modifiers,
91
 			String name,
92
 			String name,
92
-			ITypeID type,
93
+			StoredType type,
93
 			int autoGetterAccess,
94
 			int autoGetterAccess,
94
 			int autoSetterAccess,
95
 			int autoSetterAccess,
95
 			GetterMember autoGetter,
96
 			GetterMember autoGetter,
160
 	}
161
 	}
161
 
162
 
162
 	@Override
163
 	@Override
163
-	public DefinitionMemberRef ref(ITypeID type, GenericMapper mapper) {
164
+	public DefinitionMemberRef ref(StoredType type, GenericMapper mapper) {
164
 		return new FieldMemberRef(type, this, mapper);
165
 		return new FieldMemberRef(type, this, mapper);
165
 	}
166
 	}
166
 	
167
 	

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

14
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
 import org.openzen.zenscript.codemodel.scope.TypeScope;
15
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
15
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
16
 import org.openzen.zenscript.codemodel.statement.Statement;
16
 import org.openzen.zenscript.codemodel.statement.Statement;
17
-import org.openzen.zenscript.codemodel.type.ITypeID;
17
+import org.openzen.zenscript.codemodel.type.StoredType;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
19
 
19
 
20
 /**
20
 /**
46
 	
46
 	
47
 	public abstract FunctionalKind getKind();
47
 	public abstract FunctionalKind getKind();
48
 	
48
 	
49
-	public FunctionalMemberRef ref(ITypeID type, GenericMapper mapper) {
49
+	public FunctionalMemberRef ref(StoredType type) {
50
+		return new FunctionalMemberRef(this, type, null);
51
+	}
52
+	
53
+	public FunctionalMemberRef ref(StoredType type, GenericMapper mapper) {
50
 		return new FunctionalMemberRef(this, type, mapper);
54
 		return new FunctionalMemberRef(this, type, mapper);
51
 	}
55
 	}
52
 	
56
 	

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

17
 import org.openzen.zenscript.codemodel.statement.Statement;
17
 import org.openzen.zenscript.codemodel.statement.Statement;
18
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
18
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
20
-import org.openzen.zenscript.codemodel.type.ITypeID;
20
+import org.openzen.zenscript.codemodel.type.StoredType;
21
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
21
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
22
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
22
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
23
 
23
 
35
 			HighLevelDefinition definition,
35
 			HighLevelDefinition definition,
36
 			int modifiers,
36
 			int modifiers,
37
 			String name,
37
 			String name,
38
-			ITypeID type,
38
+			StoredType type,
39
 			BuiltinID builtin) {
39
 			BuiltinID builtin) {
40
 		super(position, definition, modifiers, type, builtin);
40
 		super(position, definition, modifiers, type, builtin);
41
 		
41
 		
45
 	public void setBody(Statement body) {
45
 	public void setBody(Statement body) {
46
 		this.body = body;
46
 		this.body = body;
47
 		
47
 		
48
-		if (type == BasicTypeID.UNDETERMINED)
48
+		if (type.type == BasicTypeID.UNDETERMINED)
49
 			type = body.getReturnType();
49
 			type = body.getReturnType();
50
 	}
50
 	}
51
 	
51
 	
88
 	public void setOverrides(GetterMemberRef override) {
88
 	public void setOverrides(GetterMemberRef override) {
89
 		this.overrides = override;
89
 		this.overrides = override;
90
 		
90
 		
91
-		if (type == BasicTypeID.UNDETERMINED)
91
+		if (type.type == BasicTypeID.UNDETERMINED)
92
 			type = override.getType();
92
 			type = override.getType();
93
 	}
93
 	}
94
 
94
 
95
 	@Override
95
 	@Override
96
-	public DefinitionMemberRef ref(ITypeID type, GenericMapper mapper) {
96
+	public DefinitionMemberRef ref(StoredType type, GenericMapper mapper) {
97
 		return new GetterMemberRef(type, this, mapper);
97
 		return new GetterMemberRef(type, this, mapper);
98
 	}
98
 	}
99
 	
99
 	

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

12
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
12
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
13
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
14
 import org.openzen.zenscript.codemodel.scope.TypeScope;
14
 import org.openzen.zenscript.codemodel.scope.TypeScope;
15
-import org.openzen.zenscript.codemodel.type.ITypeID;
15
+import org.openzen.zenscript.codemodel.type.StoredType;
16
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
16
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
17
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
17
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
18
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
18
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
52
 	
52
 	
53
 	boolean isAbstract();
53
 	boolean isAbstract();
54
 	
54
 	
55
-	DefinitionMemberRef ref(ITypeID type, GenericMapper mapper);
55
+	DefinitionMemberRef ref(StoredType type, GenericMapper mapper);
56
 	
56
 	
57
 	FunctionHeader getHeader();
57
 	FunctionHeader getHeader();
58
 }
58
 }

+ 0
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ImplementationMember.java View File


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

Loading…
Cancel
Save