(refs #7322) Implemented visitors for CHRStatement 77/677/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Tue, 4 Jul 2017 10:15:25 +0000 (13:15 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Tue, 4 Jul 2017 10:15:25 +0000 (13:15 +0300)
Change-Id: I2f1b3b48fbb2060ba894cf209a9053a42bdf6560

bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/StandardExpressionTransformer.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/StandardExpressionVisitor.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/block/CHRStatement.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/block/StatementVisitor.java

index ac61eb4866844c1822abf0c7323f958df6b9cbaa..1bd0d22c4ec4b7f4a075f0375da97a53075714c0 100644 (file)
@@ -9,6 +9,7 @@ import org.simantics.scl.compiler.elaboration.equation.Equation;
 import org.simantics.scl.compiler.elaboration.equation.EquationVisitor;
 import org.simantics.scl.compiler.elaboration.expressions.accessor.ExpressionAccessor;
 import org.simantics.scl.compiler.elaboration.expressions.block.BindStatement;
+import org.simantics.scl.compiler.elaboration.expressions.block.CHRStatement;
 import org.simantics.scl.compiler.elaboration.expressions.block.GuardStatement;
 import org.simantics.scl.compiler.elaboration.expressions.block.IncludeStatement;
 import org.simantics.scl.compiler.elaboration.expressions.block.LetStatement;
@@ -517,4 +518,12 @@ EquationVisitor {
         equation.guard =  equation.guard.accept(this);
     }
 
+    @Override
+    public void visit(CHRStatement statement) {
+        for(int i=0;i<statement.body.length;++i)
+            statement.body[i] = statement.body[i].accept(this);
+        for(int i=0;i<statement.head.length;++i)
+            statement.head[i] = statement.head[i].accept(this);
+    }
+
 }
index be9be3109c75fe29a08fe119f88529a8788519aa..b7ce06d92fc4ea01e3f9660ba8465514b26afda1 100644 (file)
@@ -13,6 +13,7 @@ import org.simantics.scl.compiler.elaboration.expressions.accessor.FieldAccessor
 import org.simantics.scl.compiler.elaboration.expressions.accessor.IdAccessor;
 import org.simantics.scl.compiler.elaboration.expressions.accessor.StringAccessor;
 import org.simantics.scl.compiler.elaboration.expressions.block.BindStatement;
+import org.simantics.scl.compiler.elaboration.expressions.block.CHRStatement;
 import org.simantics.scl.compiler.elaboration.expressions.block.GuardStatement;
 import org.simantics.scl.compiler.elaboration.expressions.block.IncludeStatement;
 import org.simantics.scl.compiler.elaboration.expressions.block.LetStatement;
@@ -22,6 +23,7 @@ import org.simantics.scl.compiler.elaboration.expressions.block.StatementVisitor
 import org.simantics.scl.compiler.elaboration.expressions.list.ListAssignment;
 import org.simantics.scl.compiler.elaboration.expressions.list.ListGenerator;
 import org.simantics.scl.compiler.elaboration.expressions.list.ListGuard;
+import org.simantics.scl.compiler.elaboration.expressions.list.ListQualifier;
 import org.simantics.scl.compiler.elaboration.expressions.list.ListQualifierVisitor;
 import org.simantics.scl.compiler.elaboration.expressions.list.ListSeq;
 import org.simantics.scl.compiler.elaboration.expressions.list.ListThen;
@@ -443,4 +445,12 @@ EquationVisitor, StatementVisitor {
     public void visit(IncludeStatement statement) {
         statement.value.accept(this);
     }
+    
+    @Override
+    public void visit(CHRStatement statement) {
+        for(ListQualifier q : statement.body)
+            q.accept(this);
+        for(ListQualifier q : statement.head)
+            q.accept(this);
+    }
 }
index a0efc8862b4b96e003730f3fbf06b37ff8edae59..d58f9c360e79c072eeb2723b8216466913a4c8b5 100644 (file)
@@ -44,7 +44,7 @@ public class CHRStatement extends Statement {
 
     @Override
     public void accept(StatementVisitor visitor) {
-        throw new UnsupportedOperationException();
+        visitor.visit(this);
     }
     
     @Override
index 2d90774feff1345c144be9392015537ad86417e8..a81cea78bfc512a5cc75b1509fd1ccbe204d2556 100644 (file)
@@ -6,4 +6,5 @@ public interface StatementVisitor {
     void visit(LetStatement statement);
     void visit(RuleStatement statement);
     void visit(IncludeStatement statement);
+    void visit(CHRStatement statement);
 }