summaryrefslogtreecommitdiff
path: root/st
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-09 23:48:26 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-09 23:48:26 -0600
commit61a28b7f8e709d1884ccab15f0dc38ed19dfde70 (patch)
tree4a08bf487d7a18cc8cd328876067e57d261920f6 /st
parentc1e124b957fa840f7bd8da9ffc6871140cfabf16 (diff)
Partial arguments in Vaporize.MessageSend, Typecheck for milestone
Diffstat (limited to 'st')
-rw-r--r--st/SymTableTopDown.java4
-rw-r--r--st/SymbolTable.java4
2 files changed, 5 insertions, 3 deletions
diff --git a/st/SymTableTopDown.java b/st/SymTableTopDown.java
index a4c641c..2f65919 100644
--- a/st/SymTableTopDown.java
+++ b/st/SymTableTopDown.java
@@ -116,7 +116,9 @@ public class SymTableTopDown<R> extends GJDepthFirst<R,SymbolTable> {
* f2 -> ";"
*/
public R visit(VarDeclaration n, SymbolTable symt) {
- String cls = ((Identifier) n.f0.f0.choice).f0.tokenImage;
+ String cls = (n.f0.f0.which == 4) ?
+ ((Identifier) n.f0.f0.choice).f0.tokenImage :
+ null;
String id = n.f1.f0.tokenImage;
symt.addLocal(id);
symt.addClassInstance(id, cls);
diff --git a/st/SymbolTable.java b/st/SymbolTable.java
index 1c0af09..93d3af9 100644
--- a/st/SymbolTable.java
+++ b/st/SymbolTable.java
@@ -8,8 +8,8 @@ import java.util.*;
* of each symbol consistent.
*/
public class SymbolTable {
- private HashMap<String,AbstractInstance> symt; // the mapping of ids to Instances
- private HashMap<TypeEnum,String> active; // the current scope of the visitor (class, method)
+ private HashMap<String,AbstractInstance> symt; // the mapping of ids to Instances
+ private HashMap<TypeEnum,String> active; // the current scope of the visitor (class, method)
public SymbolTable() {
this.symt = new HashMap<>();