1 package org.simantics.scl.compiler.elaboration.java;
3 import org.simantics.scl.compiler.elaboration.expressions.EApply;
4 import org.simantics.scl.compiler.elaboration.expressions.Expression;
5 import org.simantics.scl.compiler.elaboration.expressions.Expressions;
6 import org.simantics.scl.compiler.elaboration.expressions.Variable;
7 import org.simantics.scl.compiler.elaboration.query.compilation.EnforcingContext;
8 import org.simantics.scl.compiler.elaboration.query.compilation.QueryCompilationContext;
9 import org.simantics.scl.compiler.elaboration.relations.AbstractRelation;
10 import org.simantics.scl.compiler.types.TVar;
11 import org.simantics.scl.compiler.types.Type;
12 import org.simantics.scl.compiler.types.Types;
13 import org.simantics.scl.compiler.types.kinds.Kinds;
15 public class ExecuteRelation extends AbstractRelation {
18 public ExecuteRelation(int phase) {
22 private static TVar A = Types.var(Kinds.STAR);
23 private static TVar E = Types.var(Kinds.EFFECT);
24 private static TVar[] TYPE_VARIABLES = new TVar[] {A, E};
27 public TVar[] getTypeVariables() {
28 return TYPE_VARIABLES;
31 private static final Type[] PARAMETER_TYPES = new Type[] {Types.functionE(Types.PUNIT, E, A)};
34 public Type[] getParameterTypes() {
35 return PARAMETER_TYPES;
39 public int getPhase() {
44 public double getSelectivity(int boundVariables) {
45 return Double.POSITIVE_INFINITY;
49 public int getRequiredVariablesMask() {
54 public void generate(long location,
55 QueryCompilationContext context,
56 Type[] typeParameters, Variable[] parameters, int boundVariables) {
57 throw new IllegalArgumentException();
61 public Expression generateEnforce(long location, EnforcingContext context,
62 Type[] typeParameters,
63 Variable[] parameters) {
65 Expressions.var(parameters[0]),
70 public String toString() {