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 |
422 // Declarations list. | 429 // Declarations list. |
423 ZoneList<Declaration*>* declarations() { return &decls_; } | 430 ZoneList<Declaration*>* declarations() { return &decls_; } |
424 | 431 |
425 // Inner scope list. | 432 // Inner scope list. |
426 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } | 433 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } |
427 | 434 |
428 // The scope immediately surrounding this scope, or NULL. | 435 // The scope immediately surrounding this scope, or NULL. |
429 Scope* outer_scope() const { return outer_scope_; } | 436 Scope* outer_scope() const { return outer_scope_; } |
430 | 437 |
431 // The ModuleDescriptor for this scope; only for module scopes. | 438 // The ModuleDescriptor for this scope; only for module scopes. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // Convenience variable. | 579 // Convenience variable. |
573 Variable* receiver_; | 580 Variable* receiver_; |
574 // Function variable, if any; function scopes only. | 581 // Function variable, if any; function scopes only. |
575 VariableDeclaration* function_; | 582 VariableDeclaration* function_; |
576 // new.target variable, function scopes only. | 583 // new.target variable, function scopes only. |
577 Variable* new_target_; | 584 Variable* new_target_; |
578 // Convenience variable; function scopes only. | 585 // Convenience variable; function scopes only. |
579 Variable* arguments_; | 586 Variable* arguments_; |
580 // Convenience variable; method scopes only. | 587 // Convenience variable; method scopes only. |
581 Variable* home_object_; | 588 Variable* home_object_; |
| 589 // Convenience variable; Subclass constructor only |
| 590 Variable* this_function_; |
582 // Module descriptor; module scopes only. | 591 // Module descriptor; module scopes only. |
583 ModuleDescriptor* module_descriptor_; | 592 ModuleDescriptor* module_descriptor_; |
584 | 593 |
585 // Illegal redeclaration. | 594 // Illegal redeclaration. |
586 Expression* illegal_redecl_; | 595 Expression* illegal_redecl_; |
587 | 596 |
588 // Scope-specific information computed during parsing. | 597 // Scope-specific information computed during parsing. |
589 // | 598 // |
590 // This scope is inside a 'with' of some outer scope. | 599 // This scope is inside a 'with' of some outer scope. |
591 bool scope_inside_with_; | 600 bool scope_inside_with_; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 PendingCompilationErrorHandler pending_error_handler_; | 774 PendingCompilationErrorHandler pending_error_handler_; |
766 | 775 |
767 // For tracking which classes are declared consecutively. Needed for strong | 776 // For tracking which classes are declared consecutively. Needed for strong |
768 // mode. | 777 // mode. |
769 int class_declaration_group_start_; | 778 int class_declaration_group_start_; |
770 }; | 779 }; |
771 | 780 |
772 } } // namespace v8::internal | 781 } } // namespace v8::internal |
773 | 782 |
774 #endif // V8_SCOPES_H_ | 783 #endif // V8_SCOPES_H_ |
OLD | NEW |