diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-03-23 21:09:05 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-03-23 21:09:05 -0600 |
commit | 762acb336997d43e15d64ff591103614abe4806f (patch) | |
tree | f2f02cc09b4ca81f6b06bc67d2f90df4a2fc9e81 /minijava/TypeInstance.java | |
parent | 7a26f1108fb412daa4495628fc5136da2bb0ee34 (diff) |
Added minor classname functionality to ST
Diffstat (limited to 'minijava/TypeInstance.java')
-rw-r--r-- | minijava/TypeInstance.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/minijava/TypeInstance.java b/minijava/TypeInstance.java index 483a093..f7d6329 100644 --- a/minijava/TypeInstance.java +++ b/minijava/TypeInstance.java @@ -2,9 +2,15 @@ package minijava; public class TypeInstance { TypeEnum type; + String type_name; - public TypeInstance(TypeEnum type) { + public String toString() { + return "name:" + type_name + "|type:" + type; + } + + public TypeInstance(String type_name, TypeEnum type) { this.type = type; + this.type_name = type_name; } public boolean equal_type(TypeInstance other) { @@ -22,8 +28,16 @@ public class TypeInstance { this.type == other.type; } + public boolean has_checked() { + return type != TypeEnum.ERROR; + } + public TypeEnum get_type() { return this.type; } + public String get_type_name() { + return this.type_name; + } + } |