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_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 561 |
562 | 562 |
563 class VariableDeclaration FINAL : public Declaration { | 563 class VariableDeclaration FINAL : public Declaration { |
564 public: | 564 public: |
565 DECLARE_NODE_TYPE(VariableDeclaration) | 565 DECLARE_NODE_TYPE(VariableDeclaration) |
566 | 566 |
567 InitializationFlag initialization() const OVERRIDE { | 567 InitializationFlag initialization() const OVERRIDE { |
568 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; | 568 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; |
569 } | 569 } |
570 | 570 |
| 571 bool is_class_declaration() const { return is_class_declaration_; } |
| 572 |
571 protected: | 573 protected: |
572 VariableDeclaration(Zone* zone, | 574 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode, |
573 VariableProxy* proxy, | 575 Scope* scope, int pos, bool is_class_declaration = false) |
574 VariableMode mode, | 576 : Declaration(zone, proxy, mode, scope, pos), |
575 Scope* scope, | 577 is_class_declaration_(is_class_declaration) {} |
576 int pos) | 578 |
577 : Declaration(zone, proxy, mode, scope, pos) { | 579 bool is_class_declaration_; |
578 } | |
579 }; | 580 }; |
580 | 581 |
581 | 582 |
582 class FunctionDeclaration FINAL : public Declaration { | 583 class FunctionDeclaration FINAL : public Declaration { |
583 public: | 584 public: |
584 DECLARE_NODE_TYPE(FunctionDeclaration) | 585 DECLARE_NODE_TYPE(FunctionDeclaration) |
585 | 586 |
586 FunctionLiteral* fun() const { return fun_; } | 587 FunctionLiteral* fun() const { return fun_; } |
587 InitializationFlag initialization() const OVERRIDE { | 588 InitializationFlag initialization() const OVERRIDE { |
588 return kCreatedInitialized; | 589 return kCreatedInitialized; |
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3208 | 3209 |
3209 // ---------------------------------------------------------------------------- | 3210 // ---------------------------------------------------------------------------- |
3210 // AstNode factory | 3211 // AstNode factory |
3211 | 3212 |
3212 class AstNodeFactory FINAL BASE_EMBEDDED { | 3213 class AstNodeFactory FINAL BASE_EMBEDDED { |
3213 public: | 3214 public: |
3214 explicit AstNodeFactory(AstValueFactory* ast_value_factory) | 3215 explicit AstNodeFactory(AstValueFactory* ast_value_factory) |
3215 : zone_(ast_value_factory->zone()), | 3216 : zone_(ast_value_factory->zone()), |
3216 ast_value_factory_(ast_value_factory) {} | 3217 ast_value_factory_(ast_value_factory) {} |
3217 | 3218 |
3218 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 3219 VariableDeclaration* NewVariableDeclaration( |
3219 VariableMode mode, | 3220 VariableProxy* proxy, VariableMode mode, Scope* scope, int pos, |
3220 Scope* scope, | 3221 bool is_class_declaration = false) { |
3221 int pos) { | 3222 return new (zone_) VariableDeclaration(zone_, proxy, mode, scope, pos, |
3222 return new (zone_) VariableDeclaration(zone_, proxy, mode, scope, pos); | 3223 is_class_declaration); |
3223 } | 3224 } |
3224 | 3225 |
3225 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, | 3226 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, |
3226 VariableMode mode, | 3227 VariableMode mode, |
3227 FunctionLiteral* fun, | 3228 FunctionLiteral* fun, |
3228 Scope* scope, | 3229 Scope* scope, |
3229 int pos) { | 3230 int pos) { |
3230 return new (zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos); | 3231 return new (zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos); |
3231 } | 3232 } |
3232 | 3233 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3581 | 3582 |
3582 private: | 3583 private: |
3583 Zone* zone_; | 3584 Zone* zone_; |
3584 AstValueFactory* ast_value_factory_; | 3585 AstValueFactory* ast_value_factory_; |
3585 }; | 3586 }; |
3586 | 3587 |
3587 | 3588 |
3588 } } // namespace v8::internal | 3589 } } // namespace v8::internal |
3589 | 3590 |
3590 #endif // V8_AST_H_ | 3591 #endif // V8_AST_H_ |
OLD | NEW |