From e2d7b563cd22b92604e07dad9bf6bcf0393a46ca Mon Sep 17 00:00:00 2001 From: bd-912 Date: Fri, 26 Apr 2024 19:36:16 -0600 Subject: HeatVisitor MessageSend anonymous, observe Factorial + others pass --- st/SymbolTable.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'st/SymbolTable.java') 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); } -- cgit v1.2.3