diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-23 15:04:43 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-23 15:04:43 -0600 |
commit | 1cbc6acab2c1bd745649a639db023b0f6c87f821 (patch) | |
tree | cccc43f8849c00cf6d90806156e9a8c918a08248 /st/SymbolTable.java | |
parent | df648047d1899345dd8b2d82f78b480712d4d8d6 (diff) |
Cleanup BoilSimp -> BoilVisitor
Diffstat (limited to 'st/SymbolTable.java')
-rw-r--r-- | st/SymbolTable.java | 25 |
1 files changed, 19 insertions, 6 deletions
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) { |