| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_H_ | 5 #ifndef V8_AST_AST_H_ |
| 6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
| 7 | 7 |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
| 10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
| (...skipping 3035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 } while (false) | 3046 } while (false) |
| 3047 | 3047 |
| 3048 | 3048 |
| 3049 // ---------------------------------------------------------------------------- | 3049 // ---------------------------------------------------------------------------- |
| 3050 // Traversing visitor | 3050 // Traversing visitor |
| 3051 // - fully traverses the entire AST. | 3051 // - fully traverses the entire AST. |
| 3052 | 3052 |
| 3053 class AstTraversalVisitor : public AstVisitor { | 3053 class AstTraversalVisitor : public AstVisitor { |
| 3054 public: | 3054 public: |
| 3055 explicit AstTraversalVisitor(Isolate* isolate); | 3055 explicit AstTraversalVisitor(Isolate* isolate); |
| 3056 explicit AstTraversalVisitor(uintptr_t stack_limit); |
| 3056 virtual ~AstTraversalVisitor() {} | 3057 virtual ~AstTraversalVisitor() {} |
| 3057 | 3058 |
| 3058 // Iteration left-to-right. | 3059 // Iteration left-to-right. |
| 3059 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 3060 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; |
| 3060 void VisitStatements(ZoneList<Statement*>* statements) override; | 3061 void VisitStatements(ZoneList<Statement*>* statements) override; |
| 3061 void VisitExpressions(ZoneList<Expression*>* expressions) override; | |
| 3062 | 3062 |
| 3063 // Individual nodes | 3063 // Individual nodes |
| 3064 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 3064 #define DECLARE_VISIT(type) void Visit##type(type* node) override; |
| 3065 AST_NODE_LIST(DECLARE_VISIT) | 3065 AST_NODE_LIST(DECLARE_VISIT) |
| 3066 #undef DECLARE_VISIT | 3066 #undef DECLARE_VISIT |
| 3067 | 3067 |
| 3068 protected: |
| 3069 int depth() { return depth_; } |
| 3070 |
| 3068 private: | 3071 private: |
| 3069 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 3072 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 3073 |
| 3074 int depth_; |
| 3075 |
| 3070 DISALLOW_COPY_AND_ASSIGN(AstTraversalVisitor); | 3076 DISALLOW_COPY_AND_ASSIGN(AstTraversalVisitor); |
| 3071 }; | 3077 }; |
| 3072 | 3078 |
| 3073 // ---------------------------------------------------------------------------- | 3079 // ---------------------------------------------------------------------------- |
| 3074 // AstNode factory | 3080 // AstNode factory |
| 3075 | 3081 |
| 3076 class AstNodeFactory final BASE_EMBEDDED { | 3082 class AstNodeFactory final BASE_EMBEDDED { |
| 3077 public: | 3083 public: |
| 3078 explicit AstNodeFactory(AstValueFactory* ast_value_factory) | 3084 explicit AstNodeFactory(AstValueFactory* ast_value_factory) |
| 3079 : local_zone_(ast_value_factory->zone()), | 3085 : local_zone_(ast_value_factory->zone()), |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3568 : NULL; \ | 3574 : NULL; \ |
| 3569 } | 3575 } |
| 3570 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3576 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3571 #undef DECLARE_NODE_FUNCTIONS | 3577 #undef DECLARE_NODE_FUNCTIONS |
| 3572 | 3578 |
| 3573 | 3579 |
| 3574 } // namespace internal | 3580 } // namespace internal |
| 3575 } // namespace v8 | 3581 } // namespace v8 |
| 3576 | 3582 |
| 3577 #endif // V8_AST_AST_H_ | 3583 #endif // V8_AST_AST_H_ |
| OLD | NEW |