]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambdaType.java
(refs #7375) Replaced collectFreeVariables method by a visitor
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / ELambdaType.java
old mode 100755 (executable)
new mode 100644 (file)
index 08e47bf..9aed445
@@ -1,24 +1,21 @@
 package org.simantics.scl.compiler.elaboration.expressions;
 
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
+import org.simantics.scl.compiler.compilation.CompilationContext;
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
-import org.simantics.scl.compiler.environment.Environment;
 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.internal.interpreted.IExpression;
 import org.simantics.scl.compiler.top.ExpressionInterpretationContext;
 import org.simantics.scl.compiler.types.TVar;
-import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.MatchException;
 
 import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
 import gnu.trove.set.hash.TIntHashSet;
 
 public class ELambdaType extends Expression {
@@ -31,29 +28,20 @@ public class ELambdaType extends Expression {
         this.value = value;
     }
 
-       public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {
-        value.collectRefs(allRefs, refs);
+    @Override
+    public void collectVars(TObjectIntHashMap<Variable> allVars,
+            TIntHashSet vars) {
+        value.collectVars(allVars, vars);
     }
-       
-       @Override
-       public void collectVars(TObjectIntHashMap<Variable> allVars,
-               TIntHashSet vars) {
-           value.collectVars(allVars, vars);
-       }
-       
-       @Override
-       protected void updateType() throws MatchException {
-           setType(Types.forAll(parameters, value.getType()));
-       }
 
-       @Override
-    public IVal toVal(Environment env, CodeWriter w) {
-        return lambdaToVal(env, w);
+    @Override
+    protected void updateType() throws MatchException {
+        setType(Types.forAll(parameters, value.getType()));
     }
 
     @Override
-    public void collectFreeVariables(THashSet<Variable> vars) {
-        value.collectFreeVariables(vars);
+    public IVal toVal(CompilationContext context, CodeWriter w) {
+        return lambdaToVal(context, w);
     }
 
     @Override
@@ -93,16 +81,6 @@ public class ELambdaType extends Expression {
         throw new InternalCompilerError("Should not type check " + getClass().getSimpleName() + ".");
     }
     
-    @Override
-    public Expression decorate(ExpressionDecorator decorator) {
-        value = value.decorate(decorator);
-        return decorator.decorate(this);
-    }
-
-    @Override
-    public void collectEffects(THashSet<Type> effects) {
-    }
-    
     @Override
     public void setLocationDeep(long loc) {
         if(location == Locations.NO_LOCATION) {
@@ -115,11 +93,6 @@ public class ELambdaType extends Expression {
     public void accept(ExpressionVisitor visitor) {
         visitor.visit(this);
     }
-
-    @Override
-    public void forVariables(VariableProcedure procedure) {
-        value.forVariables(procedure);
-    }
     
     @Override
     public Expression accept(ExpressionTransformer transformer) {