]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELet.java
SCL compiler generates line numbers to bytecode
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / ELet.java
index a90c6186d78f8e1e2690d5dab745d56cde171de7..811877aa0b618c6052933cfece5f05163ddff3d9 100644 (file)
@@ -14,7 +14,6 @@ import org.simantics.scl.compiler.internal.codegen.references.IVal;
 import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;
 import org.simantics.scl.compiler.internal.codegen.writer.RecursiveDefinitionWriter;
 import org.simantics.scl.compiler.internal.elaboration.decomposed.DecomposedExpression;
-import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;
 import org.simantics.scl.compiler.internal.elaboration.utils.StronglyConnectedComponents;
 import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;
@@ -22,7 +21,6 @@ import org.simantics.scl.compiler.types.exceptions.MatchException;
 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;
 
 /**
@@ -37,21 +35,6 @@ public class ELet extends Expression {
         this.assignments = assignments;
         this.in = in;
     }
-
-    @Override
-    public void collectRefs(final TObjectIntHashMap<Object> allRefs, final TIntHashSet refs) {
-        for(Assignment assign : assignments)
-            assign.value.collectRefs(allRefs, refs);
-        in.collectRefs(allRefs, refs);
-    }
-    
-    @Override
-    public void collectVars(TObjectIntHashMap<Variable> allVars,
-            TIntHashSet vars) {
-        for(Assignment assign : assignments)
-            assign.value.collectVars(allVars, vars);
-        in.collectVars(allVars, vars);
-    }
     
     @Override
     protected void updateType() throws MatchException {
@@ -126,15 +109,6 @@ public class ELet extends Expression {
         return result;
     }
 
-    @Override
-    public void collectFreeVariables(THashSet<Variable> vars) {
-        in.collectFreeVariables(vars);
-        for(Assignment assign : assignments)
-            assign.value.collectFreeVariables(vars);
-        for(Assignment assign : assignments) 
-            assign.pattern.removeFreeVariables(vars);
-    }
-
     @Override
     public Expression resolve(TranslationContext context) {
         throw new InternalCompilerError("ELet should be already resolved.");
@@ -180,7 +154,7 @@ public class ELet extends Expression {
             IVal[] parameters = newW.getParameters();
             for(int j=0;j<parameters.length;++j)
                 decomposed.parameters[j].setVal(parameters[j]);
-            newW.return_(decomposed.body.toVal(context, newW));
+            newW.return_(assignments[i].value.location, decomposed.body.toVal(context, newW));
         }
         return in.toVal(context, w);
     }
@@ -212,23 +186,6 @@ public class ELet extends Expression {
         in = in.checkIgnoredType(context);
         return this;
     }
-
-    @Override
-    public Expression decorate(ExpressionDecorator decorator) {
-        in = in.decorate(decorator);
-        for(Assignment assignment : assignments)
-            assignment.decorate(decorator);
-        return decorator.decorate(this);
-    }
-
-    @Override
-    public void collectEffects(THashSet<Type> effects) {
-        for(Assignment assignment : assignments) {
-            assignment.pattern.collectEffects(effects);
-            assignment.value.collectEffects(effects);
-        }
-        in.collectEffects(effects);
-    }
     
     @Override
     public void setLocationDeep(long loc) {
@@ -244,13 +201,6 @@ public class ELet extends Expression {
     public void accept(ExpressionVisitor visitor) {
         visitor.visit(this);
     }
-
-    @Override
-    public void forVariables(VariableProcedure procedure) {
-        for(Assignment assignment : assignments)
-            assignment.forVariables(procedure);
-        in.forVariables(procedure);
-    }
     
     @Override
     public Expression accept(ExpressionTransformer transformer) {