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

Unified Diff: src/parsing/parameter-initializer-rewriter.cc

Issue 2166333002: [parser] Refactor AstTraversalVisitor (BROKEN) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@nickie-2169833002-ast-vis
Patch Set: Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug/liveedit.cc ('k') | src/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parameter-initializer-rewriter.cc
diff --git a/src/parsing/parameter-initializer-rewriter.cc b/src/parsing/parameter-initializer-rewriter.cc
index 4bb367d7d08ba91dae3ac67a42a4a3705455f179..4fea931829b53dc6ecf9e490c2b19768c3e6053d 100644
--- a/src/parsing/parameter-initializer-rewriter.cc
+++ b/src/parsing/parameter-initializer-rewriter.cc
@@ -8,9 +8,7 @@
#include <utility>
#include <vector>
-#include "src/ast/ast.h"
-#include "src/ast/ast-expression-visitor.h"
-#include "src/ast/scopes.h"
+#include "src/ast/ast-traversal-visitor.h"
namespace v8 {
namespace internal {
@@ -18,33 +16,34 @@ namespace internal {
namespace {
-class Rewriter final : public AstExpressionVisitor {
+class Rewriter final : public AstTraversalVisitor<Rewriter> {
public:
Rewriter(uintptr_t stack_limit, Expression* initializer, Scope* old_scope,
Scope* new_scope)
- : AstExpressionVisitor(stack_limit, initializer),
+ : AstTraversalVisitor(stack_limit, initializer),
old_scope_(old_scope),
new_scope_(new_scope),
old_scope_closure_(old_scope->ClosureScope()),
new_scope_closure_(new_scope->ClosureScope()) {}
~Rewriter();
- private:
- void VisitExpression(Expression* expr) override {}
-
- void VisitFunctionLiteral(FunctionLiteral* expr) override;
- void VisitClassLiteral(ClassLiteral* expr) override;
- void VisitVariableProxy(VariableProxy* expr) override;
+ protected:
+ void VisitFunctionLiteral(FunctionLiteral* expr);
+ void VisitClassLiteral(ClassLiteral* expr);
+ void VisitVariableProxy(VariableProxy* expr);
- void VisitBlock(Block* stmt) override;
- void VisitTryCatchStatement(TryCatchStatement* stmt) override;
- void VisitWithStatement(WithStatement* stmt) override;
+ void VisitBlock(Block* stmt);
+ void VisitTryCatchStatement(TryCatchStatement* stmt);
+ void VisitWithStatement(WithStatement* stmt);
+ private:
Scope* old_scope_;
Scope* new_scope_;
Scope* old_scope_closure_;
Scope* new_scope_closure_;
std::vector<std::pair<Variable*, int>> temps_;
+
+ DEFINE_AST_VISITOR_DISPATCH();
};
struct LessThanSecond {
« no previous file with comments | « src/debug/liveedit.cc ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698