]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EConstant.java
(refs #7371) Support expression cloning for ECHRSelect
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / EConstant.java
index 4a2e07f431cd9410889c2275980aaf70819dc55f..a668fe12b1cb036f17c69d477283bf01a0dc488f 100644 (file)
@@ -1,6 +1,8 @@
 package org.simantics.scl.compiler.elaboration.expressions;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Set;
 
 import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.common.precedence.Precedence;
@@ -30,10 +32,6 @@ import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.compiler.types.util.MultiFunction;
 import org.simantics.scl.compiler.types.util.TypeUnparsingContext;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 public class EConstant extends Expression {
     public SCLValue value;
     Type[] typeParameters;
@@ -82,10 +80,10 @@ public class EConstant extends Expression {
             setType(Types.instantiate(getType(), type));
         return this;
     }
-
+    
     @Override
-    public void collectVars(TObjectIntHashMap<Variable> allVars,
-            TIntHashSet vars) {   
+    public Set<Variable> getFreeVariables() {
+        return Collections.emptySet();
     }
 
     public void toString(StringBuilder b, TypeUnparsingContext tuc) {
@@ -106,17 +104,13 @@ public class EConstant extends Expression {
         setType(Types.instantiate(value.getType(), typeParameters));
     }
     
-       @Override
-       public IVal toVal(CompilationContext context, CodeWriter w) {
-           IVal val = value.getValue();                
-           if(typeParameters.length > 0) {
-               val = val.createSpecialization(typeParameters);
-           }
-           return val;
-    }
-
     @Override
-    public void collectFreeVariables(THashSet<Variable> vars) {
+    public IVal toVal(CompilationContext context, CodeWriter w) {
+        IVal val = value.getValue();           
+        if(typeParameters.length > 0) {
+            val = val.createSpecialization(typeParameters);
+        }
+        return val;
     }
 
     @Override
@@ -151,10 +145,6 @@ public class EConstant extends Expression {
     public Expression resolveAsPattern(TranslationContext context) {
         return this;
     }
-       
-    @Override
-    public void removeFreeVariables(THashSet<Variable> vars) {     
-    }
 
     @Override
     public Expression replace(ReplaceContext context) {
@@ -230,11 +220,7 @@ public class EConstant extends Expression {
     
     @Override
     public boolean isEffectful() {
-       return false;
-    }
-
-    @Override
-    public void collectEffects(THashSet<Type> effects) {
+        return false;
     }
     
     @Override