Browse Source

- Fix function header not being stored correctly for a FunctionExpression

- Fixed type parameters stored as null instead of empty array
Stan Hebben 6 years ago
parent
commit
a90b16e7af

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

285
 		for (int i = 0; i < parameters.length; i++) {
285
 		for (int i = 0; i < parameters.length; i++) {
286
 			parameters[i] = this.parameters[i].withGenericArguments(mapper);
286
 			parameters[i] = this.parameters[i].withGenericArguments(mapper);
287
 		}
287
 		}
288
-		return new FunctionHeader(null, returnType, thrownType == null ? null : thrownType.instance(mapper), parameters);
288
+		return new FunctionHeader(TypeParameter.NONE, returnType, thrownType == null ? null : thrownType.instance(mapper), parameters);
289
 	}
289
 	}
290
 	
290
 	
291
 	public FunctionHeader forTypeParameterInference() {
291
 	public FunctionHeader forTypeParameterInference() {

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

56
 				if (body == function.body)
56
 				if (body == function.body)
57
 					return function;
57
 					return function;
58
 				
58
 				
59
-				return new FunctionExpression(function.position, (FunctionTypeID)function.type, function.closure, body);
59
+				return new FunctionExpression(function.position, (FunctionTypeID)function.type, function.closure, function.header, body);
60
 			} else {
60
 			} else {
61
 				return expression;
61
 				return expression;
62
 			}
62
 			}

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

31
 			CodePosition position,
31
 			CodePosition position,
32
 			FunctionTypeID type,
32
 			FunctionTypeID type,
33
 			LambdaClosure closure,
33
 			LambdaClosure closure,
34
+			FunctionHeader header,
34
 			Statement body) {
35
 			Statement body) {
35
 		super(position, type, body.thrownType);
36
 		super(position, type, body.thrownType);
36
 		
37
 		
37
-		this.header = type.header;
38
+		this.header = header;
38
 		this.closure = closure;
39
 		this.closure = closure;
39
 		this.body = body;
40
 		this.body = body;
40
 	}
41
 	}
47
 	@Override
48
 	@Override
48
 	public FunctionExpression transform(ExpressionTransformer transformer) {
49
 	public FunctionExpression transform(ExpressionTransformer transformer) {
49
 		Statement tBody = body.transform(transformer, ConcatMap.empty(LoopStatement.class, LoopStatement.class));
50
 		Statement tBody = body.transform(transformer, ConcatMap.empty(LoopStatement.class, LoopStatement.class));
50
-		return tBody == body ? this : new FunctionExpression(position, (FunctionTypeID)type, closure, tBody);
51
+		return tBody == body ? this : new FunctionExpression(position, (FunctionTypeID)type, closure, header, tBody);
51
 	}
52
 	}
52
 	
53
 	
53
 	@Override
54
 	@Override

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

47
 		this.outer = outer;
47
 		this.outer = outer;
48
 		this.definition = definition;
48
 		this.definition = definition;
49
 		
49
 		
50
-		ITypeID[] genericParameterList = null;
50
+		ITypeID[] genericParameterList = ITypeID.NONE;
51
 		if (definition.genericParameters != null) {
51
 		if (definition.genericParameters != null) {
52
 			genericParameterList = new ITypeID[definition.genericParameters.length];
52
 			genericParameterList = new ITypeID[definition.genericParameters.length];
53
 			for (int i = 0; i < definition.genericParameters.length; i++) {
53
 			for (int i = 0; i < definition.genericParameters.length; i++) {

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

26
 		if (definition.genericParameters != null)
26
 		if (definition.genericParameters != null)
27
 			throw new IllegalArgumentException("Definition has type arguments!");
27
 			throw new IllegalArgumentException("Definition has type arguments!");
28
 		
28
 		
29
-		return new DefinitionTypeID(definition, null);
29
+		return new DefinitionTypeID(definition, ITypeID.NONE);
30
 	}
30
 	}
31
 	
31
 	
32
 	private static final OuterTypeEntry[] NO_OUTER_ENTRIES = new OuterTypeEntry[0];
32
 	private static final OuterTypeEntry[] NO_OUTER_ENTRIES = new OuterTypeEntry[0];
44
 	
44
 	
45
 	// For inner classes of generic outer classes
45
 	// For inner classes of generic outer classes
46
 	public DefinitionTypeID(HighLevelDefinition definition, ITypeID[] typeParameters, Map<TypeParameter, ITypeID> outerTypeParameters) {
46
 	public DefinitionTypeID(HighLevelDefinition definition, ITypeID[] typeParameters, Map<TypeParameter, ITypeID> outerTypeParameters) {
47
+		if (typeParameters == null)
48
+			throw new NullPointerException("typeParameters cannot be null");
49
+		
47
 		this.definition = definition;
50
 		this.definition = definition;
48
 		this.typeParameters = typeParameters;
51
 		this.typeParameters = typeParameters;
49
 		this.outerTypeParameters = outerTypeParameters;
52
 		this.outerTypeParameters = outerTypeParameters;
63
 	}
66
 	}
64
 	
67
 	
65
 	public boolean hasTypeParameters() {
68
 	public boolean hasTypeParameters() {
66
-		return typeParameters != null && typeParameters.length > 0;
69
+		return typeParameters.length > 0;
67
 	}
70
 	}
68
 	
71
 	
69
 	public void init(GlobalTypeRegistry registry) {
72
 	public void init(GlobalTypeRegistry registry) {
81
 	// To be used exclusively by StaticDefinitionTypeID
84
 	// To be used exclusively by StaticDefinitionTypeID
82
 	protected DefinitionTypeID(HighLevelDefinition definition) {
85
 	protected DefinitionTypeID(HighLevelDefinition definition) {
83
 		this.definition = definition;
86
 		this.definition = definition;
84
-		this.typeParameters = null;
87
+		this.typeParameters = ITypeID.NONE;
85
 		this.superType = definition.superType;
88
 		this.superType = definition.superType;
86
 		this.outerTypeParameters = Collections.emptyMap();
89
 		this.outerTypeParameters = Collections.emptyMap();
87
 		this.outerTypeEntries = NO_OUTER_ENTRIES;
90
 		this.outerTypeEntries = NO_OUTER_ENTRIES;
92
 		if (!hasTypeParameters() && outerTypeParameters.isEmpty())
95
 		if (!hasTypeParameters() && outerTypeParameters.isEmpty())
93
 			return this;
96
 			return this;
94
 		
97
 		
95
-		ITypeID[] instancedArguments = null;
96
-		if (typeParameters != null) {
98
+		ITypeID[] instancedArguments = ITypeID.NONE;
99
+		if (hasTypeParameters()) {
97
 			instancedArguments = new ITypeID[typeParameters.length];
100
 			instancedArguments = new ITypeID[typeParameters.length];
98
 			for (int i = 0; i < typeParameters.length; i++) {
101
 			for (int i = 0; i < typeParameters.length; i++) {
99
 				// TODO: why was this line written like this?
102
 				// TODO: why was this line written like this?
160
 	
163
 	
161
 	@Override
164
 	@Override
162
 	public boolean hasInferenceBlockingTypeParameters(TypeParameter[] parameters) {
165
 	public boolean hasInferenceBlockingTypeParameters(TypeParameter[] parameters) {
163
-		if (typeParameters != null) {
166
+		if (hasTypeParameters()) {
164
 			for (ITypeID typeParameter : typeParameters)
167
 			for (ITypeID typeParameter : typeParameters)
165
 				if (typeParameter.hasInferenceBlockingTypeParameters(parameters))
168
 				if (typeParameter.hasInferenceBlockingTypeParameters(parameters))
166
 					return true;
169
 					return true;
197
 	
200
 	
198
 	@Override
201
 	@Override
199
 	public String toString() {
202
 	public String toString() {
200
-		if (typeParameters == null) {
203
+		if (!hasTypeParameters()) {
201
 			return definition.name;
204
 			return definition.name;
202
 		} else {
205
 		} else {
203
 			StringBuilder result = new StringBuilder();
206
 			StringBuilder result = new StringBuilder();

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

14
 	public final ITypeID[] arguments;
14
 	public final ITypeID[] arguments;
15
 	
15
 	
16
 	public GenericName(String name) {
16
 	public GenericName(String name) {
17
-		this(name, null);
17
+		this(name, ITypeID.NONE);
18
 	}
18
 	}
19
 	
19
 	
20
 	public GenericName(String name, ITypeID[] arguments) {
20
 	public GenericName(String name, ITypeID[] arguments) {
21
+		if (arguments == null)
22
+			throw new NullPointerException("Arguments cannot be null");
23
+		
21
 		this.name = name;
24
 		this.name = name;
22
 		this.arguments = arguments;
25
 		this.arguments = arguments;
23
 	}
26
 	}
24
 	
27
 	
25
 	public int getNumberOfArguments() {
28
 	public int getNumberOfArguments() {
26
-		return arguments == null ? 0 : arguments.length;
29
+		return arguments.length;
27
 	}
30
 	}
28
 	
31
 	
29
 	public boolean hasArguments() {
32
 	public boolean hasArguments() {
30
-		return arguments != null && arguments.length > 0;
33
+		return arguments.length > 0;
31
 	}
34
 	}
32
 	
35
 	
33
 	public boolean hasNoArguments() {
36
 	public boolean hasNoArguments() {
34
-		return arguments == null || arguments.length == 0;
37
+		return arguments.length == 0;
35
 	}
38
 	}
36
 	
39
 	
37
 	@Override
40
 	@Override
38
 	public String toString() {
41
 	public String toString() {
39
 		StringBuilder result = new StringBuilder(name);
42
 		StringBuilder result = new StringBuilder(name);
40
-		if (arguments != null) {
43
+		if (hasArguments()) {
41
 			result.append("<");
44
 			result.append("<");
42
 			for (int i = 0; i < arguments.length; i++) {
45
 			for (int i = 0; i < arguments.length; i++) {
43
 				if (i > 0)
46
 				if (i > 0)

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

120
 	
120
 	
121
 	public DefinitionTypeID getForDefinition(HighLevelDefinition definition, ITypeID[] typeParameters, Map<TypeParameter, ITypeID> outerInstance) {
121
 	public DefinitionTypeID getForDefinition(HighLevelDefinition definition, ITypeID[] typeParameters, Map<TypeParameter, ITypeID> outerInstance) {
122
 		DefinitionTypeID id;
122
 		DefinitionTypeID id;
123
-		if ((definition instanceof FunctionDefinition) || (definition.genericParameters == null && typeParameters == null && outerInstance.isEmpty())) {
123
+		if ((definition instanceof FunctionDefinition) || (definition.genericParameters == null && typeParameters.length == 0 && outerInstance.isEmpty())) {
124
 			// make it a static one
124
 			// make it a static one
125
 			id = new StaticDefinitionTypeID(definition);
125
 			id = new StaticDefinitionTypeID(definition);
126
 		} else {
126
 		} else {

DrawableGui/src/main/java/org/openzen/drawablegui/DTooltip.java → DrawableGui/src/main/java/org/openzen/drawablegui/DSimpleTooltip.java View File

6
 package org.openzen.drawablegui;
6
 package org.openzen.drawablegui;
7
 
7
 
8
 import org.openzen.drawablegui.listeners.ListenerHandle;
8
 import org.openzen.drawablegui.listeners.ListenerHandle;
9
-import org.openzen.drawablegui.live.LiveObject;
10
 import org.openzen.drawablegui.live.LiveString;
9
 import org.openzen.drawablegui.live.LiveString;
11
-import org.openzen.drawablegui.live.MutableLiveObject;
12
 import org.openzen.drawablegui.style.DStyleClass;
10
 import org.openzen.drawablegui.style.DStyleClass;
13
 import org.openzen.drawablegui.style.DStylePath;
11
 import org.openzen.drawablegui.style.DStylePath;
14
 
12
 
16
  *
14
  *
17
  * @author Hoofdgebruiker
15
  * @author Hoofdgebruiker
18
  */
16
  */
19
-public class DTooltip implements DComponent {
17
+public class DSimpleTooltip {
20
 	private final DStyleClass styleClass;
18
 	private final DStyleClass styleClass;
21
 	private final LiveString tooltip;
19
 	private final LiveString tooltip;
22
-	private final MutableLiveObject<DSizing> sizing = DSizing.create();
23
 	private final ListenerHandle<LiveString.Listener> tooltipListener;
20
 	private final ListenerHandle<LiveString.Listener> tooltipListener;
24
 	
21
 	
25
 	private DUIContext context;
22
 	private DUIContext context;
29
 	private boolean visible = false;
26
 	private boolean visible = false;
30
 	private DTimerHandle timerHandle = null;
27
 	private DTimerHandle timerHandle = null;
31
 	
28
 	
32
-	public DTooltip(DStyleClass styleClass, LiveString tooltip) {
29
+	public DSimpleTooltip(DStyleClass styleClass, LiveString tooltip) {
33
 		this.styleClass = styleClass;
30
 		this.styleClass = styleClass;
34
 		this.tooltip = tooltip;
31
 		this.tooltip = tooltip;
35
 		tooltipListener = tooltip.addListener(this::onTooltipChanged);
32
 		tooltipListener = tooltip.addListener(this::onTooltipChanged);
36
 	}
33
 	}
37
 	
34
 	
38
 	private void onTooltipChanged(String oldValue, String newValue) {
35
 	private void onTooltipChanged(String oldValue, String newValue) {
39
-		if (context == null)
36
+		if (context == null || bounds == null)
40
 			return;
37
 			return;
41
 		
38
 		
42
-		sizing.setValue(new DSizing(
43
-				style.border.getPaddingLeft() + fontMetrics.getWidth(newValue) + style.border.getPaddingRight(),
44
-				style.border.getPaddingTop() + fontMetrics.getAscent() + fontMetrics.getDescent() + style.border.getPaddingBottom()));
39
+		bounds = new DIRectangle(
40
+				bounds.x,
41
+				bounds.y,
42
+				style.border.getPaddingLeft() + fontMetrics.getWidth(tooltip.getValue()) + style.border.getPaddingRight(),
43
+				style.border.getPaddingTop() + fontMetrics.getAscent() + fontMetrics.getDescent() + style.border.getPaddingBottom());
44
+		context.repaint(bounds);
45
 	}
45
 	}
46
 	
46
 	
47
 	public void onTargetMouseEnter(DMouseEvent e) {
47
 	public void onTargetMouseEnter(DMouseEvent e) {
49
 			timerHandle.close();
49
 			timerHandle.close();
50
 		
50
 		
51
 		timerHandle = context.setTimer(1000, this::show);
51
 		timerHandle = context.setTimer(1000, this::show);
52
-		setBounds(new DIRectangle(e.x, e.y, sizing.getValue().preferredWidth, sizing.getValue().preferredHeight));
52
+		bounds = new DIRectangle(
53
+				e.x,
54
+				e.y,
55
+				style.border.getPaddingLeft() + fontMetrics.getWidth(tooltip.getValue()) + style.border.getPaddingRight(),
56
+				style.border.getPaddingTop() + fontMetrics.getAscent() + fontMetrics.getDescent() + style.border.getPaddingBottom());
53
 	}
57
 	}
54
 	
58
 	
55
 	public void onTargetMouseExit(DMouseEvent e) {
59
 	public void onTargetMouseExit(DMouseEvent e) {
62
 	}
66
 	}
63
 	
67
 	
64
 	private void show() {
68
 	private void show() {
69
+		System.out.println("Show tooltip");
65
 		visible = true;
70
 		visible = true;
66
 		context.repaint(bounds);
71
 		context.repaint(bounds);
67
 		
72
 		
72
 	}
77
 	}
73
 	
78
 	
74
 	private void hide() {
79
 	private void hide() {
80
+		System.out.println("Hide tooltip");
75
 		visible = false;
81
 		visible = false;
76
 		context.repaint(bounds);
82
 		context.repaint(bounds);
77
 	}
83
 	}
78
 	
84
 	
79
-	@Override
80
 	public void setContext(DStylePath parent, DUIContext context) {
85
 	public void setContext(DStylePath parent, DUIContext context) {
81
 		this.context = context;
86
 		this.context = context;
82
 		
87
 		
84
 		style = new DTooltipStyle(context.getStylesheets().get(context, path));
89
 		style = new DTooltipStyle(context.getStylesheets().get(context, path));
85
 		fontMetrics = context.getFontMetrics(style.font);
90
 		fontMetrics = context.getFontMetrics(style.font);
86
 	}
91
 	}
87
-
88
-	@Override
89
-	public LiveObject<DSizing> getSizing() {
90
-		return sizing;
91
-	}
92
-
93
-	@Override
94
-	public DIRectangle getBounds() {
95
-		return bounds;
96
-	}
97
-
98
-	@Override
99
-	public int getBaselineY() {
100
-		return style.border.getPaddingTop() + fontMetrics.getAscent();
101
-	}
102
-
103
-	@Override
104
-	public void setBounds(DIRectangle bounds) {
105
-		this.bounds = bounds;
106
-	}
107
-
108
-	@Override
92
+	
109
 	public void paint(DCanvas canvas) {
93
 	public void paint(DCanvas canvas) {
110
 		if (!visible)
94
 		if (!visible)
111
 			return;
95
 			return;
112
 		
96
 		
97
+		System.out.println("Actually paint tooltip");
113
 		canvas.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height, style.backgroundColor);
98
 		canvas.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height, style.backgroundColor);
114
 		style.border.paint(canvas, bounds);
99
 		style.border.paint(canvas, bounds);
115
-		canvas.drawText(style.font, style.textColor, bounds.x + style.border.getPaddingLeft(), style.border.getPaddingTop(), tooltip.getValue());
100
+		canvas.drawText(style.font, style.textColor, bounds.x + style.border.getPaddingLeft(), bounds.y + style.border.getPaddingTop(), tooltip.getValue());
116
 	}
101
 	}
117
-
118
-	@Override
102
+	
119
 	public void close() {
103
 	public void close() {
120
 		tooltipListener.close();
104
 		tooltipListener.close();
121
 	}
105
 	}

+ 11
- 1
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarSelectorButton.java View File

15
 import org.openzen.drawablegui.DTransform2D;
15
 import org.openzen.drawablegui.DTransform2D;
16
 import org.openzen.drawablegui.DUIContext;
16
 import org.openzen.drawablegui.DUIContext;
17
 import org.openzen.drawablegui.DIRectangle;
17
 import org.openzen.drawablegui.DIRectangle;
18
+import org.openzen.drawablegui.DSimpleTooltip;
18
 import org.openzen.drawablegui.listeners.ListenerHandle;
19
 import org.openzen.drawablegui.listeners.ListenerHandle;
20
+import org.openzen.drawablegui.live.ImmutableLiveString;
19
 import org.openzen.drawablegui.live.LiveBool;
21
 import org.openzen.drawablegui.live.LiveBool;
20
 import org.openzen.drawablegui.live.LiveObject;
22
 import org.openzen.drawablegui.live.LiveObject;
21
 import org.openzen.drawablegui.live.MutableLiveObject;
23
 import org.openzen.drawablegui.live.MutableLiveObject;
40
 	private DPath shape;
42
 	private DPath shape;
41
 	private boolean hovering;
43
 	private boolean hovering;
42
 	private boolean pressing;
44
 	private boolean pressing;
45
+	private DSimpleTooltip tooltip;
43
 	
46
 	
44
 	private final ListenerHandle<LiveBool.Listener> activeListener;
47
 	private final ListenerHandle<LiveBool.Listener> activeListener;
45
 	
48
 	
46
-	public AspectBarSelectorButton(DStyleClass styleClass, DDrawable icon, LiveBool active, Consumer<DMouseEvent> onClick) {
49
+	public AspectBarSelectorButton(DStyleClass styleClass, DDrawable icon, LiveBool active, String tooltip, Consumer<DMouseEvent> onClick) {
47
 		this.active = active;
50
 		this.active = active;
48
 		this.styleClass = styleClass;
51
 		this.styleClass = styleClass;
49
 		this.icon = icon;
52
 		this.icon = icon;
50
 		this.onClick = onClick;
53
 		this.onClick = onClick;
54
+		this.tooltip = new DSimpleTooltip(DStyleClass.EMPTY, new ImmutableLiveString(tooltip));
51
 		
55
 		
52
 		activeListener = active.addListener((oldValue, newValue) -> repaint());
56
 		activeListener = active.addListener((oldValue, newValue) -> repaint());
53
 	}
57
 	}
64
 				style.width,
68
 				style.width,
65
 				style.height,
69
 				style.height,
66
 				style.roundingRadius);
70
 				style.roundingRadius);
71
+		
72
+		tooltip.setContext(parent, context);
67
 	}
73
 	}
68
 
74
 
69
 	@Override
75
 	@Override
113
 				bounds.x + (style.width - icon.getNominalWidth() * context.getScale()) / 2,
119
 				bounds.x + (style.width - icon.getNominalWidth() * context.getScale()) / 2,
114
 				bounds.y + (style.height - icon.getNominalHeight() * context.getScale()) / 2,
120
 				bounds.y + (style.height - icon.getNominalHeight() * context.getScale()) / 2,
115
 				context.getScale()));
121
 				context.getScale()));
122
+		tooltip.paint(canvas);
116
 	}
123
 	}
117
 	
124
 	
118
 	@Override
125
 	@Override
119
 	public void onMouseEnter(DMouseEvent e) {
126
 	public void onMouseEnter(DMouseEvent e) {
120
 		hovering = true;
127
 		hovering = true;
128
+		tooltip.onTargetMouseEnter(e);
121
 		repaint();
129
 		repaint();
122
 	}
130
 	}
123
 	
131
 	
125
 	public void onMouseExit(DMouseEvent e) {
133
 	public void onMouseExit(DMouseEvent e) {
126
 		hovering = false;
134
 		hovering = false;
127
 		pressing = false;
135
 		pressing = false;
136
+		tooltip.onTargetMouseExit(e);
128
 		repaint();
137
 		repaint();
129
 	}
138
 	}
130
 	
139
 	
146
 	@Override
155
 	@Override
147
 	public void close() {
156
 	public void close() {
148
 		activeListener.close();
157
 		activeListener.close();
158
+		tooltip.close();
149
 	}
159
 	}
150
 	
160
 	
151
 	private void repaint() {
161
 	private void repaint() {

+ 1
- 1
IDE/src/main/java/org/openzen/zenscript/ide/ui/view/aspectbar/AspectBarView.java View File

90
 				aspectBar.toolbars,
90
 				aspectBar.toolbars,
91
 				bar -> {
91
 				bar -> {
92
 					LiveBool buttonActive = new LivePredicateBool<>(aspectBar.active, activeBar -> activeBar == bar);
92
 					LiveBool buttonActive = new LivePredicateBool<>(aspectBar.active, activeBar -> activeBar == bar);
93
-					AspectBarSelectorButton button = new AspectBarSelectorButton(DStyleClass.EMPTY, bar.icon, buttonActive, e -> aspectBar.active.setValue(bar));
93
+					AspectBarSelectorButton button = new AspectBarSelectorButton(DStyleClass.EMPTY, bar.icon, buttonActive, bar.description, e -> aspectBar.active.setValue(bar));
94
 					if (context != null)
94
 					if (context != null)
95
 						button.setContext(path, context);
95
 						button.setContext(path, context);
96
 					
96
 					

+ 1
- 1
Parser/src/main/java/org/openzen/zenscript/parser/expression/ParsedCallArguments.java View File

131
 			innerScope = scope.forCall(candidates.get(0));
131
 			innerScope = scope.forCall(candidates.get(0));
132
 		} else {
132
 		} else {
133
 			candidates = candidates.stream()
133
 			candidates = candidates.stream()
134
-					.filter(candidate -> candidate.typeParameters == null)
134
+					.filter(candidate -> candidate.getNumberOfTypeParameters() == 0)
135
 					.collect(Collectors.toList());
135
 					.collect(Collectors.toList());
136
 			
136
 			
137
 			if (candidates.isEmpty()) {
137
 			if (candidates.isEmpty()) {

+ 2
- 1
Parser/src/main/java/org/openzen/zenscript/parser/expression/ParsedExpressionFunction.java View File

78
 		}
78
 		}
79
 		
79
 		
80
 		FunctionTypeID functionType = scope.getTypeRegistry().getFunction(genericHeader.withGenericArguments(new GenericMapper(scope.getTypeRegistry(), scope.genericInferenceMap)));
80
 		FunctionTypeID functionType = scope.getTypeRegistry().getFunction(genericHeader.withGenericArguments(new GenericMapper(scope.getTypeRegistry(), scope.genericInferenceMap)));
81
-		return new FunctionExpression(position, functionType, closure, statements);
81
+		definedHeader = definedHeader.forLambda(functionType.header);
82
+		return new FunctionExpression(position, functionType, closure, definedHeader, statements);
82
 	}
83
 	}
83
 	
84
 	
84
 	@Override
85
 	@Override

+ 1
- 1
Parser/src/main/java/org/openzen/zenscript/parser/expression/ParsedExpressionVariable.java View File

49
 
49
 
50
 	@Override
50
 	@Override
51
 	public IPartialExpression compile(ExpressionScope scope) {
51
 	public IPartialExpression compile(ExpressionScope scope) {
52
-		ITypeID[] genericArguments = null;
52
+		ITypeID[] genericArguments = ITypeID.NONE;
53
 		if (genericParameters != null) {
53
 		if (genericParameters != null) {
54
 			genericArguments = new ITypeID[genericParameters.size()];
54
 			genericArguments = new ITypeID[genericParameters.size()];
55
 			for (int i = 0; i < genericParameters.size(); i++) {
55
 			for (int i = 0; i < genericParameters.size(); i++) {

+ 1
- 1
Parser/src/main/java/org/openzen/zenscript/parser/type/IParsedType.java View File

206
 	}
206
 	}
207
 	
207
 	
208
 	public static ITypeID[] compileList(List<IParsedType> typeParameters, BaseScope scope) {
208
 	public static ITypeID[] compileList(List<IParsedType> typeParameters, BaseScope scope) {
209
-		ITypeID[] result = null;
209
+		ITypeID[] result = ITypeID.NONE;
210
 		if (typeParameters != null) {
210
 		if (typeParameters != null) {
211
 			result = new ITypeID[typeParameters.size()];
211
 			result = new ITypeID[typeParameters.size()];
212
 			for (int i = 0; i < typeParameters.size(); i++) {
212
 			for (int i = 0; i < typeParameters.size(); i++) {

Loading…
Cancel
Save