summaryrefslogtreecommitdiff
path: root/st
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-05-11 15:14:07 -0600
committerbd-912 <bdunahu@colostate.edu>2024-05-11 15:14:07 -0600
commit2a40b613252eb3d7a95624957dca61fdfa30dc2a (patch)
tree94f553dfd35d445af1447834eb9735521ac24397 /st
parentb8c16f5ff7dffd1ceb51d2115aa2f86a59f090fe (diff)
Fix three more bugs related to st
Diffstat (limited to 'st')
-rw-r--r--st/ClassInstance.java4
-rw-r--r--st/SymbolTable.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/st/ClassInstance.java b/st/ClassInstance.java
index a7a4500..3de852f 100644
--- a/st/ClassInstance.java
+++ b/st/ClassInstance.java
@@ -39,8 +39,8 @@ public class ClassInstance extends AbstractInstance {
}
ClassInstance te = this.getExtend();
- if (te.equals(o)) {
- MinimalLogger.info(String.format("I (%s) extends %s!", this.getName(), o.getName()));
+ if (te.equalsOnExtend(o)) {
+ MinimalLogger.info(String.format("I (%s) extend %s!", this.getName(), o.getName()));
return true;
}
MinimalLogger.info(String.format("I (%s) do not extend %s! I extend %s instead.", this.getName(), o.getName(), te.getName()));
diff --git a/st/SymbolTable.java b/st/SymbolTable.java
index 0fca239..fa196e3 100644
--- a/st/SymbolTable.java
+++ b/st/SymbolTable.java
@@ -52,6 +52,10 @@ public class SymbolTable {
ClassInstance cls = (ClassInstance) this.active.get(TypeEnum.classname);
ClassInstance ext = this.getClass(arg);
+ if (ext == null)
+ throw new TypecheckException(String.format("There is no %s to extend!",
+ arg));
+
MinimalLogger.info(String.format("%s found to extend %s",
cls.getName(),
ext.getName()));