]> 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 7b7338a78e2f07efe17b4731a80b709c7635aa35..811877aa0b618c6052933cfece5f05163ddff3d9 100644 (file)
@@ -21,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,14 +36,6 @@ public class ELet extends Expression {
         this.in = in;
     }
     
-    @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 {
         setType(in.getType());
@@ -118,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.");
@@ -172,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);
     }
@@ -204,15 +186,6 @@ public class ELet extends Expression {
         in = in.checkIgnoredType(context);
         return 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) {