diff options
Diffstat (limited to 'st')
-rw-r--r-- | st/AbstractInstance.java | 2 | ||||
-rw-r--r-- | st/SymbolTable.java | 25 |
2 files changed, 20 insertions, 7 deletions
diff --git a/st/AbstractInstance.java b/st/AbstractInstance.java index 4e4287d..6db9d3c 100644 --- a/st/AbstractInstance.java +++ b/st/AbstractInstance.java @@ -18,7 +18,7 @@ public abstract class AbstractInstance { return this.name; } - @Override public boolean equals(AbstractInstance other) { + public boolean equals(AbstractInstance other) { return this.name == other.getName() && this.type == this.type; } diff --git a/st/SymbolTable.java b/st/SymbolTable.java index e3dd398..77b8a93 100644 --- a/st/SymbolTable.java +++ b/st/SymbolTable.java @@ -1,6 +1,7 @@ package st; import java.util.*; +import misc.*; /** * Class which provides methods for interacting with and managing @@ -103,23 +104,35 @@ public class SymbolTable { public TypeInstance getType(String id) { AbstractInstance symbol; - return ((symbol = this.symt.get(id)) != - null && symbol instanceof TypeInstance) ? + TypeInstance ret = ((symbol = this.symt.get(id)) != + null && symbol instanceof TypeInstance) ? (TypeInstance) symbol : null; + if (ret == null) + MinimalLogger.severe(String.format("getType returning null for missing alias %s!", + id)); + return ret; } public MethodInstance getMethod(String id) { AbstractInstance symbol; - return ((symbol = this.symt.get(id)) != - null && symbol instanceof MethodInstance) ? + MethodInstance ret = ((symbol = this.symt.get(id)) != + null && symbol instanceof MethodInstance) ? (MethodInstance) symbol : null; + if (ret == null) + MinimalLogger.severe(String.format("getMethod returning null for missing alias %s!", + id)); + return ret; } public ClassInstance getClass(String id) { AbstractInstance symbol; - return ((symbol = this.symt.get(id)) != - null && symbol instanceof ClassInstance) ? + ClassInstance ret = ((symbol = this.symt.get(id)) != + null && symbol instanceof ClassInstance) ? (ClassInstance) symbol : null; + if (ret == null) + MinimalLogger.severe(String.format("getClass returning null for missing alias %s!", + id)); + return ret; } public String getActive(TypeEnum type) { |