|
@@ -8,6 +8,9 @@ package org.openzen.zenscript.parser.expression;
|
8
|
8
|
|
9
|
9
|
import java.util.ArrayList;
|
10
|
10
|
import java.util.List;
|
|
11
|
+import java.util.function.BiFunction;
|
|
12
|
+import java.util.function.Function;
|
|
13
|
+
|
11
|
14
|
import org.openzen.zencode.shared.CodePosition;
|
12
|
15
|
import org.openzen.zencode.shared.CompileException;
|
13
|
16
|
import org.openzen.zencode.shared.CompileExceptionCode;
|
|
@@ -30,8 +33,11 @@ import org.openzen.zenscript.codemodel.type.storage.UniqueStorageTag;
|
30
|
33
|
* @author Stanneke
|
31
|
34
|
*/
|
32
|
35
|
public class ParsedExpressionMap extends ParsedExpression {
|
33
|
|
- private final List<ParsedExpression> keys;
|
34
|
|
- private final List<ParsedExpression> values;
|
|
36
|
+
|
|
37
|
+ public static final List<BiFunction<ParsedExpressionMap, ExpressionScope, ? extends IPartialExpression>> compileOverrides = new ArrayList<>(0);
|
|
38
|
+
|
|
39
|
+ public final List<ParsedExpression> keys;
|
|
40
|
+ public final List<ParsedExpression> values;
|
35
|
41
|
|
36
|
42
|
public ParsedExpressionMap(
|
37
|
43
|
CodePosition position,
|
|
@@ -45,6 +51,12 @@ public class ParsedExpressionMap extends ParsedExpression {
|
45
|
51
|
|
46
|
52
|
@Override
|
47
|
53
|
public IPartialExpression compile(ExpressionScope scope) throws CompileException {
|
|
54
|
+ for(BiFunction<ParsedExpressionMap, ExpressionScope, ? extends IPartialExpression> compileOverride : compileOverrides) {
|
|
55
|
+ final IPartialExpression apply = compileOverride.apply(this, scope);
|
|
56
|
+ if(apply != null)
|
|
57
|
+ return apply;
|
|
58
|
+ }
|
|
59
|
+
|
48
|
60
|
StoredType usedHint = null;
|
49
|
61
|
List<StoredType> keyHints = new ArrayList<>();
|
50
|
62
|
List<StoredType> valueHints = new ArrayList<>();
|