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