]> gerrit.simantics Code Review - simantics/platform.git/blob
aa87378738bc4ef27205ea239d80ca1fe0a3d222
[simantics/platform.git] /
1 package org.simantics.scl.compiler.elaboration.chr.plan;
2
3
4 import org.simantics.scl.compiler.compilation.CompilationContext;
5 import org.simantics.scl.compiler.elaboration.expressions.Expression;
6 import org.simantics.scl.compiler.elaboration.expressions.Variable;
7 import org.simantics.scl.compiler.internal.codegen.references.IVal;
8 import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;
9
10 public class IterateListOp extends PlanOp {
11     public Variable variable;
12     public Expression list;
13     
14     public IterateListOp(long location, Variable variable, Expression list) {
15         super(location);
16         this.variable = variable;
17         this.list = list;
18     }  
19     
20     @Override
21     public void toString(StringBuilder b) {
22         b.append("ITERATE ").append(variable).append(" <- ").append(list);
23     }
24
25     @Override
26     public void generateCode(CompilationContext context, PlanContext planContext, CodeWriter w) {
27         IVal listValue = list.toVal(context.environment, w);
28         planContext.iterateList(location, w, variable, listValue);
29     }
30 }