Browse Source

- Added type aliasing

- Changed the way modified types are processed
- Added immutable keyword
- Added expression, statement and type normalization
- Improved naming of synthetic functions
Stan Hebben 6 years ago
parent
commit
0f45f3cd45
100 changed files with 693 additions and 68 deletions
  1. 2
    2
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/DefinitionFormatter.java
  2. 13
    9
      CodeFormatter/src/main/java/org/openzen/zenscript/formatter/TypeFormatter.java
  3. 21
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionHeader.java
  4. 7
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionParameter.java
  5. 53
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/HighLevelDefinition.java
  6. 1
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/annotations/AnnotationProcessor.java
  7. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/AliasDefinition.java
  8. 1
    4
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/ClassDefinition.java
  9. 1
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/InterfaceDefinition.java
  10. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/AndAndExpression.java
  11. 9
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ArrayExpression.java
  12. 13
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CallExpression.java
  13. 13
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CallStaticExpression.java
  14. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedClosureExpression.java
  15. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedDirectExpression.java
  16. 4
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedExpression.java
  17. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedLocalVariableExpression.java
  18. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedParameterExpression.java
  19. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedThisExpression.java
  20. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CastExpression.java
  21. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CheckNullExpression.java
  22. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CoalesceExpression.java
  23. 5
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CompareExpression.java
  24. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConditionalExpression.java
  25. 7
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstExpression.java
  26. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantBoolExpression.java
  27. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantByteExpression.java
  28. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantCharExpression.java
  29. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantDoubleExpression.java
  30. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantFloatExpression.java
  31. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantIntExpression.java
  32. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantLongExpression.java
  33. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantSByteExpression.java
  34. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantShortExpression.java
  35. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantStringExpression.java
  36. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantUIntExpression.java
  37. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantULongExpression.java
  38. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstantUShortExpression.java
  39. 8
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstructorSuperCallExpression.java
  40. 8
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ConstructorThisCallExpression.java
  41. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/DummyExpression.java
  42. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/EnumConstantExpression.java
  43. 4
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/Expression.java
  44. 1
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ExpressionBuilder.java
  45. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/FunctionExpression.java
  46. 5
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetFieldExpression.java
  47. 5
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetFunctionParameterExpression.java
  48. 5
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetLocalVariableExpression.java
  49. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetStaticFieldExpression.java
  50. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetterExpression.java
  51. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GlobalCallExpression.java
  52. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GlobalExpression.java
  53. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/InterfaceCastExpression.java
  54. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/IsExpression.java
  55. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MakeConstExpression.java
  56. 14
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MapExpression.java
  57. 13
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/MatchExpression.java
  58. 9
    9
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NewExpression.java
  59. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/NullExpression.java
  60. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/OrOrExpression.java
  61. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/PanicExpression.java
  62. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/PostCallExpression.java
  63. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/RangeExpression.java
  64. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SameObjectExpression.java
  65. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetFieldExpression.java
  66. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetFunctionParameterExpression.java
  67. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetLocalVariableExpression.java
  68. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetStaticFieldExpression.java
  69. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetterExpression.java
  70. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/StaticGetterExpression.java
  71. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/StaticSetterExpression.java
  72. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SupertypeCastExpression.java
  73. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThisExpression.java
  74. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThrowExpression.java
  75. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryConvertExpression.java
  76. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryRethrowAsExceptionExpression.java
  77. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/TryRethrowAsResultExpression.java
  78. 8
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/VariantValueExpression.java
  79. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/WrapOptionalExpression.java
  80. 1
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/CallerMember.java
  81. 8
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/CasterMember.java
  82. 8
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ConstMember.java
  83. 19
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/CustomIteratorMember.java
  84. 13
    6
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FieldMember.java
  85. 2
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FunctionalKind.java
  86. 10
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/FunctionalMember.java
  87. 3
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/IDefinitionMember.java
  88. 7
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ImplementationMember.java
  89. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/InnerDefinition.java
  90. 9
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/InnerDefinitionMember.java
  91. 8
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/StaticInitializerMember.java
  92. 7
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/builtin/ArrayIteratorKeyValues.java
  93. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/builtin/ArrayIteratorValues.java
  94. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/builtin/AssocIterator.java
  95. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/builtin/RangeIterator.java
  96. 6
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/builtin/StringCharIterator.java
  97. 16
    3
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/ConstMemberRef.java
  98. 2
    2
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/FunctionalMemberRef.java
  99. 0
    1
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/BaseScope.java
  100. 0
    0
      CodeModel/src/main/java/org/openzen/zenscript/codemodel/scope/DefinitionScope.java

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

42
 		output.append(definition.name);
42
 		output.append(definition.name);
43
 		FormattingUtils.formatTypeParameters(output, definition.genericParameters, typeFormatter);
43
 		FormattingUtils.formatTypeParameters(output, definition.genericParameters, typeFormatter);
44
 		output.append(" ");
44
 		output.append(" ");
45
-		if (definition.superType != null) {
45
+		if (definition.getSuperType() != null) {
46
 			output.append("extends ");
46
 			output.append("extends ");
47
-			output.append(definition.superType.accept(typeFormatter));
47
+			output.append(definition.getSuperType().accept(typeFormatter));
48
 			output.append(" ");
48
 			output.append(" ");
49
 		}
49
 		}
50
 		if (settings.classBracketOnSameLine) {
50
 		if (settings.classBracketOnSameLine) {

+ 13
- 9
CodeFormatter/src/main/java/org/openzen/zenscript/formatter/TypeFormatter.java View File

13
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
13
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
14
 import org.openzen.zenscript.codemodel.type.AssocTypeID;
14
 import org.openzen.zenscript.codemodel.type.AssocTypeID;
15
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
15
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
16
-import org.openzen.zenscript.codemodel.type.ConstTypeID;
16
+import org.openzen.zenscript.codemodel.type.ModifiedTypeID;
17
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
17
 import org.openzen.zenscript.codemodel.type.DefinitionTypeID;
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;
21
 import org.openzen.zenscript.codemodel.type.ITypeID;
21
 import org.openzen.zenscript.codemodel.type.ITypeID;
22
 import org.openzen.zenscript.codemodel.type.ITypeVisitor;
22
 import org.openzen.zenscript.codemodel.type.ITypeVisitor;
23
 import org.openzen.zenscript.codemodel.type.IteratorTypeID;
23
 import org.openzen.zenscript.codemodel.type.IteratorTypeID;
24
-import org.openzen.zenscript.codemodel.type.OptionalTypeID;
25
 import org.openzen.zenscript.codemodel.type.RangeTypeID;
24
 import org.openzen.zenscript.codemodel.type.RangeTypeID;
25
+import org.openzen.zenscript.codemodel.type.member.TypeMembers;
26
 import stdlib.Chars;
26
 import stdlib.Chars;
27
 
27
 
28
 /**
28
 /**
102
 	}
102
 	}
103
 
103
 
104
 	@Override
104
 	@Override
105
-	public String visitConst(ConstTypeID type) {
106
-		return "const " + type.accept(this);
107
-	}
108
-
109
-	@Override
110
-	public String visitOptional(OptionalTypeID optional) {
111
-		return optional.baseType.accept(this) + "?";
105
+	public String visitModified(ModifiedTypeID type) {
106
+		StringBuilder result = new StringBuilder();
107
+		if ((type.modifiers & TypeMembers.MODIFIER_CONST) > 0)
108
+			result.append("const ");
109
+		if ((type.modifiers & TypeMembers.MODIFIER_IMMUTABLE) > 0)
110
+			result.append("immutable ");
111
+		result.append(type.accept(this));
112
+		if ((type.modifiers & TypeMembers.MODIFIER_OPTIONAL) > 0)
113
+			result.append("?");
114
+		
115
+		return result.toString();
112
 	}
116
 	}
113
 
117
 
114
 	@Override
118
 	@Override

+ 21
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionHeader.java View File

17
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
17
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
18
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.ITypeID;
19
 import org.openzen.zenscript.codemodel.scope.TypeScope;
19
 import org.openzen.zenscript.codemodel.scope.TypeScope;
20
-import org.openzen.zenscript.codemodel.type.GenericTypeID;
21
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
20
 import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
22
 
21
 
23
 /**
22
 /**
97
 		hasUnknowns = hasUnknowns(parameters);
96
 		hasUnknowns = hasUnknowns(parameters);
98
 	}
97
 	}
99
 	
98
 	
99
+	public boolean isDenormalized() {
100
+		if (returnType.getNormalized() != returnType)
101
+			return true;
102
+		for (FunctionParameter parameter : parameters)
103
+			if (parameter.type.getNormalized() != parameter.type)
104
+				return true;
105
+		
106
+		return false;
107
+	}
108
+	
109
+	public FunctionHeader normalize(GlobalTypeRegistry registry) {
110
+		if (!isDenormalized())
111
+			return this;
112
+		
113
+		FunctionParameter[] normalizedParameters = new FunctionParameter[parameters.length];
114
+		for (int i = 0; i < normalizedParameters.length; i++)
115
+			normalizedParameters[i] = parameters[i].normalized(registry);
116
+		return new FunctionHeader(typeParameters, returnType.getNormalized(), thrownType == null ? null : thrownType.getNormalized(), normalizedParameters);
117
+	}
118
+	
100
 	public int getNumberOfTypeParameters() {
119
 	public int getNumberOfTypeParameters() {
101
 		return typeParameters.length;
120
 		return typeParameters.length;
102
 	}
121
 	}
114
 		} else {
133
 		} else {
115
 			Map<TypeParameter, ITypeID> mapping = new HashMap<>();
134
 			Map<TypeParameter, ITypeID> mapping = new HashMap<>();
116
 			for (int i = 0; i < overridden.typeParameters.length; i++)
135
 			for (int i = 0; i < overridden.typeParameters.length; i++)
117
-				mapping.put(overridden.typeParameters[i], new GenericTypeID(typeParameters[i]));
136
+				mapping.put(overridden.typeParameters[i], registry.getGeneric(typeParameters[i]));
118
 			mapper = new GenericMapper(registry, mapping);
137
 			mapper = new GenericMapper(registry, mapping);
119
 		}
138
 		}
120
 		
139
 		

+ 7
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionParameter.java View File

9
 import java.util.Objects;
9
 import java.util.Objects;
10
 import org.openzen.zencode.shared.Taggable;
10
 import org.openzen.zencode.shared.Taggable;
11
 import org.openzen.zenscript.codemodel.expression.Expression;
11
 import org.openzen.zenscript.codemodel.expression.Expression;
12
+import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
12
 import org.openzen.zenscript.codemodel.type.ITypeID;
13
 import org.openzen.zenscript.codemodel.type.ITypeID;
13
 
14
 
14
 /**
15
 /**
48
 		this.variadic = variadic;
49
 		this.variadic = variadic;
49
 	}
50
 	}
50
 	
51
 	
52
+	public FunctionParameter normalized(GlobalTypeRegistry registry) {
53
+		FunctionParameter result = new FunctionParameter(type.getNormalized(), name, defaultValue, variadic);
54
+		result.annotations = this.annotations;
55
+		return result;
56
+	}
57
+	
51
 	public FunctionParameter withGenericArguments(GenericMapper mapper) {
58
 	public FunctionParameter withGenericArguments(GenericMapper mapper) {
52
 		ITypeID instanced = type.instance(mapper);
59
 		ITypeID instanced = type.instance(mapper);
53
 		if (instanced == type)
60
 		if (instanced == type)

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

10
 import org.openzen.zencode.shared.CodePosition;
10
 import org.openzen.zencode.shared.CodePosition;
11
 import org.openzen.zencode.shared.Taggable;
11
 import org.openzen.zencode.shared.Taggable;
12
 import org.openzen.zenscript.codemodel.annotations.DefinitionAnnotation;
12
 import org.openzen.zenscript.codemodel.annotations.DefinitionAnnotation;
13
+import org.openzen.zenscript.codemodel.definition.AliasDefinition;
13
 import org.openzen.zenscript.codemodel.definition.DefinitionVisitor;
14
 import org.openzen.zenscript.codemodel.definition.DefinitionVisitor;
15
+import org.openzen.zenscript.codemodel.definition.InterfaceDefinition;
14
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
16
 import org.openzen.zenscript.codemodel.definition.ZSPackage;
15
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
17
 import org.openzen.zenscript.codemodel.generic.TypeParameter;
16
 import org.openzen.zenscript.codemodel.member.ConstructorMember;
18
 import org.openzen.zenscript.codemodel.member.ConstructorMember;
19
+import org.openzen.zenscript.codemodel.member.DestructorMember;
17
 import org.openzen.zenscript.codemodel.member.FieldMember;
20
 import org.openzen.zenscript.codemodel.member.FieldMember;
18
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
21
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
22
+import org.openzen.zenscript.codemodel.member.ImplementationMember;
23
+import org.openzen.zenscript.codemodel.scope.TypeScope;
19
 import org.openzen.zenscript.codemodel.type.ITypeID;
24
 import org.openzen.zenscript.codemodel.type.ITypeID;
20
 
25
 
21
 /**
26
 /**
28
 	public final String name;
33
 	public final String name;
29
 	public final int modifiers;
34
 	public final int modifiers;
30
 	public final List<IDefinitionMember> members = new ArrayList<>();
35
 	public final List<IDefinitionMember> members = new ArrayList<>();
31
-	public TypeParameter[] genericParameters = null;
36
+	public TypeParameter[] genericParameters = TypeParameter.NONE;
32
 	public DefinitionAnnotation[] annotations = DefinitionAnnotation.NONE;
37
 	public DefinitionAnnotation[] annotations = DefinitionAnnotation.NONE;
33
 	
38
 	
34
 	public HighLevelDefinition outerDefinition;
39
 	public HighLevelDefinition outerDefinition;
35
-	public ITypeID superType;
40
+	private ITypeID superType;
41
+	
42
+	private boolean isDestructible = false;
36
 	
43
 	
37
 	public HighLevelDefinition(CodePosition position, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
44
 	public HighLevelDefinition(CodePosition position, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
38
 		this.position = position;
45
 		this.position = position;
45
 			pkg.register(this);
52
 			pkg.register(this);
46
 	}
53
 	}
47
 	
54
 	
55
+	public HighLevelDefinition getOutermost() {
56
+		HighLevelDefinition result = this;
57
+		while (result.outerDefinition != null)
58
+			result = result.outerDefinition;
59
+		return result;
60
+	}
61
+	
48
 	public String getFullName() {
62
 	public String getFullName() {
49
 		return pkg.fullName + '.' + name;
63
 		return pkg.fullName + '.' + name;
50
 	}
64
 	}
51
 	
65
 	
66
+	public ITypeID getSuperType() {
67
+		return superType;
68
+	}
69
+	
70
+	public void setSuperType(ITypeID superType) {
71
+		this.superType = superType;
72
+		if (outerDefinition != null)
73
+			isDestructible |= outerDefinition.isDestructible;
74
+	}
75
+	
52
 	public int getNumberOfGenericParameters() {
76
 	public int getNumberOfGenericParameters() {
53
 		return genericParameters == null ? 0 : genericParameters.length;
77
 		return genericParameters == null ? 0 : genericParameters.length;
54
 	}
78
 	}
61
 		return outerDefinition != null;
85
 		return outerDefinition != null;
62
 	}
86
 	}
63
 	
87
 	
88
+	public boolean isInterface() {
89
+		return this instanceof InterfaceDefinition;
90
+	}
91
+	
92
+	public boolean isAlias() {
93
+		return this instanceof AliasDefinition;
94
+	}
95
+	
64
 	public void addMember(IDefinitionMember member) {
96
 	public void addMember(IDefinitionMember member) {
65
 		if (!members.contains(member))
97
 		if (!members.contains(member))
66
 			members.add(member);
98
 			members.add(member);
67
 	}
99
 	}
68
 	
100
 	
101
+	public boolean isDestructible() {
102
+		boolean isDestructible = false;
103
+		for (IDefinitionMember member : members) {
104
+			if (member instanceof DestructorMember)
105
+				isDestructible = true;
106
+			if ((member instanceof FieldMember) && ((FieldMember)member).type.isDestructible())
107
+				isDestructible = true;
108
+			if ((member instanceof ImplementationMember) && ((ImplementationMember)member).type.isDestructible())
109
+				isDestructible = true;
110
+		}
111
+		return isDestructible;
112
+	}
113
+	
69
 	public void setTypeParameters(TypeParameter[] typeParameters) {
114
 	public void setTypeParameters(TypeParameter[] typeParameters) {
70
 		this.genericParameters = typeParameters;
115
 		this.genericParameters = typeParameters;
71
 	}
116
 	}
94
 		return (modifiers & Modifiers.STATIC) > 0;
139
 		return (modifiers & Modifiers.STATIC) > 0;
95
 	}
140
 	}
96
 	
141
 	
142
+	public void normalize(TypeScope scope) {
143
+		for (IDefinitionMember member : members) {
144
+			member.normalize(scope);
145
+		}
146
+	}
147
+	
97
 	public abstract <T> T accept(DefinitionVisitor<T> visitor);
148
 	public abstract <T> T accept(DefinitionVisitor<T> visitor);
98
 }
149
 }

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

164
 
164
 
165
 		@Override
165
 		@Override
166
 		public Void visitCustomIterator(CustomIteratorMember member) {
166
 		public Void visitCustomIterator(CustomIteratorMember member) {
167
-			throw new UnsupportedOperationException("Not supported yet!");
167
+			return functional(member);
168
 		}
168
 		}
169
 
169
 
170
 		@Override
170
 		@Override

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/AliasDefinition.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.HighLevelDefinition;
9
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 
12
 
12
 /**
13
 /**
28
 	public <T> T accept(DefinitionVisitor<T> visitor) {
29
 	public <T> T accept(DefinitionVisitor<T> visitor) {
29
 		return visitor.visitAlias(this);
30
 		return visitor.visitAlias(this);
30
 	}
31
 	}
32
+
33
+	@Override
34
+	public void normalize(TypeScope scope) {
35
+		// nothing to do
36
+	}
31
 }
37
 }

+ 1
- 4
CodeModel/src/main/java/org/openzen/zenscript/codemodel/definition/ClassDefinition.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.HighLevelDefinition;
9
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 
12
 
12
 /**
13
 /**
21
 	public ClassDefinition(CodePosition position, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
22
 	public ClassDefinition(CodePosition position, ZSPackage pkg, String name, int modifiers, HighLevelDefinition outerDefinition) {
22
 		super(position, pkg, name, modifiers, outerDefinition);
23
 		super(position, pkg, name, modifiers, outerDefinition);
23
 	}
24
 	}
24
-	
25
-	public void setSuperclass(ITypeID superclass) {
26
-		this.superType = superclass;
27
-	}
28
 
25
 
29
 	@Override
26
 	@Override
30
 	public <T> T accept(DefinitionVisitor<T> visitor) {
27
 	public <T> T accept(DefinitionVisitor<T> visitor) {

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

9
 import java.util.List;
9
 import java.util.List;
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.Modifiers;
12
 import org.openzen.zenscript.codemodel.type.ITypeID;
13
 import org.openzen.zenscript.codemodel.type.ITypeID;
13
 
14
 
14
 /**
15
 /**

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
36
 				? this
37
 				? this
37
 				: new AndAndExpression(position, tLeft, tRight);
38
 				: new AndAndExpression(position, tLeft, tRight);
38
 	}
39
 	}
40
+
41
+	@Override
42
+	public Expression normalize(TypeScope scope) {
43
+		return new AndAndExpression(position, left.normalize(scope), right.normalize(scope));
44
+	}
39
 }
45
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ArrayTypeID;
10
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
10
 
11
 
11
 /**
12
 /**
33
 		Expression[] tExpressions = Expression.transform(expressions, transformer);
34
 		Expression[] tExpressions = Expression.transform(expressions, transformer);
34
 		return tExpressions == expressions ? this : new ArrayExpression(position, tExpressions, (ArrayTypeID)type);
35
 		return tExpressions == expressions ? this : new ArrayExpression(position, tExpressions, (ArrayTypeID)type);
35
 	}
36
 	}
37
+
38
+	@Override
39
+	public Expression normalize(TypeScope scope) {
40
+		Expression[] normalized = new Expression[expressions.length];
41
+		for (int i = 0; i < normalized.length; i++)
42
+			normalized[i] = expressions[i].normalize(scope);
43
+		return new ArrayExpression(position, normalized, arrayType.getNormalized());
44
+	}
36
 }
45
 }

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

20
 	public final CallArguments arguments;
20
 	public final CallArguments arguments;
21
 	public final FunctionHeader instancedHeader;
21
 	public final FunctionHeader instancedHeader;
22
 	
22
 	
23
-	public CallExpression(CodePosition position, Expression target, FunctionalMemberRef member, FunctionHeader instancedHeader, CallArguments arguments, TypeScope scope) {
23
+	public CallExpression(CodePosition position, Expression target, FunctionalMemberRef member, FunctionHeader instancedHeader, CallArguments arguments) {
24
 		super(position, instancedHeader.returnType, multiThrow(position, arguments.arguments));
24
 		super(position, instancedHeader.returnType, multiThrow(position, arguments.arguments));
25
 		
25
 		
26
 		this.target = target;
26
 		this.target = target;
27
 		this.member = member;
27
 		this.member = member;
28
-		this.arguments = scope == null ? arguments : arguments.normalize(position, scope, instancedHeader);
28
+		this.arguments = arguments;
29
 		this.instancedHeader = instancedHeader;
29
 		this.instancedHeader = instancedHeader;
30
 	}
30
 	}
31
 	
31
 	
44
 		CallArguments tArguments = arguments.transform(transformer);
44
 		CallArguments tArguments = arguments.transform(transformer);
45
 		return tTarget == target && tArguments == arguments
45
 		return tTarget == target && tArguments == arguments
46
 				? this
46
 				? this
47
-				: new CallExpression(position, tTarget, member, instancedHeader, tArguments, null);
47
+				: new CallExpression(position, tTarget, member, instancedHeader, tArguments);
48
 	}
48
 	}
49
 	
49
 	
50
 	@Override
50
 	@Override
59
 				throw new UnsupportedOperationException("Cannot evaluate to a string constant!");
59
 				throw new UnsupportedOperationException("Cannot evaluate to a string constant!");
60
 		}
60
 		}
61
 	}
61
 	}
62
+
63
+	@Override
64
+	public Expression normalize(TypeScope scope) {
65
+		return new CallExpression(
66
+				position,
67
+				target.normalize(scope),
68
+				member,
69
+				instancedHeader.normalize(scope.getTypeRegistry()),
70
+				arguments.normalize(position, scope, instancedHeader));
71
+	}
62
 }
72
 }

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

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, TypeScope scope) {
24
+	public CallStaticExpression(CodePosition position, ITypeID target, FunctionalMemberRef member, FunctionHeader instancedHeader, CallArguments arguments) {
25
 		super(position, instancedHeader.returnType, multiThrow(position, arguments.arguments));
25
 		super(position, instancedHeader.returnType, multiThrow(position, arguments.arguments));
26
 		
26
 		
27
 		this.member = member;
27
 		this.member = member;
28
 		this.target = target;
28
 		this.target = target;
29
-		this.arguments = scope == null ? arguments : arguments.normalize(position, scope, instancedHeader);
29
+		this.arguments = arguments;
30
 		this.instancedHeader = instancedHeader;
30
 		this.instancedHeader = instancedHeader;
31
 	}
31
 	}
32
 
32
 
38
 	@Override
38
 	@Override
39
 	public Expression transform(ExpressionTransformer transformer) {
39
 	public Expression transform(ExpressionTransformer transformer) {
40
 		CallArguments tArguments = arguments.transform(transformer);
40
 		CallArguments tArguments = arguments.transform(transformer);
41
-		return arguments == tArguments ? this : new CallStaticExpression(position, target, member, instancedHeader, tArguments, null);
41
+		return arguments == tArguments ? this : new CallStaticExpression(position, target, member, instancedHeader, tArguments);
42
+	}
43
+
44
+	@Override
45
+	public Expression normalize(TypeScope scope) {
46
+		return new CallStaticExpression(
47
+				position,
48
+				target.getNormalized(),
49
+				member,
50
+				instancedHeader.normalize(scope.getTypeRegistry()),
51
+				arguments.normalize(position, scope, instancedHeader));
42
 	}
52
 	}
43
 }
53
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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
 
10
 
10
 /**
11
 /**
11
  *
12
  *
39
 			return tValue == value ? this : new CapturedClosureExpression(position, (CapturedExpression)tValue, closure);
40
 			return tValue == value ? this : new CapturedClosureExpression(position, (CapturedExpression)tValue, closure);
40
 		}
41
 		}
41
 	}
42
 	}
43
+
44
+	@Override
45
+	public CapturedExpression normalize(TypeScope scope) {
46
+		return new CapturedClosureExpression(position, value.normalize(scope), closure);
47
+	}
42
 }
48
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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
 
10
 
10
 /**
11
 /**
11
  *
12
  *
34
 		Expression tValue = transformer.transform(value);
35
 		Expression tValue = transformer.transform(value);
35
 		return tValue == value ? this : new CapturedDirectExpression(position, closure, tValue);
36
 		return tValue == value ? this : new CapturedDirectExpression(position, closure, tValue);
36
 	}
37
 	}
38
+
39
+	@Override
40
+	public CapturedExpression normalize(TypeScope scope) {
41
+		return new CapturedDirectExpression(position, closure, value.normalize(scope));
42
+	}
37
 }
43
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
28
 		return result;
29
 		return result;
29
 	}
30
 	}
30
 	
31
 	
32
+	@Override
33
+	public abstract CapturedExpression normalize(TypeScope scope);
34
+	
31
 	public abstract <T> T accept(CapturedExpressionVisitor<T> visitor);
35
 	public abstract <T> T accept(CapturedExpressionVisitor<T> visitor);
32
 }
36
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.statement.VarStatement;
10
 import org.openzen.zenscript.codemodel.statement.VarStatement;
10
 
11
 
11
 /**
12
 /**
35
 	public Expression transform(ExpressionTransformer transformer) {
36
 	public Expression transform(ExpressionTransformer transformer) {
36
 		return this;
37
 		return this;
37
 	}
38
 	}
39
+
40
+	@Override
41
+	public CapturedExpression normalize(TypeScope scope) {
42
+		return this;
43
+	}
38
 }
44
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CapturedParameterExpression.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.FunctionParameter;
9
 import org.openzen.zenscript.codemodel.FunctionParameter;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
35
 	public Expression transform(ExpressionTransformer transformer) {
36
 	public Expression transform(ExpressionTransformer transformer) {
36
 		return this;
37
 		return this;
37
 	}
38
 	}
39
+
40
+	@Override
41
+	public CapturedExpression normalize(TypeScope scope) {
42
+		return this;
43
+	}
38
 }
44
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
31
 	public Expression transform(ExpressionTransformer transformer) {
32
 	public Expression transform(ExpressionTransformer transformer) {
32
 		return this;
33
 		return this;
33
 	}
34
 	}
35
+
36
+	@Override
37
+	public CapturedExpression normalize(TypeScope scope) {
38
+		return this;
39
+	}
34
 }
40
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/CastExpression.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.member.ref.CasterMemberRef;
9
 import org.openzen.zenscript.codemodel.member.ref.CasterMemberRef;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
35
 		Expression tTarget = target.transform(transformer);
36
 		Expression tTarget = target.transform(transformer);
36
 		return target == tTarget ? this : new CastExpression(position, tTarget, member, isImplicit);
37
 		return target == tTarget ? this : new CastExpression(position, tTarget, member, isImplicit);
37
 	}
38
 	}
39
+
40
+	@Override
41
+	public Expression normalize(TypeScope scope) {
42
+		return new CastExpression(position, target.normalize(scope), member, isImplicit);
43
+	}
38
 }
44
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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
 
10
 
10
 /**
11
 /**
11
  * Converts a value from X? to X. Throws a NullPointerException if the value is null.
12
  * Converts a value from X? to X. Throws a NullPointerException if the value is null.
31
 		Expression tValue = transformer.transform(value);
32
 		Expression tValue = transformer.transform(value);
32
 		return value == tValue ? this : new CheckNullExpression(position, tValue);
33
 		return value == tValue ? this : new CheckNullExpression(position, tValue);
33
 	}
34
 	}
35
+
36
+	@Override
37
+	public Expression normalize(TypeScope scope) {
38
+		return new CheckNullExpression(position, value.normalize(scope));
39
+	}
34
 }
40
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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
 
10
 
10
 /**
11
 /**
11
  *
12
  *
33
 		Expression tRight = right.transform(transformer);
34
 		Expression tRight = right.transform(transformer);
34
 		return tLeft == left && tRight == right ? this : new CoalesceExpression(position, tLeft, tRight);
35
 		return tLeft == left && tRight == right ? this : new CoalesceExpression(position, tLeft, tRight);
35
 	}
36
 	}
37
+
38
+	@Override
39
+	public Expression normalize(TypeScope scope) {
40
+		return new CoalesceExpression(position, left.normalize(scope), right.normalize(scope));
41
+	}
36
 }
42
 }

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

43
 		Expression tRight = right.transform(transformer);
43
 		Expression tRight = right.transform(transformer);
44
 		return left == tLeft && right == tRight ? this : new CompareExpression(position, tLeft, tRight, operator, comparison, null);
44
 		return left == tLeft && right == tRight ? this : new CompareExpression(position, tLeft, tRight, operator, comparison, null);
45
 	}
45
 	}
46
+
47
+	@Override
48
+	public Expression normalize(TypeScope scope) {
49
+		return new CompareExpression(position, left.normalize(scope), right.normalize(scope), operator, comparison, scope);
50
+	}
46
 }
51
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
47
 				? this
48
 				? this
48
 				: new ConditionalExpression(position, tCondition, tIfThen, tIfElse, type);
49
 				: new ConditionalExpression(position, tCondition, tIfThen, tIfElse, type);
49
 	}
50
 	}
51
+
52
+	@Override
53
+	public Expression normalize(TypeScope scope) {
54
+		return new ConditionalExpression(position, condition.normalize(scope), ifThen.normalize(scope), ifElse.normalize(scope), type.getNormalized());
55
+	}
50
 }
56
 }

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

9
 import org.openzen.zenscript.codemodel.member.EnumConstantMember;
9
 import org.openzen.zenscript.codemodel.member.EnumConstantMember;
10
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
10
 import org.openzen.zenscript.codemodel.member.IDefinitionMember;
11
 import org.openzen.zenscript.codemodel.member.ref.ConstMemberRef;
11
 import org.openzen.zenscript.codemodel.member.ref.ConstMemberRef;
12
+import org.openzen.zenscript.codemodel.scope.TypeScope;
12
 
13
 
13
 /**
14
 /**
14
  *
15
  *
18
 	public final ConstMemberRef constant;
19
 	public final ConstMemberRef constant;
19
 	
20
 	
20
 	public ConstExpression(CodePosition position, ConstMemberRef constant) {
21
 	public ConstExpression(CodePosition position, ConstMemberRef constant) {
21
-		super(position, constant.type, null);
22
+		super(position, constant.getType(), null);
22
 		
23
 		
23
 		this.constant = constant;
24
 		this.constant = constant;
24
 	}
25
 	}
47
 	public IDefinitionMember getMember() {
48
 	public IDefinitionMember getMember() {
48
 		return constant.member;
49
 		return constant.member;
49
 	}
50
 	}
51
+
52
+	@Override
53
+	public Expression normalize(TypeScope scope) {
54
+		return this;
55
+	}
50
 }
56
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
35
 	public String evaluateStringConstant() {
36
 	public String evaluateStringConstant() {
36
 		return value;
37
 		return value;
37
 	}
38
 	}
39
+
40
+	@Override
41
+	public Expression normalize(TypeScope scope) {
42
+		return this;
43
+	}
38
 }
44
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

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

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, TypeScope scope) {
23
+	public ConstructorSuperCallExpression(CodePosition position, ITypeID type, FunctionalMemberRef constructor, CallArguments arguments) {
24
 		super(position, BasicTypeID.VOID, binaryThrow(position, constructor.header.thrownType, multiThrow(position, arguments.arguments)));
24
 		super(position, BasicTypeID.VOID, binaryThrow(position, constructor.header.thrownType, multiThrow(position, arguments.arguments)));
25
 		
25
 		
26
 		this.objectType = type;
26
 		this.objectType = type;
27
 		this.constructor = constructor;
27
 		this.constructor = constructor;
28
-		this.arguments = scope == null ? arguments : arguments.normalize(position, scope, constructor.header);
28
+		this.arguments = arguments;
29
 	}
29
 	}
30
 
30
 
31
 	@Override
31
 	@Override
36
 	@Override
36
 	@Override
37
 	public Expression transform(ExpressionTransformer transformer) {
37
 	public Expression transform(ExpressionTransformer transformer) {
38
 		CallArguments tArguments = arguments.transform(transformer);
38
 		CallArguments tArguments = arguments.transform(transformer);
39
-		return tArguments == arguments ? this : new ConstructorSuperCallExpression(position, type, constructor, tArguments, null);
39
+		return tArguments == arguments ? this : new ConstructorSuperCallExpression(position, type, constructor, tArguments);
40
+	}
41
+
42
+	@Override
43
+	public Expression normalize(TypeScope scope) {
44
+		return new ConstructorSuperCallExpression(position, type.getNormalized(), constructor, arguments.normalize(position, scope, constructor.header));
40
 	}
45
 	}
41
 }
46
 }

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

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, TypeScope scope) {
23
+	public ConstructorThisCallExpression(CodePosition position, ITypeID type, FunctionalMemberRef constructor, CallArguments arguments) {
24
 		super(position, BasicTypeID.VOID, binaryThrow(position, constructor.header.thrownType, multiThrow(position, arguments.arguments)));
24
 		super(position, BasicTypeID.VOID, binaryThrow(position, constructor.header.thrownType, multiThrow(position, arguments.arguments)));
25
 		
25
 		
26
 		this.objectType = type;
26
 		this.objectType = type;
27
 		this.constructor = constructor;
27
 		this.constructor = constructor;
28
-		this.arguments = scope == null ? arguments : arguments.normalize(position, scope, constructor.header);
28
+		this.arguments = arguments;
29
 	}
29
 	}
30
 
30
 
31
 	@Override
31
 	@Override
36
 	@Override
36
 	@Override
37
 	public Expression transform(ExpressionTransformer transformer) {
37
 	public Expression transform(ExpressionTransformer transformer) {
38
 		CallArguments tArguments = arguments.transform(transformer);
38
 		CallArguments tArguments = arguments.transform(transformer);
39
-		return tArguments == arguments ? this : new ConstructorThisCallExpression(position, type, constructor, tArguments, null);
39
+		return tArguments == arguments ? this : new ConstructorThisCallExpression(position, type, constructor, tArguments);
40
+	}
41
+
42
+	@Override
43
+	public Expression normalize(TypeScope scope) {
44
+		return new ConstructorThisCallExpression(position, type, constructor, arguments.normalize(position, scope, constructor.header));
40
 	}
45
 	}
41
 }
46
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
26
 	public Expression transform(ExpressionTransformer transformer) {
27
 	public Expression transform(ExpressionTransformer transformer) {
27
 		throw new UnsupportedOperationException("This is a dummy expression");
28
 		throw new UnsupportedOperationException("This is a dummy expression");
28
 	}
29
 	}
30
+
31
+	@Override
32
+	public Expression normalize(TypeScope scope) {
33
+		return this;
34
+	}
29
 }
35
 }

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

8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
 import org.openzen.zenscript.codemodel.definition.EnumDefinition;
9
 import org.openzen.zenscript.codemodel.definition.EnumDefinition;
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.type.GlobalTypeRegistry;
12
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
12
 import org.openzen.zenscript.codemodel.type.ITypeID;
13
 import org.openzen.zenscript.codemodel.type.ITypeID;
13
 
14
 
44
 	public EnumConstantMember evaluateEnumConstant() {
45
 	public EnumConstantMember evaluateEnumConstant() {
45
 		return value;
46
 		return value;
46
 	}
47
 	}
48
+
49
+	@Override
50
+	public Expression normalize(TypeScope scope) {
51
+		return this;
52
+	}
47
 }
53
 }

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

40
 		if (type == null)
40
 		if (type == null)
41
 			throw new NullPointerException();
41
 			throw new NullPointerException();
42
 		if (type == BasicTypeID.UNDETERMINED)
42
 		if (type == BasicTypeID.UNDETERMINED)
43
-			throw new IllegalArgumentException("Cannot use undetermined type as expression type");
43
+			throw new IllegalArgumentException(position + ": Cannot use undetermined type as expression type");
44
 		
44
 		
45
 		this.position = position;
45
 		this.position = position;
46
-		this.type = type;
46
+		this.type = type.getNormalized();
47
 		this.thrownType = thrownType;
47
 		this.thrownType = thrownType;
48
 	}
48
 	}
49
 	
49
 	
66
 		});
66
 		});
67
 	}
67
 	}
68
 	
68
 	
69
+	public abstract Expression normalize(TypeScope scope);
70
+	
69
 	@Override
71
 	@Override
70
 	public List<ITypeID> getAssignHints() {
72
 	public List<ITypeID> getAssignHints() {
71
 		return Collections.singletonList(type);
73
 		return Collections.singletonList(type);

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

59
 				type,
59
 				type,
60
 				member,
60
 				member,
61
 				compiledArguments,
61
 				compiledArguments,
62
-				compiledArguments.getNumberOfTypeArguments() == 0 ? member.header : member.header.fillGenericArguments(scope.getTypeRegistry(), compiledArguments.typeArguments),
63
-				scope);
62
+				compiledArguments.getNumberOfTypeArguments() == 0 ? member.header : member.header.fillGenericArguments(scope.getTypeRegistry(), compiledArguments.typeArguments));
64
 	}
63
 	}
65
 	
64
 	
66
 	public Expression not(Expression value) {
65
 	public Expression not(Expression value) {

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

12
 import org.openzen.zencode.shared.ConcatMap;
12
 import org.openzen.zencode.shared.ConcatMap;
13
 import org.openzen.zenscript.codemodel.FunctionHeader;
13
 import org.openzen.zenscript.codemodel.FunctionHeader;
14
 import org.openzen.zenscript.codemodel.FunctionParameter;
14
 import org.openzen.zenscript.codemodel.FunctionParameter;
15
+import org.openzen.zenscript.codemodel.scope.TypeScope;
15
 import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
16
 import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
16
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
17
 import org.openzen.zenscript.codemodel.statement.LoopStatement;
17
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
18
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
74
 			return null;
75
 			return null;
75
 		}
76
 		}
76
 	}
77
 	}
78
+
79
+	@Override
80
+	public Expression normalize(TypeScope scope) {
81
+		return new FunctionExpression(position, (FunctionTypeID)type, closure, header, body.normalize(scope, ConcatMap.empty(LoopStatement.class, LoopStatement.class)));
82
+	}
77
 	
83
 	
78
 	private static class ReturnExpressionTransformer implements ExpressionTransformer {
84
 	private static class ReturnExpressionTransformer implements ExpressionTransformer {
79
 		private final LambdaClosure closure;
85
 		private final LambdaClosure closure;

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

58
 	public IDefinitionMember getMember() {
58
 	public IDefinitionMember getMember() {
59
 		return field.member;
59
 		return field.member;
60
 	}
60
 	}
61
+
62
+	@Override
63
+	public Expression normalize(TypeScope scope) {
64
+		return new GetFieldExpression(position, target.normalize(scope), field);
65
+	}
61
 }
66
 }

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

43
 	public Expression transform(ExpressionTransformer transformer) {
43
 	public Expression transform(ExpressionTransformer transformer) {
44
 		return this;
44
 		return this;
45
 	}
45
 	}
46
+
47
+	@Override
48
+	public Expression normalize(TypeScope scope) {
49
+		return this;
50
+	}
46
 }
51
 }

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

43
 	public Expression transform(ExpressionTransformer transformer) {
43
 	public Expression transform(ExpressionTransformer transformer) {
44
 		return this;
44
 		return this;
45
 	}
45
 	}
46
+
47
+	@Override
48
+	public Expression normalize(TypeScope scope) {
49
+		return this;
50
+	}
46
 }
51
 }

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

10
 import org.openzen.zencode.shared.CodePosition;
10
 import org.openzen.zencode.shared.CodePosition;
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.type.ITypeID;
14
 import org.openzen.zenscript.codemodel.type.ITypeID;
14
 
15
 
15
 /**
16
 /**
49
 	public IDefinitionMember getMember() {
50
 	public IDefinitionMember getMember() {
50
 		return field.member;
51
 		return field.member;
51
 	}
52
 	}
53
+
54
+	@Override
55
+	public Expression normalize(TypeScope scope) {
56
+		return this;
57
+	}
52
 }
58
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/GetterExpression.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.member.ref.GetterMemberRef;
9
 import org.openzen.zenscript.codemodel.member.ref.GetterMemberRef;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
33
 		Expression tTarget = target.transform(transformer);
34
 		Expression tTarget = target.transform(transformer);
34
 		return target == tTarget ? this : new GetterExpression(position, tTarget, getter);
35
 		return target == tTarget ? this : new GetterExpression(position, tTarget, getter);
35
 	}
36
 	}
37
+
38
+	@Override
39
+	public Expression normalize(TypeScope scope) {
40
+		return new GetterExpression(position, target.normalize(scope), getter);
41
+	}
36
 }
42
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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
 
10
 
10
 /**
11
 /**
11
  *
12
  *
35
 		Expression tResolution = resolution.transform(transformer);
36
 		Expression tResolution = resolution.transform(transformer);
36
 		return tArguments == arguments && tResolution == resolution ? this : new GlobalCallExpression(position, name, tArguments, tResolution);
37
 		return tArguments == arguments && tResolution == resolution ? this : new GlobalCallExpression(position, name, tArguments, tResolution);
37
 	}
38
 	}
39
+
40
+	@Override
41
+	public Expression normalize(TypeScope scope) {
42
+		return new GlobalCallExpression(position, name, arguments, resolution.normalize(scope));
43
+	}
38
 }
44
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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
 
10
 
10
 /**
11
 /**
11
  *
12
  *
32
 		Expression tResolution = resolution.transform(transformer);
33
 		Expression tResolution = resolution.transform(transformer);
33
 		return resolution == tResolution ? this : new GlobalExpression(position, name, resolution);
34
 		return resolution == tResolution ? this : new GlobalExpression(position, name, resolution);
34
 	}
35
 	}
36
+
37
+	@Override
38
+	public Expression normalize(TypeScope scope) {
39
+		return new GlobalExpression(position, name, resolution.normalize(scope));
40
+	}
35
 }
41
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
31
 		Expression tValue = value.transform(transformer);
32
 		Expression tValue = value.transform(transformer);
32
 		return value == tValue ? this : new InterfaceCastExpression(position, tValue, type);
33
 		return value == tValue ? this : new InterfaceCastExpression(position, tValue, type);
33
 	}
34
 	}
35
+
36
+	@Override
37
+	public Expression normalize(TypeScope scope) {
38
+		return new InterfaceCastExpression(position, value.normalize(scope), type.getNormalized());
39
+	}
34
 }
40
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 
12
 
34
 		Expression tValue = value.transform(transformer);
35
 		Expression tValue = value.transform(transformer);
35
 		return tValue == value ? this : new IsExpression(position, tValue, type);
36
 		return tValue == value ? this : new IsExpression(position, tValue, type);
36
 	}
37
 	}
38
+
39
+	@Override
40
+	public Expression normalize(TypeScope scope) {
41
+		return new IsExpression(position, value.normalize(scope), type.getNormalized());
42
+	}
37
 }
43
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
31
 		Expression tValue = value.transform(transformer);
32
 		Expression tValue = value.transform(transformer);
32
 		return tValue == value ? this : new MakeConstExpression(position, tValue, type);
33
 		return tValue == value ? this : new MakeConstExpression(position, tValue, type);
33
 	}
34
 	}
35
+
36
+	@Override
37
+	public Expression normalize(TypeScope scope) {
38
+		return new MakeConstExpression(position, value.normalize(scope), type.getNormalized());
39
+	}
34
 }
40
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
38
 		Expression[] tValues = Expression.transform(values, transformer);
39
 		Expression[] tValues = Expression.transform(values, transformer);
39
 		return tKeys == keys && tValues == values ? this : new MapExpression(position, tKeys, tValues, type);
40
 		return tKeys == keys && tValues == values ? this : new MapExpression(position, tKeys, tValues, type);
40
 	}
41
 	}
42
+
43
+	@Override
44
+	public Expression normalize(TypeScope scope) {
45
+		Expression[] normalizedKeys = new Expression[keys.length];
46
+		for (int i = 0; i < normalizedKeys.length; i++)
47
+			normalizedKeys[i] = keys[i].normalize(scope);
48
+		
49
+		Expression[] normalizedValues = new Expression[values.length];
50
+		for (int i = 0; i < normalizedValues.length; i++)
51
+			normalizedValues[i] = values[i].normalize(scope);
52
+		
53
+		return new MapExpression(position, normalizedKeys, normalizedValues, type.getNormalized());
54
+	}
41
 }
55
 }

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

10
 import java.util.List;
10
 import java.util.List;
11
 import org.openzen.zencode.shared.CodePosition;
11
 import org.openzen.zencode.shared.CodePosition;
12
 import org.openzen.zenscript.codemodel.expression.switchvalue.SwitchValue;
12
 import org.openzen.zenscript.codemodel.expression.switchvalue.SwitchValue;
13
+import org.openzen.zenscript.codemodel.scope.TypeScope;
13
 import org.openzen.zenscript.codemodel.statement.BreakStatement;
14
 import org.openzen.zenscript.codemodel.statement.BreakStatement;
14
 import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
15
 import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
15
 import org.openzen.zenscript.codemodel.statement.Statement;
16
 import org.openzen.zenscript.codemodel.statement.Statement;
50
 		}
51
 		}
51
 		return unmodified && tValue == value ? this : new MatchExpression(position, tValue, type, tCases);
52
 		return unmodified && tValue == value ? this : new MatchExpression(position, tValue, type, tCases);
52
 	}
53
 	}
54
+
55
+	@Override
56
+	public Expression normalize(TypeScope scope) {
57
+		Case[] normalizedCases = new Case[cases.length];
58
+		for (int i = 0; i < cases.length; i++)
59
+			normalizedCases[i] = cases[i].normalize(scope);
60
+		return new MatchExpression(position, value.normalize(scope), type, normalizedCases);
61
+	}
53
 	
62
 	
54
 	public SwitchedMatch convertToSwitch(String tempVariable) {
63
 	public SwitchedMatch convertToSwitch(String tempVariable) {
55
 		VarStatement result = new VarStatement(position, tempVariable, type, null, false);
64
 		VarStatement result = new VarStatement(position, tempVariable, type, null, false);
103
 			Expression tValue = value.transform(transformer);
112
 			Expression tValue = value.transform(transformer);
104
 			return tValue == value ? this : new Case(key, tValue);
113
 			return tValue == value ? this : new Case(key, tValue);
105
 		}
114
 		}
115
+		
116
+		public Case normalize(TypeScope scope) {
117
+			return new Case(key, value.normalize(scope));
118
+		}
106
 	}
119
 	}
107
 	
120
 	
108
 	private static ITypeID getThrownType(CodePosition position, Case[] cases) {
121
 	private static ITypeID getThrownType(CodePosition position, Case[] cases) {

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

26
 			FunctionalMemberRef constructor,
26
 			FunctionalMemberRef constructor,
27
 			CallArguments arguments)
27
 			CallArguments arguments)
28
 	{
28
 	{
29
-		super(position, type, binaryThrow(position, constructor.header.thrownType, multiThrow(position, arguments.arguments)));
30
-		
31
-		this.constructor = constructor;
32
-		this.arguments = arguments;
33
-		this.instancedHeader = constructor.header;
29
+		this(position, type, constructor, arguments, constructor.header);
34
 	}
30
 	}
35
 	
31
 	
36
 	public NewExpression(
32
 	public NewExpression(
38
 			ITypeID type,
34
 			ITypeID type,
39
 			FunctionalMemberRef constructor,
35
 			FunctionalMemberRef constructor,
40
 			CallArguments arguments,
36
 			CallArguments arguments,
41
-			FunctionHeader instancedHeader,
42
-			TypeScope scope)
37
+			FunctionHeader instancedHeader)
43
 	{
38
 	{
44
 		super(position, type, binaryThrow(position, constructor.header.thrownType, multiThrow(position, arguments.arguments)));
39
 		super(position, type, binaryThrow(position, constructor.header.thrownType, multiThrow(position, arguments.arguments)));
45
 		
40
 		
46
 		this.constructor = constructor;
41
 		this.constructor = constructor;
47
-		this.arguments = scope == null ? arguments : arguments.normalize(position, scope, instancedHeader);
42
+		this.arguments = arguments;
48
 		this.instancedHeader = instancedHeader;
43
 		this.instancedHeader = instancedHeader;
49
 	}
44
 	}
50
 
45
 
56
 	@Override
51
 	@Override
57
 	public Expression transform(ExpressionTransformer transformer) {
52
 	public Expression transform(ExpressionTransformer transformer) {
58
 		CallArguments tArguments = arguments.transform(transformer);
53
 		CallArguments tArguments = arguments.transform(transformer);
59
-		return tArguments == arguments ? this : new NewExpression(position, type, constructor, tArguments, instancedHeader, null);
54
+		return tArguments == arguments ? this : new NewExpression(position, type, constructor, tArguments, instancedHeader);
55
+	}
56
+
57
+	@Override
58
+	public Expression normalize(TypeScope scope) {
59
+		return new NewExpression(position, type.getNormalized(), constructor, arguments.normalize(position, scope, instancedHeader), instancedHeader);
60
 	}
60
 	}
61
 }
61
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 
12
 
31
 	public Expression transform(ExpressionTransformer transformer) {
32
 	public Expression transform(ExpressionTransformer transformer) {
32
 		return this;
33
 		return this;
33
 	}
34
 	}
35
+
36
+	@Override
37
+	public Expression normalize(TypeScope scope) {
38
+		return this;
39
+	}
34
 }
40
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
34
 		Expression tRight = right.transform(transformer);
35
 		Expression tRight = right.transform(transformer);
35
 		return tLeft == left && tRight == right ? this : new OrOrExpression(position, tLeft, tRight);
36
 		return tLeft == left && tRight == right ? this : new OrOrExpression(position, tLeft, tRight);
36
 	}
37
 	}
38
+
39
+	@Override
40
+	public Expression normalize(TypeScope scope) {
41
+		return new OrOrExpression(position, left.normalize(scope), right.normalize(scope));
42
+	}
37
 }
43
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
35
 	public Expression transform(ExpressionTransformer transformer) {
36
 	public Expression transform(ExpressionTransformer transformer) {
36
 		return new PanicExpression(position, type, transformer.transform(value));
37
 		return new PanicExpression(position, type, transformer.transform(value));
37
 	}
38
 	}
39
+
40
+	@Override
41
+	public Expression normalize(TypeScope scope) {
42
+		return new PanicExpression(position, type, value.normalize(scope));
43
+	}
38
 }
44
 }

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

9
 import org.openzen.zenscript.codemodel.FunctionHeader;
9
 import org.openzen.zenscript.codemodel.FunctionHeader;
10
 import org.openzen.zenscript.codemodel.OperatorType;
10
 import org.openzen.zenscript.codemodel.OperatorType;
11
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
11
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
12
+import org.openzen.zenscript.codemodel.scope.TypeScope;
12
 
13
 
13
 /**
14
 /**
14
  * Used for post-increment and post-decrement.
15
  * Used for post-increment and post-decrement.
41
 		Expression tTarget = target.transform(transformer);
42
 		Expression tTarget = target.transform(transformer);
42
 		return target == tTarget ? this : new PostCallExpression(position, tTarget, member, instancedHeader);
43
 		return target == tTarget ? this : new PostCallExpression(position, tTarget, member, instancedHeader);
43
 	}
44
 	}
45
+
46
+	@Override
47
+	public Expression normalize(TypeScope scope) {
48
+		return new PostCallExpression(position, target.normalize(scope), member, instancedHeader.normalize(scope.getTypeRegistry()));
49
+	}
44
 }
50
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.GlobalTypeRegistry;
10
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 
12
 
42
 		Expression tTo = to.transform(transformer);
43
 		Expression tTo = to.transform(transformer);
43
 		return tFrom == from && tTo == to ? this : new RangeExpression(position, type, tFrom, tTo, thrownType);
44
 		return tFrom == from && tTo == to ? this : new RangeExpression(position, type, tFrom, tTo, thrownType);
44
 	}
45
 	}
46
+
47
+	@Override
48
+	public Expression normalize(TypeScope scope) {
49
+		return new RangeExpression(position, scope.getTypeRegistry(), from.normalize(scope), to.normalize(scope));
50
+	}
45
 }
51
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.BasicTypeID;
10
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
10
 
11
 
11
 /**
12
 /**
36
 		Expression tRight = right.transform(transformer);
37
 		Expression tRight = right.transform(transformer);
37
 		return tLeft == left && tRight == right ? this : new SameObjectExpression(position, tLeft, tRight, inverted);
38
 		return tLeft == left && tRight == right ? this : new SameObjectExpression(position, tLeft, tRight, inverted);
38
 	}
39
 	}
40
+
41
+	@Override
42
+	public Expression normalize(TypeScope scope) {
43
+		return new SameObjectExpression(position, left.normalize(scope), right.normalize(scope), inverted);
44
+	}
39
 }
45
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetFieldExpression.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.member.ref.FieldMemberRef;
9
 import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
38
 				? this
39
 				? this
39
 				: new SetFieldExpression(position, tTarget, field, tValue);
40
 				: new SetFieldExpression(position, tTarget, field, tValue);
40
 	}
41
 	}
42
+
43
+	@Override
44
+	public Expression normalize(TypeScope scope) {
45
+		return new SetFieldExpression(position, target, field, value.normalize(scope));
46
+	}
41
 }
47
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetFunctionParameterExpression.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.FunctionParameter;
9
 import org.openzen.zenscript.codemodel.FunctionParameter;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
33
 		Expression tValue = value.transform(transformer);
34
 		Expression tValue = value.transform(transformer);
34
 		return tValue == value ? this : new SetFunctionParameterExpression(position, parameter, tValue);
35
 		return tValue == value ? this : new SetFunctionParameterExpression(position, parameter, tValue);
35
 	}
36
 	}
37
+
38
+	@Override
39
+	public Expression normalize(TypeScope scope) {
40
+		return new SetFunctionParameterExpression(position, parameter, value.normalize(scope));
41
+	}
36
 }
42
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.statement.VarStatement;
10
 import org.openzen.zenscript.codemodel.statement.VarStatement;
10
 
11
 
11
 /**
12
 /**
33
 		Expression tValue = value.transform(transformer);
34
 		Expression tValue = value.transform(transformer);
34
 		return tValue == value ? this : new SetLocalVariableExpression(position, variable, tValue);
35
 		return tValue == value ? this : new SetLocalVariableExpression(position, variable, tValue);
35
 	}
36
 	}
37
+
38
+	@Override
39
+	public Expression normalize(TypeScope scope) {
40
+		return new SetLocalVariableExpression(position, variable, value.normalize(scope));
41
+	}
36
 }
42
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetStaticFieldExpression.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.member.ref.FieldMemberRef;
9
 import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
33
 		Expression tValue = value.transform(transformer);
34
 		Expression tValue = value.transform(transformer);
34
 		return value == tValue ? this : new SetStaticFieldExpression(position, field, tValue);
35
 		return value == tValue ? this : new SetStaticFieldExpression(position, field, tValue);
35
 	}
36
 	}
37
+
38
+	@Override
39
+	public Expression normalize(TypeScope scope) {
40
+		return new SetStaticFieldExpression(position, field, value.normalize(scope));
41
+	}
36
 }
42
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/SetterExpression.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.member.ref.SetterMemberRef;
9
 import org.openzen.zenscript.codemodel.member.ref.SetterMemberRef;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
36
 		Expression tValue = value.transform(transformer);
37
 		Expression tValue = value.transform(transformer);
37
 		return tTarget == target && tValue == value ? this : new SetterExpression(position, tTarget, setter, tValue);
38
 		return tTarget == target && tValue == value ? this : new SetterExpression(position, tTarget, setter, tValue);
38
 	}
39
 	}
40
+
41
+	@Override
42
+	public Expression normalize(TypeScope scope) {
43
+		return new SetterExpression(position, target.normalize(scope), setter, value.normalize(scope));
44
+	}
39
 }
45
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/StaticGetterExpression.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.member.ref.GetterMemberRef;
9
 import org.openzen.zenscript.codemodel.member.ref.GetterMemberRef;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
30
 	public Expression transform(ExpressionTransformer transformer) {
31
 	public Expression transform(ExpressionTransformer transformer) {
31
 		return this;
32
 		return this;
32
 	}
33
 	}
34
+
35
+	@Override
36
+	public Expression normalize(TypeScope scope) {
37
+		return this;
38
+	}
33
 }
39
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/StaticSetterExpression.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.member.ref.SetterMemberRef;
9
 import org.openzen.zenscript.codemodel.member.ref.SetterMemberRef;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 
11
 
11
 /**
12
 /**
12
  *
13
  *
33
 		Expression tValue = value.transform(transformer);
34
 		Expression tValue = value.transform(transformer);
34
 		return tValue == value ? this : new StaticSetterExpression(position, setter, tValue);
35
 		return tValue == value ? this : new StaticSetterExpression(position, setter, tValue);
35
 	}
36
 	}
37
+
38
+	@Override
39
+	public Expression normalize(TypeScope scope) {
40
+		return new StaticSetterExpression(position, setter, value.normalize(scope));
41
+	}
36
 }
42
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
32
 		Expression tValue = value.transform(transformer);
33
 		Expression tValue = value.transform(transformer);
33
 		return tValue == value ? this : new SupertypeCastExpression(position, tValue, type);
34
 		return tValue == value ? this : new SupertypeCastExpression(position, tValue, type);
34
 	}
35
 	}
36
+
37
+	@Override
38
+	public Expression normalize(TypeScope scope) {
39
+		return new SupertypeCastExpression(position, value.normalize(scope), type.getNormalized());
40
+	}
35
 }
41
 }

+ 6
- 0
CodeModel/src/main/java/org/openzen/zenscript/codemodel/expression/ThisExpression.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.partial.IPartialExpression;
9
 import org.openzen.zenscript.codemodel.partial.IPartialExpression;
10
+import org.openzen.zenscript.codemodel.scope.TypeScope;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 import org.openzen.zenscript.codemodel.type.ITypeID;
11
 
12
 
12
 /**
13
 /**
34
 	public Expression transform(ExpressionTransformer transformer) {
35
 	public Expression transform(ExpressionTransformer transformer) {
35
 		return this;
36
 		return this;
36
 	}
37
 	}
38
+
39
+	@Override
40
+	public Expression normalize(TypeScope scope) {
41
+		return this;
42
+	}
37
 }
43
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
36
 		Expression tValue = transformer.transform(value);
37
 		Expression tValue = transformer.transform(value);
37
 		return tValue == value ? this : new ThrowExpression(position, type, value);
38
 		return tValue == value ? this : new ThrowExpression(position, type, value);
38
 	}
39
 	}
40
+
41
+	@Override
42
+	public Expression normalize(TypeScope scope) {
43
+		return new ThrowExpression(position, type, value.normalize(scope));
44
+	}
39
 }
45
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
31
 		Expression tValue = value.transform(transformer);
32
 		Expression tValue = value.transform(transformer);
32
 		return tValue == value ? this : new TryConvertExpression(position, type, tValue);
33
 		return tValue == value ? this : new TryConvertExpression(position, type, tValue);
33
 	}
34
 	}
35
+
36
+	@Override
37
+	public Expression normalize(TypeScope scope) {
38
+		return new TryConvertExpression(position, type, value.normalize(scope));
39
+	}
34
 }
40
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
31
 		Expression tValue = value.transform(transformer);
32
 		Expression tValue = value.transform(transformer);
32
 		return tValue == value ? this : new TryRethrowAsExceptionExpression(position, type, tValue, thrownType);
33
 		return tValue == value ? this : new TryRethrowAsExceptionExpression(position, type, tValue, thrownType);
33
 	}
34
 	}
35
+
36
+	@Override
37
+	public Expression normalize(TypeScope scope) {
38
+		return new TryRethrowAsExceptionExpression(position, type, value.normalize(scope), thrownType.getNormalized());
39
+	}
34
 }
40
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
31
 		Expression tValue = value.transform(transformer);
32
 		Expression tValue = value.transform(transformer);
32
 		return tValue == value ? this : new TryRethrowAsResultExpression(position, type, tValue);
33
 		return tValue == value ? this : new TryRethrowAsResultExpression(position, type, tValue);
33
 	}
34
 	}
35
+
36
+	@Override
37
+	public Expression normalize(TypeScope scope) {
38
+		return new TryRethrowAsResultExpression(position, type, value.normalize(scope));
39
+	}
34
 }
40
 }

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

52
 		Expression[] tArguments = Expression.transform(arguments, transformer);
52
 		Expression[] tArguments = Expression.transform(arguments, transformer);
53
 		return tArguments == arguments ? this : new VariantValueExpression(position, type, option, tArguments);
53
 		return tArguments == arguments ? this : new VariantValueExpression(position, type, option, tArguments);
54
 	}
54
 	}
55
+
56
+	@Override
57
+	public Expression normalize(TypeScope scope) {
58
+		Expression[] normalized = new Expression[arguments.length];
59
+		for (int i = 0; i < normalized.length; i++)
60
+			normalized[i] = arguments[i].normalize(scope);
61
+		return new VariantValueExpression(position, type, option, normalized);
62
+	}
55
 }
63
 }

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

6
 package org.openzen.zenscript.codemodel.expression;
6
 package org.openzen.zenscript.codemodel.expression;
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.type.ITypeID;
10
 import org.openzen.zenscript.codemodel.type.ITypeID;
10
 
11
 
11
 /**
12
 /**
34
 		Expression tValue = value.transform(transformer);
35
 		Expression tValue = value.transform(transformer);
35
 		return tValue == value ? this : new WrapOptionalExpression(position, tValue, type);
36
 		return tValue == value ? this : new WrapOptionalExpression(position, tValue, type);
36
 	}
37
 	}
38
+
39
+	@Override
40
+	public Expression normalize(TypeScope scope) {
41
+		return new WrapOptionalExpression(position, value.normalize(scope), type);
42
+	}
37
 }
43
 }

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

11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
12
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
14
+import org.openzen.zenscript.codemodel.scope.TypeScope;
14
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
16
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
17
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;

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

11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12
 import org.openzen.zenscript.codemodel.Modifiers;
12
 import org.openzen.zenscript.codemodel.Modifiers;
13
 import org.openzen.zenscript.codemodel.member.ref.CasterMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.CasterMemberRef;
14
+import org.openzen.zenscript.codemodel.scope.TypeScope;
14
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
16
 import org.openzen.zenscript.codemodel.type.ITypeID;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
22
  * @author Hoofdgebruiker
23
  * @author Hoofdgebruiker
23
  */
24
  */
24
 public class CasterMember extends FunctionalMember {
25
 public class CasterMember extends FunctionalMember {
25
-	public final ITypeID toType;
26
+	public ITypeID toType;
26
 	public CasterMemberRef overrides;
27
 	public CasterMemberRef overrides;
27
 	
28
 	
28
 	public CasterMember(
29
 	public CasterMember(
78
 	public CasterMemberRef getOverrides() {
79
 	public CasterMemberRef getOverrides() {
79
 		return overrides;
80
 		return overrides;
80
 	}
81
 	}
82
+	
83
+	@Override
84
+	public void normalize(TypeScope scope) {
85
+		super.normalize(scope);
86
+		toType = toType.getNormalized();
87
+	}
81
 }
88
 }

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

11
 import org.openzen.zenscript.codemodel.expression.Expression;
11
 import org.openzen.zenscript.codemodel.expression.Expression;
12
 import org.openzen.zenscript.codemodel.member.ref.ConstMemberRef;
12
 import org.openzen.zenscript.codemodel.member.ref.ConstMemberRef;
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.type.ITypeID;
15
 import org.openzen.zenscript.codemodel.type.ITypeID;
15
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
16
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
17
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
46
 
47
 
47
 	@Override
48
 	@Override
48
 	public void registerTo(TypeMembers members, TypeMemberPriority priority, GenericMapper mapper) {
49
 	public void registerTo(TypeMembers members, TypeMemberPriority priority, GenericMapper mapper) {
49
-		members.addConst(new ConstMemberRef(this, mapper.map(type)));
50
+		members.addConst(new ConstMemberRef(this, type, mapper));
50
 	}
51
 	}
51
 
52
 
52
 	@Override
53
 	@Override
58
 	public DefinitionMemberRef getOverrides() {
59
 	public DefinitionMemberRef getOverrides() {
59
 		return null;
60
 		return null;
60
 	}
61
 	}
62
+
63
+	@Override
64
+	public void normalize(TypeScope scope) {
65
+		type = type.getNormalized();
66
+		value = value.normalize(scope);
67
+	}
61
 }
68
 }

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

6
 package org.openzen.zenscript.codemodel.member;
6
 package org.openzen.zenscript.codemodel.member;
7
 
7
 
8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
+import org.openzen.zenscript.codemodel.FunctionHeader;
9
 import org.openzen.zenscript.codemodel.GenericMapper;
10
 import org.openzen.zenscript.codemodel.GenericMapper;
10
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
11
 import org.openzen.zenscript.codemodel.iterator.ForeachIteratorVisitor;
12
 import org.openzen.zenscript.codemodel.iterator.ForeachIteratorVisitor;
12
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
14
 import org.openzen.zenscript.codemodel.statement.Statement;
15
 import org.openzen.zenscript.codemodel.statement.Statement;
16
+import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
15
 import org.openzen.zenscript.codemodel.type.ITypeID;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
16
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
17
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
21
  *
23
  *
22
  * @author Hoofdgebruiker
24
  * @author Hoofdgebruiker
23
  */
25
  */
24
-public class CustomIteratorMember extends DefinitionMember implements IIteratorMember {
26
+public class CustomIteratorMember extends FunctionalMember implements IIteratorMember {
25
 	private final ITypeID[] iteratorTypes;
27
 	private final ITypeID[] iteratorTypes;
26
 	public Statement body;
28
 	public Statement body;
27
 	public IteratorMemberRef overrides;
29
 	public IteratorMemberRef overrides;
28
 	
30
 	
29
-	public CustomIteratorMember(CodePosition position, HighLevelDefinition definition, int modifiers, ITypeID[] iteratorTypes) {
30
-		super(position, definition, modifiers);
31
+	public CustomIteratorMember(CodePosition position, HighLevelDefinition definition, int modifiers, ITypeID[] iteratorTypes, GlobalTypeRegistry registry, BuiltinID builtin) {
32
+		super(position, definition, modifiers, createIteratorHeader(registry, iteratorTypes), builtin);
31
 		
33
 		
32
 		this.iteratorTypes = iteratorTypes;
34
 		this.iteratorTypes = iteratorTypes;
33
 	}
35
 	}
35
 	public void setContent(Statement body) {
37
 	public void setContent(Statement body) {
36
 		this.body = body;
38
 		this.body = body;
37
 	}
39
 	}
40
+	
41
+	@Override
42
+	public String getCanonicalName() {
43
+		return definition.getFullName() + ":iterator:" + iteratorTypes.length;
44
+	}
38
 
45
 
39
 	@Override
46
 	@Override
40
 	public int getLoopVariableCount() {
47
 	public int getLoopVariableCount() {
79
 	public DefinitionMemberRef getOverrides() {
86
 	public DefinitionMemberRef getOverrides() {
80
 		return overrides;
87
 		return overrides;
81
 	}
88
 	}
89
+	
90
+	@Override
91
+	public FunctionalKind getKind() {
92
+		return FunctionalKind.ITERATOR;
93
+	}
94
+	
95
+	private static FunctionHeader createIteratorHeader(GlobalTypeRegistry registry, ITypeID[] iteratorTypes) {
96
+		return new FunctionHeader(registry.getIterator(iteratorTypes));
97
+	}
82
 }
98
 }

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

15
 import org.openzen.zenscript.codemodel.expression.ThisExpression;
15
 import org.openzen.zenscript.codemodel.expression.ThisExpression;
16
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
16
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
17
 import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
17
 import org.openzen.zenscript.codemodel.member.ref.FieldMemberRef;
18
+import org.openzen.zenscript.codemodel.scope.TypeScope;
18
 import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
19
 import org.openzen.zenscript.codemodel.statement.ExpressionStatement;
19
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
20
 import org.openzen.zenscript.codemodel.statement.ReturnStatement;
20
 import org.openzen.zenscript.codemodel.type.GenericTypeID;
21
 import org.openzen.zenscript.codemodel.type.GenericTypeID;
44
 			HighLevelDefinition definition,
45
 			HighLevelDefinition definition,
45
 			int modifiers,
46
 			int modifiers,
46
 			String name,
47
 			String name,
48
+			ITypeID thisType,
47
 			ITypeID type,
49
 			ITypeID type,
48
 			GlobalTypeRegistry registry,
50
 			GlobalTypeRegistry registry,
49
 			int autoGetterAccess,
51
 			int autoGetterAccess,
62
 		if (definition.genericParameters != null) {
64
 		if (definition.genericParameters != null) {
63
 			parameters = new ITypeID[definition.genericParameters.length];
65
 			parameters = new ITypeID[definition.genericParameters.length];
64
 			for (int i = 0; i < parameters.length; i++)
66
 			for (int i = 0; i < parameters.length; i++)
65
-				parameters[i] = new GenericTypeID(definition.genericParameters[i]);
67
+				parameters[i] = registry.getGeneric(definition.genericParameters[i]);
66
 		}
68
 		}
67
 		
69
 		
68
 		if (autoGetterAccess != 0) {
70
 		if (autoGetterAccess != 0) {
69
-			ITypeID myType = registry.getForDefinition(definition, parameters);
70
 			this.autoGetter = new GetterMember(position, definition, autoGetterAccess, name, type, null);
71
 			this.autoGetter = new GetterMember(position, definition, autoGetterAccess, name, type, null);
71
-			this.autoGetter.setBody(new ReturnStatement(position, new GetFieldExpression(position, new ThisExpression(position, myType), new FieldMemberRef(this, myType))));
72
+			this.autoGetter.setBody(new ReturnStatement(position, new GetFieldExpression(position, new ThisExpression(position, thisType), new FieldMemberRef(this, thisType))));
72
 		} else {
73
 		} else {
73
 			this.autoGetter = null;
74
 			this.autoGetter = null;
74
 		}
75
 		}
75
 		if (autoSetterAccess != 0) {
76
 		if (autoSetterAccess != 0) {
76
-			ITypeID myType = registry.getForDefinition(definition, parameters);
77
 			this.autoSetter = new SetterMember(position, definition, autoSetterAccess, name, type, null);
77
 			this.autoSetter = new SetterMember(position, definition, autoSetterAccess, name, type, null);
78
 			this.autoSetter.setBody(new ExpressionStatement(position, new SetFieldExpression(
78
 			this.autoSetter.setBody(new ExpressionStatement(position, new SetFieldExpression(
79
 					position,
79
 					position,
80
-					new ThisExpression(position, myType),
81
-					new FieldMemberRef(this, myType),
80
+					new ThisExpression(position, thisType),
81
+					new FieldMemberRef(this, thisType),
82
 					new GetFunctionParameterExpression(position, this.autoSetter.header.parameters[0]))));
82
 					new GetFunctionParameterExpression(position, this.autoSetter.header.parameters[0]))));
83
 		} else {
83
 		} else {
84
 			this.autoSetter = null;
84
 			this.autoSetter = null;
144
 	public DefinitionMemberRef getOverrides() {
144
 	public DefinitionMemberRef getOverrides() {
145
 		return null;
145
 		return null;
146
 	}
146
 	}
147
+
148
+	@Override
149
+	public void normalize(TypeScope scope) {
150
+		type = type.getNormalized();
151
+		if (initializer != null)
152
+			initializer = initializer.normalize(scope);
153
+	}
147
 }
154
 }

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

17
 	GETTER,
17
 	GETTER,
18
 	SETTER,
18
 	SETTER,
19
 	CALLER,
19
 	CALLER,
20
-	CASTER
20
+	CASTER,
21
+	ITERATOR
21
 }
22
 }

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

6
 package org.openzen.zenscript.codemodel.member;
6
 package org.openzen.zenscript.codemodel.member;
7
 
7
 
8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
+import org.openzen.zencode.shared.ConcatMap;
9
 import org.openzen.zenscript.codemodel.FunctionHeader;
10
 import org.openzen.zenscript.codemodel.FunctionHeader;
10
 import org.openzen.zenscript.codemodel.GenericMapper;
11
 import org.openzen.zenscript.codemodel.GenericMapper;
11
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.FunctionalMemberRef;
14
+import org.openzen.zenscript.codemodel.scope.TypeScope;
15
+import org.openzen.zenscript.codemodel.statement.LoopStatement;
13
 import org.openzen.zenscript.codemodel.statement.Statement;
16
 import org.openzen.zenscript.codemodel.statement.Statement;
14
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
17
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
15
 
18
 
50
 	public BuiltinID getBuiltin() {
53
 	public BuiltinID getBuiltin() {
51
 		return builtin;
54
 		return builtin;
52
 	}
55
 	}
56
+
57
+	@Override
58
+	public void normalize(TypeScope scope) {
59
+		header = header.normalize(scope.getTypeRegistry());
60
+		if (body != null)
61
+			body = body.normalize(scope, ConcatMap.empty(LoopStatement.class, LoopStatement.class));
62
+	}
53
 }
63
 }

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

9
 import org.openzen.zenscript.codemodel.FunctionHeader;
9
 import org.openzen.zenscript.codemodel.FunctionHeader;
10
 import org.openzen.zenscript.codemodel.GenericMapper;
10
 import org.openzen.zenscript.codemodel.GenericMapper;
11
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
11
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
12
+import org.openzen.zenscript.codemodel.scope.TypeScope;
12
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
13
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
13
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
14
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
14
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
15
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
35
 	<T> boolean hasTag(Class<T> tag);
36
 	<T> boolean hasTag(Class<T> tag);
36
 	
37
 	
37
 	DefinitionMemberRef getOverrides();
38
 	DefinitionMemberRef getOverrides();
39
+
40
+	public void normalize(TypeScope scope);
38
 }
41
 }

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

12
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
12
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
13
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
13
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.ImplementationMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.ImplementationMemberRef;
15
+import org.openzen.zenscript.codemodel.scope.TypeScope;
15
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
16
 import org.openzen.zenscript.codemodel.type.ITypeID;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
17
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
63
 	public DefinitionMemberRef getOverrides() {
64
 	public DefinitionMemberRef getOverrides() {
64
 		return null;
65
 		return null;
65
 	}
66
 	}
67
+
68
+	@Override
69
+	public void normalize(TypeScope scope) {
70
+		for (IDefinitionMember member : members)
71
+			member.normalize(scope);
72
+	}
66
 }
73
 }

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

31
 		this.outerTypeArguments = outerTypeArguments;
31
 		this.outerTypeArguments = outerTypeArguments;
32
 	}
32
 	}
33
 	
33
 	
34
-	public DefinitionTypeID instance(GlobalTypeRegistry registry, ITypeID[] typeArguments) {
35
-		return registry.getForDefinition(definition, typeArguments, outerTypeArguments);
34
+	public DefinitionTypeID instance(GlobalTypeRegistry registry, ITypeID[] typeArguments, DefinitionTypeID outer) {
35
+		return registry.getForDefinition(definition, typeArguments, outer);
36
 	}
36
 	}
37
 }
37
 }

+ 9
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/InnerDefinitionMember.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.HighLevelDefinition;
10
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
11
+import org.openzen.zenscript.codemodel.Modifiers;
12
+import org.openzen.zenscript.codemodel.definition.InterfaceDefinition;
11
 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;
12
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
15
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
13
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
16
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
14
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
17
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
21
 	public final HighLevelDefinition innerDefinition;
24
 	public final HighLevelDefinition innerDefinition;
22
 	
25
 	
23
 	public InnerDefinitionMember(CodePosition position, HighLevelDefinition outer, int modifiers, HighLevelDefinition definition) {
26
 	public InnerDefinitionMember(CodePosition position, HighLevelDefinition outer, int modifiers, HighLevelDefinition definition) {
24
-		super(position, outer, modifiers);
27
+		super(position, outer, definition instanceof InterfaceDefinition ? modifiers | Modifiers.STATIC : modifiers);
25
 		
28
 		
26
 		this.innerDefinition = definition;
29
 		this.innerDefinition = definition;
27
 	}
30
 	}
54
 	public DefinitionMemberRef getOverrides() {
57
 	public DefinitionMemberRef getOverrides() {
55
 		return null;
58
 		return null;
56
 	}
59
 	}
60
+
61
+	@Override
62
+	public void normalize(TypeScope scope) {
63
+		innerDefinition.normalize(scope);
64
+	}
57
 }
65
 }

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

6
 package org.openzen.zenscript.codemodel.member;
6
 package org.openzen.zenscript.codemodel.member;
7
 
7
 
8
 import org.openzen.zencode.shared.CodePosition;
8
 import org.openzen.zencode.shared.CodePosition;
9
+import org.openzen.zencode.shared.ConcatMap;
9
 import org.openzen.zencode.shared.Taggable;
10
 import org.openzen.zencode.shared.Taggable;
10
 import org.openzen.zenscript.codemodel.GenericMapper;
11
 import org.openzen.zenscript.codemodel.GenericMapper;
11
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
12
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
12
 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;
15
+import org.openzen.zenscript.codemodel.statement.LoopStatement;
13
 import org.openzen.zenscript.codemodel.statement.Statement;
16
 import org.openzen.zenscript.codemodel.statement.Statement;
14
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
17
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
15
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
18
 import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
57
 	public DefinitionMemberRef getOverrides() {
60
 	public DefinitionMemberRef getOverrides() {
58
 		return null;
61
 		return null;
59
 	}
62
 	}
63
+
64
+	@Override
65
+	public void normalize(TypeScope scope) {
66
+		body = body.normalize(scope, ConcatMap.empty(LoopStatement.class, LoopStatement.class));
67
+	}
60
 }
68
 }

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

13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
16
+import org.openzen.zenscript.codemodel.scope.TypeScope;
16
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
17
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
17
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
18
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
18
 import org.openzen.zenscript.codemodel.type.ITypeID;
19
 import org.openzen.zenscript.codemodel.type.ITypeID;
25
  * @author Hoofdgebruiker
26
  * @author Hoofdgebruiker
26
  */
27
  */
27
 public class ArrayIteratorKeyValues extends Taggable implements IIteratorMember {
28
 public class ArrayIteratorKeyValues extends Taggable implements IIteratorMember {
28
-	private final ArrayTypeID type;
29
+	private ArrayTypeID type;
29
 	private final ITypeID[] loopVariableTypes;
30
 	private final ITypeID[] loopVariableTypes;
30
 	
31
 	
31
 	public ArrayIteratorKeyValues(ArrayTypeID type) {
32
 	public ArrayIteratorKeyValues(ArrayTypeID type) {
81
 	public DefinitionMemberRef getOverrides() {
82
 	public DefinitionMemberRef getOverrides() {
82
 		return null;
83
 		return null;
83
 	}
84
 	}
85
+
86
+	@Override
87
+	public void normalize(TypeScope scope) {
88
+		
89
+	}
84
 }
90
 }

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

13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
16
+import org.openzen.zenscript.codemodel.scope.TypeScope;
16
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
17
 import org.openzen.zenscript.codemodel.type.ArrayTypeID;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
19
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
76
 	public DefinitionMemberRef getOverrides() {
77
 	public DefinitionMemberRef getOverrides() {
77
 		return null;
78
 		return null;
78
 	}
79
 	}
80
+
81
+	@Override
82
+	public void normalize(TypeScope scope) {
83
+		
84
+	}
79
 }
85
 }

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

13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
16
+import org.openzen.zenscript.codemodel.scope.TypeScope;
16
 import org.openzen.zenscript.codemodel.type.AssocTypeID;
17
 import org.openzen.zenscript.codemodel.type.AssocTypeID;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
19
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
79
 	public DefinitionMemberRef getOverrides() {
80
 	public DefinitionMemberRef getOverrides() {
80
 		return null;
81
 		return null;
81
 	}
82
 	}
83
+
84
+	@Override
85
+	public void normalize(TypeScope scope) {
86
+		
87
+	}
82
 }
88
 }

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

13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
16
+import org.openzen.zenscript.codemodel.scope.TypeScope;
16
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
17
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.RangeTypeID;
19
 import org.openzen.zenscript.codemodel.type.RangeTypeID;
87
 	public DefinitionMemberRef getOverrides() {
88
 	public DefinitionMemberRef getOverrides() {
88
 		return null;
89
 		return null;
89
 	}
90
 	}
91
+
92
+	@Override
93
+	public void normalize(TypeScope scope) {
94
+		
95
+	}
90
 }
96
 }

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

13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
13
 import org.openzen.zenscript.codemodel.member.MemberVisitor;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
14
 import org.openzen.zenscript.codemodel.member.ref.DefinitionMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
15
 import org.openzen.zenscript.codemodel.member.ref.IteratorMemberRef;
16
+import org.openzen.zenscript.codemodel.scope.TypeScope;
16
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
17
 import org.openzen.zenscript.codemodel.type.BasicTypeID;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
19
 import org.openzen.zenscript.codemodel.type.member.BuiltinID;
70
 	public DefinitionMemberRef getOverrides() {
71
 	public DefinitionMemberRef getOverrides() {
71
 		return null;
72
 		return null;
72
 	}
73
 	}
74
+
75
+	@Override
76
+	public void normalize(TypeScope scope) {
77
+		
78
+	}
73
 }
79
 }

+ 16
- 3
CodeModel/src/main/java/org/openzen/zenscript/codemodel/member/ref/ConstMemberRef.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.FunctionHeader;
9
 import org.openzen.zenscript.codemodel.FunctionHeader;
10
+import org.openzen.zenscript.codemodel.GenericMapper;
10
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
11
 import org.openzen.zenscript.codemodel.annotations.MemberAnnotation;
11
 import org.openzen.zenscript.codemodel.member.ConstMember;
12
 import org.openzen.zenscript.codemodel.member.ConstMember;
12
 import org.openzen.zenscript.codemodel.type.ITypeID;
13
 import org.openzen.zenscript.codemodel.type.ITypeID;
17
  */
18
  */
18
 public class ConstMemberRef implements DefinitionMemberRef {
19
 public class ConstMemberRef implements DefinitionMemberRef {
19
 	public final ConstMember member;
20
 	public final ConstMember member;
20
-	public final ITypeID type;
21
+	private ITypeID type;
22
+	private ITypeID originalType;
23
+	private final GenericMapper mapper;
21
 	
24
 	
22
-	public ConstMemberRef(ConstMember member, ITypeID type) {
25
+	public ConstMemberRef(ConstMember member, ITypeID originalType, GenericMapper mapper) {
23
 		this.member = member;
26
 		this.member = member;
24
-		this.type = type;
27
+		this.type = originalType.instance(mapper);
28
+		this.originalType = originalType;
29
+		this.mapper = mapper;
30
+	}
31
+	
32
+	public ITypeID getType() {
33
+		if (originalType != member.type) {
34
+			originalType = member.type;
35
+			type = originalType.instance(mapper);
36
+		}
37
+		return type;
25
 	}
38
 	}
26
 
39
 
27
 	@Override
40
 	@Override

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

104
 	}
104
 	}
105
 	
105
 	
106
 	public Expression call(CodePosition position, Expression target, FunctionHeader instancedHeader, CallArguments arguments, TypeScope scope) {
106
 	public Expression call(CodePosition position, Expression target, FunctionHeader instancedHeader, CallArguments arguments, TypeScope scope) {
107
-		return new CallExpression(position, target, this, instancedHeader, arguments, scope);
107
+		return new CallExpression(position, target, this, instancedHeader, arguments);
108
 	}
108
 	}
109
 	
109
 	
110
 	public final Expression call(CodePosition position, Expression target, CallArguments arguments, TypeScope scope) {
110
 	public final Expression call(CodePosition position, Expression target, CallArguments arguments, TypeScope scope) {
116
 	}
116
 	}
117
 	
117
 	
118
 	public Expression callStatic(CodePosition position, ITypeID target, FunctionHeader instancedHeader, CallArguments arguments, TypeScope scope) {
118
 	public Expression callStatic(CodePosition position, ITypeID target, FunctionHeader instancedHeader, CallArguments arguments, TypeScope scope) {
119
-		return new CallStaticExpression(position, target, this, instancedHeader, arguments, scope);
119
+		return new CallStaticExpression(position, target, this, instancedHeader, arguments);
120
 	}
120
 	}
121
 }
121
 }

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

15
 import org.openzen.zenscript.codemodel.type.GenericName;
15
 import org.openzen.zenscript.codemodel.type.GenericName;
16
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
16
 import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
17
 import org.openzen.zenscript.codemodel.type.ITypeID;
18
-import org.openzen.zenscript.codemodel.type.member.LocalMemberCache;
19
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
18
 import org.openzen.zenscript.codemodel.type.member.TypeMembers;
20
 
19
 
21
 /**
20
 /**

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


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

Loading…
Cancel
Save