From 289a419681bfde1edd91a695ca97116a57d62433 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Fri, 26 Apr 2024 18:23:59 -0600 Subject: Implemented some basic HeatVisitor rules --- heat/TypeBundle.java | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'heat/TypeBundle.java') diff --git a/heat/TypeBundle.java b/heat/TypeBundle.java index d5f8121..44e3749 100644 --- a/heat/TypeBundle.java +++ b/heat/TypeBundle.java @@ -18,24 +18,35 @@ class TypeBundle { } @Override public String toString() { - return String.format("%s (%s)", - type, - instance); + String cls = (this.instance != null) ? String.format(" (%s)", this.instance) : ""; + return String.format("%s%s", + this.type, + cls); } @Override public boolean equals(Object other) { - /** - * We can say two types are equal, as - * long as they are not equal on a - * type error! - */ return (other instanceof TypeBundle) && - this.hasChecked() && ((TypeBundle) other).type == this.type; } - public boolean hasChecked() { - return type != TypeEnum.ERROR; + public boolean isClass() { + return this.type == TypeEnum.classname; + } + + public boolean isMethod() { + return this.type == TypeEnum.method; + } + + public boolean isArray() { + return this.type == TypeEnum.intarray; + } + + public boolean isBool() { + return this.type == TypeEnum.bool; + } + + public boolean isInt() { + return this.type == TypeEnum.integer; } } -- cgit v1.2.3