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];
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)
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
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