package st; public class TypeInstance extends AbstractInstance { private AbstractInstance scope; public TypeInstance(String name, TypeEnum type) { super(name, type); this.scope = null; } public boolean sameType(TypeInstance other) { /** * Given a TypeInstance object other, * returns true if other object * is the same type as this one. * * We can say two types are equal, as * long as they are not equal on a * type error! */ return this.type != TypeEnum.ERROR && this.type == other.getType(); } public boolean hasChecked() { return type != TypeEnum.ERROR; } public AbstractInstance getScope() { /** * Returns the scope of the variable, or * `null' if unset. */ return this.scope; } }