]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/plan/CheckOp.java
Merge "Improved Statement API in Simantics/DB"
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / chr / plan / CheckOp.java
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.internal.codegen.writer.CodeWriter;
6
7 public class CheckOp extends PlanOp {
8     public Expression condition;
9
10     public CheckOp(long location, Expression condition) {
11         super(location);
12         this.condition = condition;
13     }
14     
15     @Override
16     public void toString(StringBuilder b) {
17         b.append("CHECK   ").append(condition);
18     }
19
20     @Override
21     public void generateCode(CompilationContext context, PlanContext planContext, CodeWriter w) {
22         planContext.check(location, w, condition.toVal(context.environment, w));
23     }
24 }