(refs #7322) Implemented visitors for CHRStatement
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / block / CHRStatement.java
1 package org.simantics.scl.compiler.elaboration.expressions.block;
2
3 import org.simantics.scl.compiler.elaboration.contexts.EnvironmentalContext;
4 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
5 import org.simantics.scl.compiler.elaboration.expressions.Expression;
6 import org.simantics.scl.compiler.elaboration.expressions.list.ListQualifier;
7 import org.simantics.scl.compiler.errors.Locations;
8
9 public class CHRStatement extends Statement {
10
11     public ListQualifier[] head;
12     public ListQualifier[] body;
13
14     public CHRStatement(ListQualifier[] head, ListQualifier[] body) {
15         this.head = head;
16         this.body = body;
17     }
18
19     @Override
20     public Expression toExpression(EnvironmentalContext context, boolean monadic, Expression in) {
21         throw new UnsupportedOperationException();
22     }
23
24     @Override
25     public void setLocationDeep(long loc) {
26         if(location == Locations.NO_LOCATION) {
27             location = loc;
28             for(ListQualifier lq : head)
29                 lq.setLocationDeep(loc);
30             for(ListQualifier lq : body)
31                 lq.setLocationDeep(loc);
32         }
33     }
34
35     @Override
36     public void resolvePattern(TranslationContext context) {
37         throw new UnsupportedOperationException();
38     }
39
40     @Override
41     public boolean mayBeRecursive() {
42         return true;
43     }
44
45     @Override
46     public void accept(StatementVisitor visitor) {
47         visitor.visit(this);
48     }
49     
50     @Override
51     public StatementGroup getStatementGroup() {
52         return StatementGroup.CHR;
53     }
54
55 }