protected void VisitNode(LocalVarDeclsAndStmts node) { // Get local var decls // Get list of children that are not variable declarations (only assignment expr and method calls currently supported) List <AbstractNode> methodBodyChildren = Utilities.GetMethodBodyChildren(node, this); // Process them in reverse order for (int i = methodBodyChildren.Count - 1; i >= 0; i--) { methodBodyChildren[i].Accept(this); } }
public void VisitNode(LocalVarDeclsAndStmts node) { // Here we want to visit all LocalVarDclStmts and then Statments ORDER MATTERS HERE! // Create a list of all Local Var Dcl children and visit them List <LocalVarDeclStmt> LVDChildren = Utilities.GetChildren(node, typeof(LocalVarDeclStmt)).Cast <LocalVarDeclStmt>().ToList(); foreach (LocalVarDeclStmt l in LVDChildren) { this.VisitNode(l); } // Create a list of all AssignmentExpr children and visit them List <AssignmentExpr> assChildren = Utilities.GetChildren(node, typeof(AssignmentExpr)).Cast <AssignmentExpr>().ToList(); foreach (AssignmentExpr a in assChildren) { this.VisitNode(a); } // Create a list of all methodcall children and visit them List <MethodCall> methChildren = Utilities.GetChildren(node, typeof(MethodCall)).Cast <MethodCall>().ToList(); foreach (MethodCall m in methChildren) { this.VisitNode(m); } // Create a list of all SelectionStmt children and visit them List <SelectionStmt> SelectionChildren = Utilities.GetChildren(node, typeof(SelectionStmt)).Cast <SelectionStmt>().ToList(); foreach (SelectionStmt s in SelectionChildren) { this.VisitNode(s); } // Create a list of all Stmt children and visit them List <Stmt> StmtChildren = Utilities.GetChildren(node, typeof(Stmt)).Cast <Stmt>().ToList(); foreach (Stmt s in StmtChildren) { this.VisitNode(s); } }