Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(986)

Side by Side Diff: src/ast/ast-traversal-visitor.h

Issue 2457393003: Thread decls-list through Declaration (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/ast-numbering.cc ('k') | src/ast/prettyprinter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_AST_AST_TRAVERSAL_VISITOR_H_ 5 #ifndef V8_AST_AST_TRAVERSAL_VISITOR_H_
6 #define V8_AST_AST_TRAVERSAL_VISITOR_H_ 6 #define V8_AST_AST_TRAVERSAL_VISITOR_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 10
(...skipping 22 matching lines...) Expand all
33 33
34 void Run() { 34 void Run() {
35 DCHECK_NOT_NULL(root_); 35 DCHECK_NOT_NULL(root_);
36 Visit(root_); 36 Visit(root_);
37 } 37 }
38 38
39 bool VisitNode(AstNode* node) { return true; } 39 bool VisitNode(AstNode* node) { return true; }
40 bool VisitExpression(Expression* node) { return true; } 40 bool VisitExpression(Expression* node) { return true; }
41 41
42 // Iteration left-to-right. 42 // Iteration left-to-right.
43 void VisitDeclarations(ZoneList<Declaration*>* declarations); 43 void VisitDeclarations(Declaration::List* declarations);
44 void VisitStatements(ZoneList<Statement*>* statements); 44 void VisitStatements(ZoneList<Statement*>* statements);
45 45
46 // Individual nodes 46 // Individual nodes
47 #define DECLARE_VISIT(type) void Visit##type(type* node); 47 #define DECLARE_VISIT(type) void Visit##type(type* node);
48 AST_NODE_LIST(DECLARE_VISIT) 48 AST_NODE_LIST(DECLARE_VISIT)
49 #undef DECLARE_VISIT 49 #undef DECLARE_VISIT
50 50
51 protected: 51 protected:
52 int depth() const { return depth_; } 52 int depth() const { return depth_; }
53 53
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 template <class Subclass> 98 template <class Subclass>
99 AstTraversalVisitor<Subclass>::AstTraversalVisitor(uintptr_t stack_limit, 99 AstTraversalVisitor<Subclass>::AstTraversalVisitor(uintptr_t stack_limit,
100 AstNode* root) 100 AstNode* root)
101 : root_(root), depth_(0) { 101 : root_(root), depth_(0) {
102 InitializeAstVisitor(stack_limit); 102 InitializeAstVisitor(stack_limit);
103 } 103 }
104 104
105 template <class Subclass> 105 template <class Subclass>
106 void AstTraversalVisitor<Subclass>::VisitDeclarations( 106 void AstTraversalVisitor<Subclass>::VisitDeclarations(
107 ZoneList<Declaration*>* decls) { 107 Declaration::List* decls) {
108 for (int i = 0; i < decls->length(); ++i) { 108 for (Declaration* decl : *decls) {
109 Declaration* decl = decls->at(i);
110 RECURSE(Visit(decl)); 109 RECURSE(Visit(decl));
111 } 110 }
112 } 111 }
113 112
114 template <class Subclass> 113 template <class Subclass>
115 void AstTraversalVisitor<Subclass>::VisitStatements( 114 void AstTraversalVisitor<Subclass>::VisitStatements(
116 ZoneList<Statement*>* stmts) { 115 ZoneList<Statement*>* stmts) {
117 for (int i = 0; i < stmts->length(); ++i) { 116 for (int i = 0; i < stmts->length(); ++i) {
118 Statement* stmt = stmts->at(i); 117 Statement* stmt = stmts->at(i);
119 RECURSE(Visit(stmt)); 118 RECURSE(Visit(stmt));
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 496
498 #undef PROCESS_NODE 497 #undef PROCESS_NODE
499 #undef PROCESS_EXPRESSION 498 #undef PROCESS_EXPRESSION
500 #undef RECURSE_EXPRESSION 499 #undef RECURSE_EXPRESSION
501 #undef RECURSE 500 #undef RECURSE
502 501
503 } // namespace internal 502 } // namespace internal
504 } // namespace v8 503 } // namespace v8
505 504
506 #endif // V8_AST_AST_TRAVERSAL_VISITOR_H_ 505 #endif // V8_AST_AST_TRAVERSAL_VISITOR_H_
OLDNEW
« no previous file with comments | « src/ast/ast-numbering.cc ('k') | src/ast/prettyprinter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698