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_SCOPES_H_ | 5 #ifndef V8_SCOPES_H_ |
6 #define V8_SCOPES_H_ | 6 #define V8_SCOPES_H_ |
7 | 7 |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/pending-compilation-error-handler.h" | 9 #include "src/pending-compilation-error-handler.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 // A local variable to the [[HomeObject]] used by methods if we need to | 412 // A local variable to the [[HomeObject]] used by methods if we need to |
413 // allocate it; NULL otherwise. | 413 // allocate it; NULL otherwise. |
414 Variable* home_object_var() const { | 414 Variable* home_object_var() const { |
415 DCHECK(home_object_ == nullptr || | 415 DCHECK(home_object_ == nullptr || |
416 (is_function_scope() && (IsConciseMethod(function_kind()) || | 416 (is_function_scope() && (IsConciseMethod(function_kind()) || |
417 IsAccessorFunction(function_kind()) || | 417 IsAccessorFunction(function_kind()) || |
418 IsConstructor(function_kind())))); | 418 IsConstructor(function_kind())))); |
419 return home_object_; | 419 return home_object_; |
420 } | 420 } |
421 | 421 |
422 Variable* this_function_var() const { | |
423 // This is only used in derived constructors atm. | |
424 DCHECK(this_function_ == nullptr || | |
425 (is_function_scope() && IsSubclassConstructor(function_kind()))); | |
426 return this_function_; | |
427 } | |
428 | |
429 // Declarations list. | 422 // Declarations list. |
430 ZoneList<Declaration*>* declarations() { return &decls_; } | 423 ZoneList<Declaration*>* declarations() { return &decls_; } |
431 | 424 |
432 // Inner scope list. | 425 // Inner scope list. |
433 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } | 426 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } |
434 | 427 |
435 // The scope immediately surrounding this scope, or NULL. | 428 // The scope immediately surrounding this scope, or NULL. |
436 Scope* outer_scope() const { return outer_scope_; } | 429 Scope* outer_scope() const { return outer_scope_; } |
437 | 430 |
438 // The ModuleDescriptor for this scope; only for module scopes. | 431 // The ModuleDescriptor for this scope; only for module scopes. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 // Convenience variable. | 572 // Convenience variable. |
580 Variable* receiver_; | 573 Variable* receiver_; |
581 // Function variable, if any; function scopes only. | 574 // Function variable, if any; function scopes only. |
582 VariableDeclaration* function_; | 575 VariableDeclaration* function_; |
583 // new.target variable, function scopes only. | 576 // new.target variable, function scopes only. |
584 Variable* new_target_; | 577 Variable* new_target_; |
585 // Convenience variable; function scopes only. | 578 // Convenience variable; function scopes only. |
586 Variable* arguments_; | 579 Variable* arguments_; |
587 // Convenience variable; method scopes only. | 580 // Convenience variable; method scopes only. |
588 Variable* home_object_; | 581 Variable* home_object_; |
589 // Convenience variable; Subclass constructor only | |
590 Variable* this_function_; | |
591 // Module descriptor; module scopes only. | 582 // Module descriptor; module scopes only. |
592 ModuleDescriptor* module_descriptor_; | 583 ModuleDescriptor* module_descriptor_; |
593 | 584 |
594 // Illegal redeclaration. | 585 // Illegal redeclaration. |
595 Expression* illegal_redecl_; | 586 Expression* illegal_redecl_; |
596 | 587 |
597 // Scope-specific information computed during parsing. | 588 // Scope-specific information computed during parsing. |
598 // | 589 // |
599 // This scope is inside a 'with' of some outer scope. | 590 // This scope is inside a 'with' of some outer scope. |
600 bool scope_inside_with_; | 591 bool scope_inside_with_; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 PendingCompilationErrorHandler pending_error_handler_; | 765 PendingCompilationErrorHandler pending_error_handler_; |
775 | 766 |
776 // For tracking which classes are declared consecutively. Needed for strong | 767 // For tracking which classes are declared consecutively. Needed for strong |
777 // mode. | 768 // mode. |
778 int class_declaration_group_start_; | 769 int class_declaration_group_start_; |
779 }; | 770 }; |
780 | 771 |
781 } } // namespace v8::internal | 772 } } // namespace v8::internal |
782 | 773 |
783 #endif // V8_SCOPES_H_ | 774 #endif // V8_SCOPES_H_ |
OLD | NEW |