1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef V8_AST_EXPRESSION_VISITOR_H_
6 #define V8_AST_EXPRESSION_VISITOR_H_
8 #include "src/allocation.h"
10 #include "src/effects.h"
11 #include "src/scopes.h"
12 #include "src/type-info.h"
13 #include "src/types.h"
19 // A Visitor over a CompilationInfo's AST that invokes
20 // VisitExpression on each expression node.
22 class AstExpressionVisitor : public AstVisitor {
24 AstExpressionVisitor(Isolate* isolate, Zone* zone, FunctionLiteral* root);
28 virtual void VisitExpression(Expression* expression) = 0;
29 int depth() { return depth_; }
32 void VisitDeclarations(ZoneList<Declaration*>* d) override;
33 void VisitStatements(ZoneList<Statement*>* s) override;
35 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
37 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override;
38 AST_NODE_LIST(DECLARE_VISIT)
41 FunctionLiteral* root_;
44 DISALLOW_COPY_AND_ASSIGN(AstExpressionVisitor);
46 } // namespace internal
49 #endif // V8_AST_EXPRESSION_VISITOR_H_