]> gerrit.simantics Code Review - simantics/platform.git/blob
00368a252f0a28f33163ea10603b691d3a313593
[simantics/platform.git] /
1 package org.simantics.scl.compiler.elaboration.chr.plan;
2
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.internal.codegen.writer.CodeWriter;
7
8 public class AssignOp extends PlanOp {
9     public Variable variable;
10     public Expression expression;
11    
12     public AssignOp(long location, Variable variable, Expression expression) {
13         super(location);
14         this.variable = variable;
15         this.expression = expression;
16     }
17
18     @Override
19     public void toString(StringBuilder b) {
20         b.append("ASSIGN  ").append(variable).append(" = ").append(expression);
21     }
22
23     @Override
24     public void generateCode(CompilationContext context, PlanContext planContext, CodeWriter w) {
25         variable.setVal(expression.toVal(context.environment, w));
26         planContext.nextOp(w);
27     }
28
29     
30 }