| 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_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
| 6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/hashmap.h" | 9 #include "src/hashmap.h" |
| 10 #include "src/pending-compilation-error-handler.h" | 10 #include "src/pending-compilation-error-handler.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // end position: end position of '}' | 288 // end position: end position of '}' |
| 289 int start_position() const { return start_position_; } | 289 int start_position() const { return start_position_; } |
| 290 void set_start_position(int statement_pos) { | 290 void set_start_position(int statement_pos) { |
| 291 start_position_ = statement_pos; | 291 start_position_ = statement_pos; |
| 292 } | 292 } |
| 293 int end_position() const { return end_position_; } | 293 int end_position() const { return end_position_; } |
| 294 void set_end_position(int statement_pos) { | 294 void set_end_position(int statement_pos) { |
| 295 end_position_ = statement_pos; | 295 end_position_ = statement_pos; |
| 296 } | 296 } |
| 297 | 297 |
| 298 // Scopes created for desugaring are hidden. I.e. not visible to the debugger. |
| 299 bool is_hidden() const { return is_hidden_; } |
| 300 void set_is_hidden() { is_hidden_ = true; } |
| 301 |
| 298 // In some cases we want to force context allocation for a whole scope. | 302 // In some cases we want to force context allocation for a whole scope. |
| 299 void ForceContextAllocation() { | 303 void ForceContextAllocation() { |
| 300 DCHECK(!already_resolved()); | 304 DCHECK(!already_resolved()); |
| 301 force_context_allocation_ = true; | 305 force_context_allocation_ = true; |
| 302 } | 306 } |
| 303 bool has_forced_context_allocation() const { | 307 bool has_forced_context_allocation() const { |
| 304 return force_context_allocation_; | 308 return force_context_allocation_; |
| 305 } | 309 } |
| 306 | 310 |
| 307 // --------------------------------------------------------------------------- | 311 // --------------------------------------------------------------------------- |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 // Error handling. | 571 // Error handling. |
| 568 void ReportMessage(int start_position, int end_position, | 572 void ReportMessage(int start_position, int end_position, |
| 569 MessageTemplate::Template message, | 573 MessageTemplate::Template message, |
| 570 const AstRawString* arg); | 574 const AstRawString* arg); |
| 571 | 575 |
| 572 // --------------------------------------------------------------------------- | 576 // --------------------------------------------------------------------------- |
| 573 // Debugging. | 577 // Debugging. |
| 574 | 578 |
| 575 #ifdef DEBUG | 579 #ifdef DEBUG |
| 576 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively | 580 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively |
| 581 |
| 582 // Check that the scope has positions assigned. |
| 583 void CheckScopePositions(); |
| 577 #endif | 584 #endif |
| 578 | 585 |
| 579 // --------------------------------------------------------------------------- | 586 // --------------------------------------------------------------------------- |
| 580 // Implementation. | 587 // Implementation. |
| 581 private: | 588 private: |
| 582 // Scope tree. | 589 // Scope tree. |
| 583 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL | 590 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL |
| 584 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes | 591 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes |
| 585 | 592 |
| 586 // The scope type. | 593 // The scope type. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 bool asm_module_; | 645 bool asm_module_; |
| 639 // This scope's outer context is an asm module. | 646 // This scope's outer context is an asm module. |
| 640 bool asm_function_; | 647 bool asm_function_; |
| 641 // This scope's declarations might not be executed in order (e.g., switch). | 648 // This scope's declarations might not be executed in order (e.g., switch). |
| 642 bool scope_nonlinear_; | 649 bool scope_nonlinear_; |
| 643 // The language mode of this scope. | 650 // The language mode of this scope. |
| 644 LanguageMode language_mode_; | 651 LanguageMode language_mode_; |
| 645 // Source positions. | 652 // Source positions. |
| 646 int start_position_; | 653 int start_position_; |
| 647 int end_position_; | 654 int end_position_; |
| 655 bool is_hidden_; |
| 648 | 656 |
| 649 // Computed via PropagateScopeInfo. | 657 // Computed via PropagateScopeInfo. |
| 650 bool outer_scope_calls_sloppy_eval_; | 658 bool outer_scope_calls_sloppy_eval_; |
| 651 bool inner_scope_calls_eval_; | 659 bool inner_scope_calls_eval_; |
| 652 bool force_eager_compilation_; | 660 bool force_eager_compilation_; |
| 653 bool force_context_allocation_; | 661 bool force_context_allocation_; |
| 654 | 662 |
| 655 // True if it doesn't need scope resolution (e.g., if the scope was | 663 // True if it doesn't need scope resolution (e.g., if the scope was |
| 656 // constructed based on a serialized scope info or a catch context). | 664 // constructed based on a serialized scope info or a catch context). |
| 657 bool already_resolved_; | 665 bool already_resolved_; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 AstValueFactory* ast_value_factory_; | 809 AstValueFactory* ast_value_factory_; |
| 802 Zone* zone_; | 810 Zone* zone_; |
| 803 | 811 |
| 804 PendingCompilationErrorHandler pending_error_handler_; | 812 PendingCompilationErrorHandler pending_error_handler_; |
| 805 }; | 813 }; |
| 806 | 814 |
| 807 } // namespace internal | 815 } // namespace internal |
| 808 } // namespace v8 | 816 } // namespace v8 |
| 809 | 817 |
| 810 #endif // V8_AST_SCOPES_H_ | 818 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |