]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIf.java
Merge "possibleVariable into Simantics/Variables"
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / EIf.java
index 661de4261e260c09b1cd543f3ac5e2dc97df7339..ea64ac034c152e120f6472902233a246e1fcb5cf 100644 (file)
@@ -8,7 +8,6 @@ import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
 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.IConstant;
 import org.simantics.scl.compiler.internal.interpreted.IExpression;
 import org.simantics.scl.compiler.internal.interpreted.IIf;
@@ -40,29 +39,22 @@ public class EIf extends Expression {
         this.else_ = else_;
     }
 
-       public void collectRefs(TObjectIntHashMap<Object> allRefs, TIntHashSet refs) {
-        condition.collectRefs(allRefs, refs);
-        then_.collectRefs(allRefs, refs);
-        if(else_ != null)
-            else_.collectRefs(allRefs, refs);
-    }
-
-       @Override
-       public void collectVars(TObjectIntHashMap<Variable> allVars,
-               TIntHashSet vars) {
-           condition.collectVars(allVars, vars);
+    @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());
+    }
 
-       @Override
-       protected void updateType() throws MatchException {
-           setType(then_.getType());
-       }
-       
-       @Override
-       public IVal toVal(CompilationContext context, CodeWriter w) {
+    @Override
+    public IVal toVal(CompilationContext context, CodeWriter w) {
         IVal conditionVal = condition.toVal(context, w); 
         CodeWriter joinPoint = w.createBlock(getType());
         CodeWriter thenBlock = w.createBlock();
@@ -136,15 +128,6 @@ public class EIf extends Expression {
         return this;
     }
     
-    @Override
-    public Expression decorate(ExpressionDecorator decorator) {
-        condition = condition.decorate(decorator);
-        then_ = then_.decorate(decorator);
-        if(else_ != null)
-            else_ = else_.decorate(decorator);        
-        return decorator.decorate(this);
-    }
-    
     @Override
     public boolean isEffectful() {
        return condition.isEffectful() || then_.isEffectful() || (else_ != null && else_.isEffectful());
@@ -180,13 +163,6 @@ public class EIf extends Expression {
                 else_ != null ? else_.toIExpression(target) : new IConstant(Tuple0.INSTANCE));
     }
 
-    @Override
-    public void forVariables(VariableProcedure procedure) {
-        condition.forVariables(procedure);
-        then_.forVariables(procedure);
-        if(else_ != null)
-            else_.forVariables(procedure);
-    }
     @Override
     public Expression accept(ExpressionTransformer transformer) {
         return transformer.transform(this);