public void visit(AstClassDeclList n) { for (int i = 0; i < n.Count(); i++) n[i].accept(this); }
// DECLARATIONS // *** partial implementation, will be fixed in proj2 **** // ClassDeclList --- public IrFuncList visit(AstClassDeclList n) { IrFuncList funcs = new IrFuncList(); for (int i = 0; i < n.Count(); i++) funcs.AddRange(n[i].accept(this)); return funcs; }
private void setupClassHierarchy(AstClassDeclList cl) { List<AstClassDecl> work = new List<AstClassDecl>(); List<String> done = new List<String>(); for (int i = 0; i < cl.Count(); i++) work.Add(cl[i]); while (work.Count > 0) { for (int i = 0; i < work.Count; i++) { AstClassDecl cd = (AstClassDecl) work[i]; if (cd.pid != null) { if (!done.Contains(cd.pid.s)) { continue; } ClassRec cr = symTable.GetClass(cd.cid); ClassRec pr = symTable.GetClass(cd.pid); cr.LinkParent(pr); } done.Add(cd.cid.s); work.Remove(cd); } } }