]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java
(refs #7375) Replaced collectVars method by a visitor
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / EApply.java
index 375039e0b6ec76173e300bc0e000175b1d7e395e..02c7dff4585c95e0d55d7bf485266f90327b31e6 100644 (file)
@@ -32,14 +32,10 @@ import org.simantics.scl.compiler.types.exceptions.UnificationException;
 import org.simantics.scl.compiler.types.kinds.Kinds;
 import org.simantics.scl.compiler.types.util.MultiFunction;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 public class EApply extends Expression {
     public Expression function;
     public Expression[] parameters;
-    Type effect = Types.NO_EFFECTS;
+    public Type effect = Types.NO_EFFECTS;
     
     public EApply(Expression function, Expression ... parameters) {
         this.function = function;
@@ -75,22 +71,9 @@ public class EApply extends Expression {
     public Expression[] getParameters() {
         return parameters;
     }
-    
 
-    public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {
-        function.collectRefs(allRefs, refs);
-        for(Expression parameter : parameters)
-            parameter.collectRefs(allRefs, refs);
-    }
-    
-    public void collectVars(TObjectIntHashMap<Variable> allVars, TIntHashSet vars) {
-        function.collectVars(allVars, vars);
-        for(Expression parameter : parameters)
-            parameter.collectVars(allVars, vars);
-    }
-       
-       @Override
-       protected void updateType() throws MatchException {
+    @Override
+    protected void updateType() throws MatchException {
         MultiFunction mfun = Types.matchFunction(function.getType(), parameters.length);
         /*for(int i=0;i<parameters.length;++i)
             if(!Types.equals(parameters[i].getType(), mfun.parameterTypes[i]))
@@ -109,13 +92,6 @@ public class EApply extends Expression {
         effect = Types.simplifyFinalEffect(effect);
         return w.applyWithEffect(location, effect, type, functionVal, parameterVals);
     }
-
-    @Override
-    public void collectFreeVariables(THashSet<Variable> vars) {
-        function.collectFreeVariables(vars);
-        for(Expression parameter : parameters)
-            parameter.collectFreeVariables(vars);
-    }
     
     private void combineApplications() {
         if(function instanceof EApply) {
@@ -193,13 +169,6 @@ public class EApply extends Expression {
         for(Expression parameter : this.parameters)
             parameters.add(parameter);
     }
-    
-    @Override
-    public void removeFreeVariables(THashSet<Variable> vars) {
-        function.removeFreeVariables(vars);
-        for(Expression parameter : parameters)
-            parameter.removeFreeVariables(vars);
-    }
 
     @Override
     public Expression replace(ReplaceContext context) {
@@ -347,14 +316,6 @@ public class EApply extends Expression {
         return function.isConstructorApplication();
     }
 
-    @Override
-    public void collectEffects(THashSet<Type> effects) {
-        effects.add(effect);
-        function.collectEffects(effects);
-        for(Expression parameter : parameters)
-            parameter.collectEffects(effects);
-    }
-
     @Override
     public void accept(ExpressionVisitor visitor) {
         visitor.visit(this);