Chromium Code Reviews| Index: src/ast/ast.h |
| diff --git a/src/ast/ast.h b/src/ast/ast.h |
| index d75294ecc4ce8023258808d4d2ffebb9f6260c79..678e192c89abda4bfa4901af52667b6c7d332187 100644 |
| --- a/src/ast/ast.h |
| +++ b/src/ast/ast.h |
| @@ -2886,7 +2886,7 @@ class EmptyParentheses final : public Expression { |
| template <class Subclass> |
| class AstVisitor BASE_EMBEDDED { |
| public: |
| - void Visit(AstNode* node) { This()->Visit(node); } |
| + void Visit(AstNode* node) { impl()->Visit(node); } |
| void VisitDeclarations(ZoneList<Declaration*>* declarations) { |
| for (int i = 0; i < declarations->length(); i++) { |
| @@ -2913,13 +2913,13 @@ class AstVisitor BASE_EMBEDDED { |
| } |
| } |
| - private: |
| - Subclass* This() { return static_cast<Subclass*>(this); } |
| + protected: |
| + Subclass* impl() { return static_cast<Subclass*>(this); } |
| }; |
| -#define GENERATE_VISIT_CASE(NodeType) \ |
| - case AstNode::k##NodeType: \ |
| - return Visit##NodeType(static_cast<NodeType*>(node)); |
| +#define GENERATE_VISIT_CASE(NodeType) \ |
| + case AstNode::k##NodeType: \ |
| + return this->impl()->Visit##NodeType(static_cast<NodeType*>(node)); |
|
Toon Verwaest
2016/07/21 11:16:59
This change isn't necessary if you add DEFINE_AST_
nickie
2016/07/22 08:40:18
This was explored in https://codereview.chromium.o
|
| #define GENERATE_AST_VISITOR_SWITCH() \ |
| switch (node->node_type()) { \ |
| @@ -3032,38 +3032,6 @@ class AstVisitor BASE_EMBEDDED { |
| // ---------------------------------------------------------------------------- |
| -// Traversing visitor |
| -// - fully traverses the entire AST. |
| - |
| -// This AstVistor is not final, and provides the AstVisitor methods as virtual |
| -// methods so they can be specialized by subclasses. |
| -class AstTraversalVisitor : public AstVisitor<AstTraversalVisitor> { |
| - public: |
| - explicit AstTraversalVisitor(Isolate* isolate); |
| - explicit AstTraversalVisitor(uintptr_t stack_limit); |
| - virtual ~AstTraversalVisitor() {} |
| - |
| - // Iteration left-to-right. |
| - void VisitDeclarations(ZoneList<Declaration*>* declarations); |
| - void VisitStatements(ZoneList<Statement*>* statements); |
| - |
| -// Individual nodes |
| -#define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| - AST_NODE_LIST(DECLARE_VISIT) |
| -#undef DECLARE_VISIT |
| - |
| - protected: |
| - int depth() { return depth_; } |
| - |
| - private: |
| - DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| - |
| - int depth_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(AstTraversalVisitor); |
| -}; |
| - |
| -// ---------------------------------------------------------------------------- |
| // AstNode factory |
| class AstNodeFactory final BASE_EMBEDDED { |