1 package org.simantics.scl.compiler.elaboration.expressions.block;
3 import org.simantics.scl.compiler.elaboration.contexts.EnvironmentalContext;
4 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
5 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
6 import org.simantics.scl.compiler.elaboration.expressions.Expression;
7 import org.simantics.scl.compiler.elaboration.query.Query;
8 import org.simantics.scl.compiler.errors.Locations;
10 public class RuleStatement extends Statement {
12 public Expression head;
15 public RuleStatement(Expression head, Query body) {
21 public Expression toExpression(EnvironmentalContext context, boolean monadic,
23 throw new UnsupportedOperationException();
27 public void setLocationDeep(long loc) {
28 if(location == Locations.NO_LOCATION) {
30 head.setLocationDeep(loc);
31 body.setLocationDeep(loc);
36 public void resolvePattern(TranslationContext context) {
37 head = head.resolveAsPattern(context);
41 public boolean mayBeRecursive() {
46 public Statement replace(ReplaceContext context) {
47 return new RuleStatement(head.replaceInPattern(context), body.replace(context));
51 public void accept(StatementVisitor visitor) {
56 public StatementGroup getStatementGroup() {
57 return StatementGroup.Rule;