| 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/ast/ast-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
| 9 #include "src/ast/modules.h" | 9 #include "src/ast/modules.h" |
| 10 #include "src/ast/variables.h" | 10 #include "src/ast/variables.h" |
| (...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3062 | 3062 |
| 3063 DISALLOW_COPY_AND_ASSIGN(AstTraversalVisitor); | 3063 DISALLOW_COPY_AND_ASSIGN(AstTraversalVisitor); |
| 3064 }; | 3064 }; |
| 3065 | 3065 |
| 3066 // ---------------------------------------------------------------------------- | 3066 // ---------------------------------------------------------------------------- |
| 3067 // AstNode factory | 3067 // AstNode factory |
| 3068 | 3068 |
| 3069 class AstNodeFactory final BASE_EMBEDDED { | 3069 class AstNodeFactory final BASE_EMBEDDED { |
| 3070 public: | 3070 public: |
| 3071 explicit AstNodeFactory(AstValueFactory* ast_value_factory) | 3071 explicit AstNodeFactory(AstValueFactory* ast_value_factory) |
| 3072 : local_zone_(ast_value_factory->zone()), | 3072 : local_zone_(nullptr), |
| 3073 parser_zone_(ast_value_factory->zone()), | 3073 parser_zone_(nullptr), |
| 3074 ast_value_factory_(ast_value_factory) {} | 3074 ast_value_factory_(ast_value_factory) { |
| 3075 if (ast_value_factory != nullptr) { |
| 3076 local_zone_ = ast_value_factory->zone(); |
| 3077 parser_zone_ = ast_value_factory->zone(); |
| 3078 } |
| 3079 } |
| 3075 | 3080 |
| 3076 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } | 3081 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } |
| 3082 void set_ast_value_factory(AstValueFactory* ast_value_factory) { |
| 3083 ast_value_factory_ = ast_value_factory; |
| 3084 local_zone_ = ast_value_factory->zone(); |
| 3085 parser_zone_ = ast_value_factory->zone(); |
| 3086 } |
| 3077 | 3087 |
| 3078 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 3088 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, |
| 3079 VariableMode mode, Scope* scope, | 3089 VariableMode mode, Scope* scope, |
| 3080 int pos) { | 3090 int pos) { |
| 3081 return new (parser_zone_) | 3091 return new (parser_zone_) |
| 3082 VariableDeclaration(parser_zone_, proxy, mode, scope, pos); | 3092 VariableDeclaration(parser_zone_, proxy, mode, scope, pos); |
| 3083 } | 3093 } |
| 3084 | 3094 |
| 3085 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, | 3095 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, |
| 3086 VariableMode mode, | 3096 VariableMode mode, |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3543 : NULL; \ | 3553 : NULL; \ |
| 3544 } | 3554 } |
| 3545 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3555 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3546 #undef DECLARE_NODE_FUNCTIONS | 3556 #undef DECLARE_NODE_FUNCTIONS |
| 3547 | 3557 |
| 3548 | 3558 |
| 3549 } // namespace internal | 3559 } // namespace internal |
| 3550 } // namespace v8 | 3560 } // namespace v8 |
| 3551 | 3561 |
| 3552 #endif // V8_AST_AST_H_ | 3562 #endif // V8_AST_AST_H_ |
| OLD | NEW |