From 35b1ec663c4bf233c1beba823d2c2ebd2759289e Mon Sep 17 00:00:00 2001 From: bd-912 Date: Sun, 31 Mar 2024 23:23:06 -0600 Subject: Partial implementation of full class definition storing in SymTable --- st/ClassInstance.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'st/ClassInstance.java') diff --git a/st/ClassInstance.java b/st/ClassInstance.java index 44b41c9..8b49236 100644 --- a/st/ClassInstance.java +++ b/st/ClassInstance.java @@ -11,7 +11,7 @@ public class ClassInstance extends AbstractInstance { super(name, TypeEnum.classname); this.attrs = new ArrayList<>(); this.mtds = new ArrayList<>(); - this.ext = null; + this.ext = ""; } public ClassInstance(String name, String ext) { @@ -20,20 +20,18 @@ public class ClassInstance extends AbstractInstance { } public String toString() { - return this.name + ":" + this.type + "(" + - this.ext + ")"; - } + return name + ":T[" + type + "]E[" + + this.ext + "]A[" + this.attrs.toString() + + "]";//M[" + this.mtds.toString() + "]"; - public void add_attribute(TypeInstance attr) { - this.attrs.add(attr); } - public void add_attribute(MethodInstance mtd) { - this.mtds.add(mtd); + public void set_attrs(ArrayList attrs) { + this.attrs = attrs; } - public String get_extend() { - return this.ext; + public void set_mtds(ArrayList mtds) { + this.mtds = mtds; } } -- cgit v1.2.3