]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java
(refs #7375) Replaced collectFreeVariables method by a visitor
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / EBind.java
index d950e7b738eb07124ae4e6549437c7b9ffb7dfb1..ce72e282aa2a58b1d1e59030d739fe8f89c46c27 100644 (file)
@@ -9,7 +9,6 @@ import org.simantics.scl.compiler.elaboration.modules.SCLValue;
 import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.internal.codegen.references.IVal;
 import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;
-import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;
 import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.MatchException;
@@ -17,14 +16,13 @@ import org.simantics.scl.compiler.types.exceptions.UnificationException;
 import org.simantics.scl.compiler.types.kinds.Kinds;
 
 import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
 import gnu.trove.set.hash.TIntHashSet;
 
 public class EBind extends SimplifiableExpression {
     public Expression pattern;
     public Expression value;
     public Expression in;
-    private EVariable monadEvidence;
+    public EVariable monadEvidence;
     SCLValue bindFunction;
     Type monadType;
     Type valueContentType;
@@ -44,12 +42,6 @@ public class EBind extends SimplifiableExpression {
         this.value = value;
         this.in = in;
     }
-
-    @Override
-    public void collectRefs(final TObjectIntHashMap<Object> allRefs, final TIntHashSet refs) {
-        value.collectRefs(allRefs, refs);
-        in.collectRefs(allRefs, refs);
-    }
     
     @Override
     public void collectVars(TObjectIntHashMap<Variable> allVars,
@@ -117,13 +109,6 @@ public class EBind extends SimplifiableExpression {
         return simplified.simplify(context);
     }
 
-    @Override
-    public void collectFreeVariables(THashSet<Variable> vars) {
-        in.collectFreeVariables(vars);
-        value.collectFreeVariables(vars);
-        pattern.removeFreeVariables(vars);
-    }
-
     @Override
     public Expression resolve(TranslationContext context) {
         value = value.resolve(context);
@@ -138,21 +123,6 @@ public class EBind extends SimplifiableExpression {
         return this; 
     }
     
-    @Override
-    public Expression decorate(ExpressionDecorator decorator) {
-        pattern = pattern.decorate(decorator);
-        value = value.decorate(decorator);
-        in = in.decorate(decorator);
-        return decorator.decorate(this);
-    }
-
-    @Override
-    public void collectEffects(THashSet<Type> effects) {
-        pattern.collectEffects(effects);
-        value.collectEffects(effects);
-        in.collectEffects(effects);
-    }
-    
     @Override
     public void setLocationDeep(long loc) {
         if(location == Locations.NO_LOCATION) {
@@ -167,14 +137,6 @@ public class EBind extends SimplifiableExpression {
     public void accept(ExpressionVisitor visitor) {
         visitor.visit(this);
     }
-
-    @Override
-    public void forVariables(VariableProcedure procedure) {
-        pattern.forVariables(procedure);
-        value.forVariables(procedure);
-        if(monadEvidence != null)
-            monadEvidence.forVariables(procedure);
-    }
     
     @Override
     public Expression accept(ExpressionTransformer transformer) {