Index: src/ast/ast.h |
diff --git a/src/ast/ast.h b/src/ast/ast.h |
index c4d6a6ae8bab94c8722727f82b8a2c3bc6973f34..bee0bab47e5640cbcf43c89e3739993d8fdfac73 100644 |
--- a/src/ast/ast.h |
+++ b/src/ast/ast.h |
@@ -3047,6 +3047,30 @@ class AstVisitor BASE_EMBEDDED { |
// ---------------------------------------------------------------------------- |
+// Traversing visitor |
+// - fully traverses the entire AST. |
+ |
+class AstTraversalVisitor : public AstVisitor { |
+ public: |
+ explicit AstTraversalVisitor(Isolate* isolate); |
+ virtual ~AstTraversalVisitor() {} |
+ |
+ // Iteration left-to-right. |
+ void VisitDeclarations(ZoneList<Declaration*>* declarations) override; |
+ void VisitStatements(ZoneList<Statement*>* statements) override; |
+ void VisitExpressions(ZoneList<Expression*>* expressions) override; |
+ |
+// Individual nodes |
+#define DECLARE_VISIT(type) void Visit##type(type* node) override; |
+ AST_NODE_LIST(DECLARE_VISIT) |
+#undef DECLARE_VISIT |
+ |
+ private: |
+ DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
+ DISALLOW_COPY_AND_ASSIGN(AstTraversalVisitor); |
+}; |
+ |
+// ---------------------------------------------------------------------------- |
// AstNode factory |
class AstNodeFactory final BASE_EMBEDDED { |