]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java
Collect reference hierarchy for SCL values
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / EApply.java
index 375039e0b6ec76173e300bc0e000175b1d7e395e..5d915a98dce93b2ac88e2476effaed460e2d25ba 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) {
@@ -296,7 +265,7 @@ public class EApply extends Expression {
     @Override
     public Expression checkIgnoredType(TypingContext context) {
         if(parameters.length == 2 && function instanceof EConstant && ((EConstant)function).value.getName() == Names.Prelude_dollar)
-            return new EApply(location, parameters[0], parameters[1]).inferType(context);
+            return new EApply(location, parameters[0], parameters[1]).checkIgnoredType(context);
         inferType(context, true);
         if(Types.canonical(getType()) != Types.UNIT)
             return new ESimpleLet(location, null, this, new ELiteral(NoRepConstant.PUNIT));
@@ -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);