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.internal.codegen.writer.CodeWriter;
8 public class AssignOp extends PlanOp {
9 public Variable variable;
10 public Expression expression;
12 public AssignOp(long location, Variable variable, Expression expression) {
14 this.variable = variable;
15 this.expression = expression;
19 public void toString(StringBuilder b) {
20 b.append("ASSIGN ").append(variable).append(" = ").append(expression);
24 public void generateCode(CompilationContext context, PlanContext planContext, CodeWriter w) {
25 variable.setVal(expression.toVal(context.environment, w));
26 planContext.nextOp(w);