]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/chr/CHRQuery.java
(refs #7375) Fixed implementation of collectEffects
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / chr / CHRQuery.java
index 5cb0f2aee230acb6f79838fd358612c81edc024f..c7ac33d889f208dade23dee4d78daee3d500b963 100644 (file)
@@ -9,13 +9,11 @@ import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
 import org.simantics.scl.compiler.elaboration.expressions.Expression;
 import org.simantics.scl.compiler.elaboration.expressions.Variable;
-import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure;
 import org.simantics.scl.compiler.elaboration.expressions.printing.ExpressionToStringVisitor;
 import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.internal.parsing.Symbol;
 
 import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
 import gnu.trove.set.hash.TIntHashSet;
 
 public class CHRQuery extends Symbol {
@@ -30,11 +28,6 @@ public class CHRQuery extends Symbol {
             literal.resolve(context);
     }
 
-    public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {
-        for(CHRLiteral literal : literals)
-            literal.collectRefs(allRefs, refs);
-    }
-
     public void checkType(TypingContext context) {
         for(CHRLiteral literal : literals)
             literal.checkType(context);
@@ -44,17 +37,7 @@ public class CHRQuery extends Symbol {
         for(CHRLiteral literal : literals)
             literal.collectVars(allVars, vars);
     }
-
-    public void forVariables(VariableProcedure procedure) {
-        for(CHRLiteral literal : literals)
-            literal.forVariables(procedure);
-    }
-
-    public void collectFreeVariables(THashSet<Variable> vars) {
-        for(CHRLiteral literal : literals)
-            literal.collectFreeVariables(vars);
-    }
-
+    
     public void setLocationDeep(long loc) {
         if(location == Locations.NO_LOCATION) {
             this.location = loc;
@@ -71,7 +54,7 @@ public class CHRQuery extends Symbol {
             else
                 context.add(literal, i);
         }
-        if(activeLiteralId == -1) {
+        if(activeLiteralId == -1 && inputFact != null) {
             context.addInitFact(initConstraint, inputFact);
         }      
         return context.createQueryPlan();