summaryrefslogtreecommitdiff
path: root/st/SymbolTable.java
diff options
context:
space:
mode:
Diffstat (limited to 'st/SymbolTable.java')
-rw-r--r--st/SymbolTable.java6
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);
}