summaryrefslogtreecommitdiff
path: root/st/TypeInstance.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-06 19:02:21 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-06 19:02:21 -0600
commitb03859dce5991169b07d1d5040c8faf7ba82e5b5 (patch)
tree5a1217d441c9323976aef6e45018c9c2522930a6 /st/TypeInstance.java
parent0ae01301d572b2e69585c4d1cb753ed7fc89dfe3 (diff)
Rewrite SymbolTable again P1
Diffstat (limited to 'st/TypeInstance.java')
-rw-r--r--st/TypeInstance.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/st/TypeInstance.java b/st/TypeInstance.java
index 13947ae..e00c1f9 100644
--- a/st/TypeInstance.java
+++ b/st/TypeInstance.java
@@ -2,15 +2,14 @@ package st;
public class TypeInstance extends AbstractInstance {
+ private AbstractInstance scope;
+
public TypeInstance(String name, TypeEnum type) {
super(name, type);
+ this.scope = null;
}
- public String toString() {
- return this.name + ":" + this.type;
- }
-
- public boolean same_type(TypeInstance other) {
+ public boolean sameType(TypeInstance other) {
/**
* Given a TypeInstance object other,
* returns true if other object
@@ -22,11 +21,19 @@ public class TypeInstance extends AbstractInstance {
*/
return this.type != TypeEnum.ERROR &&
- this.type == other.get_type();
+ this.type == other.getType();
}
- public boolean has_checked() {
+ public boolean hasChecked() {
return type != TypeEnum.ERROR;
}
+ public AbstractInstance getScope() {
+ /**
+ * Returns the scope of the variable, or
+ * `null' if unset.
+ */
+ return this.scope;
+ }
+
}