diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-26 19:36:16 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-26 19:36:16 -0600 |
commit | e2d7b563cd22b92604e07dad9bf6bcf0393a46ca (patch) | |
tree | 539f081c254d31afe9574fa42f5629971d8a9eb5 /st/SymbolTable.java | |
parent | 42512ab2cfd16422909263475b044f40b3829707 (diff) |
HeatVisitor MessageSend anonymous, observe Factorial + others pass
Diffstat (limited to 'st/SymbolTable.java')
-rw-r--r-- | st/SymbolTable.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/st/SymbolTable.java b/st/SymbolTable.java index 90640c6..15d33a0 100644 --- a/st/SymbolTable.java +++ b/st/SymbolTable.java @@ -2,6 +2,7 @@ package st; import java.util.*; import misc.*; +import heat.TypecheckException; /** * Class which provides methods for interacting with and managing @@ -30,11 +31,16 @@ public class SymbolTable { /** * Methods intended to be used during the first pass + * + * Will always throw a typecheck error when symbols are not distinct. */ public void put(TokenKey id, AbstractInstance symbol) { MinimalLogger.info(String.format("Inserting %s -> %s", id, symbol.getType())); + if (this.symt.get(id) != null) + throw new TypecheckException(String.format("SymbolTable tried to place %s twice!", + id.toString())); this.symt.put(id, symbol); } |