Chromium Code Reviews| 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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_; } | 571 bool is_class_declaration() const { return is_class_declaration_; } |
| 572 | 572 |
| 573 // VariableDeclarations can be grouped into consecutive declaration | |
| 574 // batches. Each VariableDeclaration is associated with the start position of | |
| 575 // the batch it belongs to. The positions are used for strong mode scope | |
| 576 // checks for classes and functions. | |
| 577 int consecutive_declaration_batch_start() const { | |
|
rossberg
2015/04/20 11:15:25
Nit: Let's call this class_declaration_group_start
marja
2015/04/20 15:58:22
batch -> group done
But I don't need a separate o
| |
| 578 return consecutive_declaration_batch_start_; | |
| 579 } | |
| 580 | |
| 573 protected: | 581 protected: |
| 574 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode, | 582 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode, |
| 575 Scope* scope, int pos, bool is_class_declaration = false) | 583 Scope* scope, int pos, bool is_class_declaration = false, |
| 584 int consecutive_declaration_batch_start = -1) | |
| 576 : Declaration(zone, proxy, mode, scope, pos), | 585 : Declaration(zone, proxy, mode, scope, pos), |
| 577 is_class_declaration_(is_class_declaration) {} | 586 is_class_declaration_(is_class_declaration), |
| 587 consecutive_declaration_batch_start_( | |
| 588 consecutive_declaration_batch_start) {} | |
| 578 | 589 |
| 579 bool is_class_declaration_; | 590 bool is_class_declaration_; |
| 591 int consecutive_declaration_batch_start_; | |
| 580 }; | 592 }; |
| 581 | 593 |
| 582 | 594 |
| 583 class FunctionDeclaration FINAL : public Declaration { | 595 class FunctionDeclaration FINAL : public Declaration { |
| 584 public: | 596 public: |
| 585 DECLARE_NODE_TYPE(FunctionDeclaration) | 597 DECLARE_NODE_TYPE(FunctionDeclaration) |
| 586 | 598 |
| 587 FunctionLiteral* fun() const { return fun_; } | 599 FunctionLiteral* fun() const { return fun_; } |
| 588 InitializationFlag initialization() const OVERRIDE { | 600 InitializationFlag initialization() const OVERRIDE { |
| 589 return kCreatedInitialized; | 601 return kCreatedInitialized; |
| (...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3211 // AstNode factory | 3223 // AstNode factory |
| 3212 | 3224 |
| 3213 class AstNodeFactory FINAL BASE_EMBEDDED { | 3225 class AstNodeFactory FINAL BASE_EMBEDDED { |
| 3214 public: | 3226 public: |
| 3215 explicit AstNodeFactory(AstValueFactory* ast_value_factory) | 3227 explicit AstNodeFactory(AstValueFactory* ast_value_factory) |
| 3216 : zone_(ast_value_factory->zone()), | 3228 : zone_(ast_value_factory->zone()), |
| 3217 ast_value_factory_(ast_value_factory) {} | 3229 ast_value_factory_(ast_value_factory) {} |
| 3218 | 3230 |
| 3219 VariableDeclaration* NewVariableDeclaration( | 3231 VariableDeclaration* NewVariableDeclaration( |
| 3220 VariableProxy* proxy, VariableMode mode, Scope* scope, int pos, | 3232 VariableProxy* proxy, VariableMode mode, Scope* scope, int pos, |
| 3221 bool is_class_declaration = false) { | 3233 bool is_class_declaration = false, |
| 3234 int consecutive_declaration_batch_start = -1) { | |
| 3222 return new (zone_) VariableDeclaration(zone_, proxy, mode, scope, pos, | 3235 return new (zone_) VariableDeclaration(zone_, proxy, mode, scope, pos, |
| 3223 is_class_declaration); | 3236 is_class_declaration, |
| 3237 consecutive_declaration_batch_start); | |
| 3224 } | 3238 } |
| 3225 | 3239 |
| 3226 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, | 3240 FunctionDeclaration* NewFunctionDeclaration(VariableProxy* proxy, |
| 3227 VariableMode mode, | 3241 VariableMode mode, |
| 3228 FunctionLiteral* fun, | 3242 FunctionLiteral* fun, |
| 3229 Scope* scope, | 3243 Scope* scope, |
| 3230 int pos) { | 3244 int pos) { |
| 3231 return new (zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos); | 3245 return new (zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos); |
| 3232 } | 3246 } |
| 3233 | 3247 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3582 | 3596 |
| 3583 private: | 3597 private: |
| 3584 Zone* zone_; | 3598 Zone* zone_; |
| 3585 AstValueFactory* ast_value_factory_; | 3599 AstValueFactory* ast_value_factory_; |
| 3586 }; | 3600 }; |
| 3587 | 3601 |
| 3588 | 3602 |
| 3589 } } // namespace v8::internal | 3603 } } // namespace v8::internal |
| 3590 | 3604 |
| 3591 #endif // V8_AST_H_ | 3605 #endif // V8_AST_H_ |
| OLD | NEW |