]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIf.java
SCL compiler generates line numbers to bytecode
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / EIf.java
index 7b56d22fa2991bba35ef28d73240015326917c8e..149c52f500235d5f732aa4a12f744b3d75851bc7 100644 (file)
@@ -17,10 +17,6 @@ import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.runtime.tuple.Tuple0;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 public class EIf extends Expression {
     public Expression condition;
     public Expression then_;
@@ -39,15 +35,6 @@ public class EIf extends Expression {
         this.else_ = else_;
     }
 
-    @Override
-    public void collectVars(TObjectIntHashMap<Variable> allVars,
-            TIntHashSet vars) {
-        condition.collectVars(allVars, vars);
-        then_.collectVars(allVars, vars);
-        if(else_ != null)
-            else_.collectVars(allVars, vars);
-    }
-
     @Override
     protected void updateType() throws MatchException {
         setType(then_.getType());
@@ -60,29 +47,21 @@ public class EIf extends Expression {
         CodeWriter thenBlock = w.createBlock();
         if(else_ != null) {
             CodeWriter elseBlock = w.createBlock();        
-            w.if_(conditionVal, thenBlock.getContinuation(), elseBlock.getContinuation());
+            w.if_(location, conditionVal, thenBlock.getContinuation(), elseBlock.getContinuation());
                 
             IVal elseVal = else_.toVal(context, elseBlock);
-            elseBlock.jump(joinPoint.getContinuation(), elseVal);
+            elseBlock.jump(location, joinPoint.getContinuation(), elseVal);
         }
         else {
-            w.if_(conditionVal, thenBlock.getContinuation(), joinPoint.getContinuation());
+            w.if_(location, conditionVal, thenBlock.getContinuation(), joinPoint.getContinuation());
         }
         IVal thenVal = then_.toVal(context, thenBlock);
-        thenBlock.jump(joinPoint.getContinuation(), thenVal);
+        thenBlock.jump(location, joinPoint.getContinuation(), thenVal);
         w.continueAs(joinPoint);
         
         return w.getParameters()[0];
     }
 
-    @Override
-    public void collectFreeVariables(THashSet<Variable> vars) {
-        condition.collectFreeVariables(vars);
-        then_.collectFreeVariables(vars);
-        if(else_ != null)
-            else_.collectFreeVariables(vars);
-    }
-
     @Override
     public Expression simplify(SimplificationContext context) {
         condition = condition.simplify(context);