]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EVariable.java
Property following functions value and possibleValue to ontology modules
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / expressions / EVariable.java
index fccc62e9869cfc4f5469d2804588d4ed465baf41..155aa7578f3821d399e0e2fd227791a65e1850d7 100644 (file)
@@ -22,9 +22,6 @@ import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.compiler.types.kinds.Kinds;
 import org.simantics.scl.compiler.types.util.TypeUnparsingContext;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.TIntHashSet;
-
 public class EVariable extends Expression {
     public static final EVariable[] EMPTY_ARRAY = new EVariable[0];
     
@@ -47,14 +44,6 @@ public class EVariable extends Expression {
         this.variable = variable;
     }
 
-    @Override
-    public void collectVars(TObjectIntHashMap<Variable> allVars,
-            TIntHashSet vars) {
-        int id = allVars.get(variable);
-        if(id >= 0)
-            vars.add(id);
-    }
-    
     @Override
     public Set<Variable> getFreeVariables() {
         if(variable == null)
@@ -143,8 +132,13 @@ public class EVariable extends Expression {
             variable.setType(Types.metaVar(Kinds.STAR));
             return this;
         }
-        else
+        else {
+            if(variable.getType() == null) {
+                context.getErrorLog().log(location, "Type of the variable is not defined.");
+                variable.setType(Types.metaVar(Kinds.STAR));
+            }
             return applyPUnit(context);
+        }
     }
     
     @Override
@@ -153,8 +147,13 @@ public class EVariable extends Expression {
             variable.setType(requiredType);
             return this;
         }
-        else
+        else {
+            if(variable.getType() == null) {
+                context.getErrorLog().log(location, "Type of the variable is not defined.");
+                variable.setType(Types.metaVar(Kinds.STAR));
+            }
             return context.subsume(this, requiredType);
+        }
     }
     
     @Override