1 package org.simantics.scl.compiler.elaboration.chr.plan;
3 import org.simantics.scl.compiler.compilation.CompilationContext;
4 import org.simantics.scl.compiler.elaboration.expressions.Expression;
5 import org.simantics.scl.compiler.elaboration.expressions.Variable;
6 import org.simantics.scl.compiler.elaboration.relations.SCLRelation;
7 import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;
9 public class IterateRelationOp extends PlanOp {
11 public SCLRelation relation;
12 public Variable[] variables;
13 public Expression[] expressions;
16 public IterateRelationOp(long location, SCLRelation relation, Variable[] variables, Expression[] expressions,
19 this.relation = relation;
20 this.variables = variables;
21 this.expressions = expressions;
22 this.boundMask = boundMask;
27 public void toString(StringBuilder b) {
28 b.append("ITERATE ").append(relation);
29 for(int i=0;i<expressions.length;++i)
30 if((boundMask & (1 << i)) != 0) {
31 b.append(" (").append(expressions[i]).append(")");
34 b.append(" ").append(variables[i]);
39 public void generateCode(CompilationContext context, PlanContext planContext, CodeWriter w) {
40 relation.generateIterate(planContext, w, location, boundMask, variables, expressions);