| 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_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
| 6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 Scope* NewScopeWithParent(Scope* parent, ScopeType scope_type) const { | 700 Scope* NewScopeWithParent(Scope* parent, ScopeType scope_type) const { |
| 701 // Must always use the specific constructors for the blacklisted scope | 701 // Must always use the specific constructors for the blacklisted scope |
| 702 // types. | 702 // types. |
| 703 DCHECK_NE(FUNCTION_SCOPE, scope_type); | 703 DCHECK_NE(FUNCTION_SCOPE, scope_type); |
| 704 DCHECK_NE(SCRIPT_SCOPE, scope_type); | 704 DCHECK_NE(SCRIPT_SCOPE, scope_type); |
| 705 DCHECK_NE(MODULE_SCOPE, scope_type); | 705 DCHECK_NE(MODULE_SCOPE, scope_type); |
| 706 DCHECK_NOT_NULL(parent); | 706 DCHECK_NOT_NULL(parent); |
| 707 return new (zone()) Scope(zone(), parent, scope_type); | 707 return new (zone()) Scope(zone(), parent, scope_type); |
| 708 } | 708 } |
| 709 | 709 |
| 710 DeclarationScope* NewFunctionScope(FunctionKind kind) const { | 710 // Creates a function scope that always allocates in zone(). The function |
| 711 // scope itself is either allocated in zone() or in target_zone if one is |
| 712 // passed in. |
| 713 DeclarationScope* NewFunctionScope(FunctionKind kind, |
| 714 Zone* target_zone = nullptr) const { |
| 711 DCHECK(ast_value_factory()); | 715 DCHECK(ast_value_factory()); |
| 712 DeclarationScope* result = | 716 if (target_zone == nullptr) target_zone = zone(); |
| 713 new (zone()) DeclarationScope(zone(), scope(), FUNCTION_SCOPE, kind); | 717 DeclarationScope* result = new (target_zone) |
| 718 DeclarationScope(zone(), scope(), FUNCTION_SCOPE, kind); |
| 714 // TODO(verwaest): Move into the DeclarationScope constructor. | 719 // TODO(verwaest): Move into the DeclarationScope constructor. |
| 715 if (!IsArrowFunction(kind)) { | 720 if (!IsArrowFunction(kind)) { |
| 716 result->DeclareDefaultFunctionVariables(ast_value_factory()); | 721 result->DeclareDefaultFunctionVariables(ast_value_factory()); |
| 717 } | 722 } |
| 718 return result; | 723 return result; |
| 719 } | 724 } |
| 720 | 725 |
| 721 V8_INLINE DeclarationScope* GetDeclarationScope() const { | 726 V8_INLINE DeclarationScope* GetDeclarationScope() const { |
| 722 return scope()->GetDeclarationScope(); | 727 return scope()->GetDeclarationScope(); |
| 723 } | 728 } |
| (...skipping 4733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5457 has_seen_constructor_ = true; | 5462 has_seen_constructor_ = true; |
| 5458 return; | 5463 return; |
| 5459 } | 5464 } |
| 5460 } | 5465 } |
| 5461 | 5466 |
| 5462 | 5467 |
| 5463 } // namespace internal | 5468 } // namespace internal |
| 5464 } // namespace v8 | 5469 } // namespace v8 |
| 5465 | 5470 |
| 5466 #endif // V8_PARSING_PARSER_BASE_H | 5471 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |