Ejemplo n.º 1
0
 public void visit(AstClassDeclList n)
 {
     for (int i = 0; i < n.Count(); i++)
         n[i].accept(this);
 }
Ejemplo n.º 2
0
 // 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;
 }
Ejemplo n.º 3
0
        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);
                }
            }
        }