]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ECHRRulesetConstructor.java
Refactoring CHR handling code
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / ECHRRulesetConstructor.java
index 5d7b490e70c7d2617d6ac00de39cdd88c491e70c..dbba5a5390d93a99a5a010ea5baad5bc23bcb627 100644 (file)
@@ -13,9 +13,6 @@ import org.simantics.scl.compiler.internal.interpreted.IExpression;
 import org.simantics.scl.compiler.top.ExpressionInterpretationContext;
 import org.simantics.scl.compiler.types.exceptions.MatchException;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.TIntHashSet;
-
 public class ECHRRulesetConstructor extends Expression {
     public CHRRuleset ruleset;
     
@@ -23,11 +20,6 @@ public class ECHRRulesetConstructor extends Expression {
         this.ruleset = ruleset;
     }
 
-    @Override
-    public void collectVars(TObjectIntHashMap<Variable> allVars, TIntHashSet vars) {
-        ruleset.collectVars(allVars, vars);
-    }
-
     @Override
     protected void updateType() throws MatchException {
         throw new InternalCompilerError("Type of ECHRRulesetConstructor should be already given.");
@@ -43,7 +35,7 @@ public class ECHRRulesetConstructor extends Expression {
         context.pushFrame();
         context.pushCHRConstraintFrame();
         ruleset.resolve(context);
-        context.popCHRConstraintFrame(ruleset.constraints);
+        context.popCHRConstraintFrame(ruleset);
         context.popFrame();
         return this;
     }
@@ -67,8 +59,7 @@ public class ECHRRulesetConstructor extends Expression {
     
     @Override
     public Expression simplify(SimplificationContext context) {
-        ruleset.simplify(context);
-        ruleset.compile(context);
+        ruleset.simplifyAndCompileIfNeeded(context);
         return this;
     }