diff options
Diffstat (limited to 'st/SymTableVis.java')
-rw-r--r-- | st/SymTableVis.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/st/SymTableVis.java b/st/SymTableVis.java index 399ea09..36233b3 100644 --- a/st/SymTableVis.java +++ b/st/SymTableVis.java @@ -37,7 +37,7 @@ public class SymTableVis<R> extends GJDepthFirst<R,ArrayList<String>> { public R visit(MainClass n, ArrayList<String> argu) { ArrayList<String> attr_list = new ArrayList<String>(); - ArrayList<String> mtd_list = new ArrayList<String>(); + ArrayList<String> mtd_list = new ArrayList<String>(); n.f0.accept(this, argu); n.f1.accept(this, argu); @@ -64,7 +64,7 @@ public class SymTableVis<R> extends GJDepthFirst<R,ArrayList<String>> { String id = n.f1.f0.tokenImage; ClassInstance type = new ClassInstance(id); - type.set_attrs(attr_list); + type.set_attrs(attr_list); type.set_mtds(mtd_list); PrintFilter.print("Inserting " + id + " => " + type, true); symt.put(id, type); @@ -141,8 +141,10 @@ public class SymTableVis<R> extends GJDepthFirst<R,ArrayList<String>> { String ext = n.f3.f0.tokenImage; ClassInstance type = new ClassInstance(id, ext); - type.set_attrs(attr_list); - type.set_mtds(mtd_list); + ClassInstance parent = (ClassInstance) symt.get(ext); + System.out.println("Parent addrs: " + parent.get_attrs()); + // type.set_attrs(attr_list.addAll(parent.get_attrs())); + // type.set_mtds(mtd_list.addAll(parent.get_mtds())); PrintFilter.print("Inserting " + id + " => " + type, true); symt.put(id, type); @@ -238,14 +240,14 @@ public class SymTableVis<R> extends GJDepthFirst<R,ArrayList<String>> { } MethodInstance type = new MethodInstance(id, rtrn); - // add children to current class + // add children to current class type.set_args(argu_list); type.set_locals(var_list); PrintFilter.print("Inserting " + type, true); symt.put(id, type); - // add method to parent class - argu.add(id); + // add method to parent class + argu.add(id); return null; } @@ -273,7 +275,7 @@ public class SymTableVis<R> extends GJDepthFirst<R,ArrayList<String>> { TypeInstance type = new TypeInstance(id, rtrn); - // add type to parent class + // add type to parent class argu.add(id); n.f0.accept(this, argu); |