示例#1
0
        //............
        public override int VisitFor(CFor node)
        {
            ExtractSubgraphs(node, CFor.CT_FOR_ARGS, CFor.ContextNames);
            ExtractSubgraphs(node, CFor.CT_BODY, CFor.ContextNames);

            base.VisitFor(node);

            m_ostream.WriteLine("{0}->{1}", currentParent.M_GraphVizName, node.M_GraphVizName);

            return(0);
        }
示例#2
0
        //..............
        public override int VisitFor(CFor node)
        {
            // CEmmitableCodeContainer rep = m_parents.Peek();

            CEmmitableCodeContainer parent = m_parents.Peek() as CEmmitableCodeContainer;
            CForStatement           rep    = new CForStatement(CodeBlockType.CB_FORSTATEMENT, 2, parent);

            parent.AddCode(rep, m_parentContexts.Peek());

            m_parents.Push(rep);
            m_parentContexts.Push(CForStatement.CC_FORARGS_STATEMENT);
            m_for.Push(1);

            int i    = 0;
            int last = node.GetChildrenContextNumber(CFor.CT_FOR_ARGS);

            foreach (ASTVisitableElement child in node.GetChildrenContext(CFor.CT_FOR_ARGS))
            {
                if ((last != 3) && (i == 0))
                {
                    rep.AddCode(" ; ", CForStatement.CC_FORARGS_STATEMENT);
                }

                Visit(child);

                if (!((i + 1) == last))
                {
                    rep.AddCode(" ; ", CForStatement.CC_FORARGS_STATEMENT);
                }

                i++;
            }

            m_for.Pop();
            m_parents.Pop();
            m_parentContexts.Pop();



            m_parents.Push(rep);
            m_parentContexts.Push(CForStatement.CC_FORSTATEMENT_BODY);

            // Visit Function Definitions and emmit code to distinct functions
            foreach (ASTVisitableElement child in node.GetChildrenContext(CFor.CT_BODY))
            {
                Visit(child);
            }

            m_parents.Pop();
            m_parentContexts.Pop();

            return(0);
        }
示例#3
0
 //............
 public virtual T VisitFor(CFor node)
 {
     return(VisitChildren(node));
 }