| 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/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/hashmap.h" | 10 #include "src/base/hashmap.h" |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 } | 608 } |
| 609 ~ParsingModeScope() { | 609 ~ParsingModeScope() { |
| 610 parser_->mode_ = old_mode_; | 610 parser_->mode_ = old_mode_; |
| 611 } | 611 } |
| 612 | 612 |
| 613 private: | 613 private: |
| 614 ParserBase* parser_; | 614 ParserBase* parser_; |
| 615 Mode old_mode_; | 615 Mode old_mode_; |
| 616 }; | 616 }; |
| 617 | 617 |
| 618 Scope* NewScriptScope() { |
| 619 return new (zone()) Scope(zone(), nullptr, SCRIPT_SCOPE, kNormalFunction); |
| 620 } |
| 621 |
| 618 Scope* NewScope(Scope* parent, ScopeType scope_type) { | 622 Scope* NewScope(Scope* parent, ScopeType scope_type) { |
| 619 // Must always pass the function kind for FUNCTION_SCOPE. | 623 // Must always use the specific constructors for the blacklisted scope |
| 620 DCHECK(scope_type != FUNCTION_SCOPE); | 624 // types. |
| 625 DCHECK_NE(FUNCTION_SCOPE, scope_type); |
| 626 DCHECK_NE(SCRIPT_SCOPE, scope_type); |
| 627 DCHECK_NOT_NULL(parent); |
| 621 Scope* result = | 628 Scope* result = |
| 622 new (zone()) Scope(zone(), parent, scope_type, kNormalFunction); | 629 new (zone()) Scope(zone(), parent, scope_type, kNormalFunction); |
| 623 if (scope_type == MODULE_SCOPE) result->DeclareThis(ast_value_factory()); | 630 if (scope_type == MODULE_SCOPE) result->DeclareThis(ast_value_factory()); |
| 624 return result; | 631 return result; |
| 625 } | 632 } |
| 626 | 633 |
| 627 Scope* NewFunctionScope(FunctionKind kind) { | 634 Scope* NewFunctionScope(FunctionKind kind) { |
| 628 DCHECK(ast_value_factory()); | 635 DCHECK(ast_value_factory()); |
| 629 Scope* result = new (zone()) Scope(zone(), scope(), FUNCTION_SCOPE, kind); | 636 Scope* result = new (zone()) Scope(zone(), scope(), FUNCTION_SCOPE, kind); |
| 630 if (!IsArrowFunction(kind)) { | 637 if (!IsArrowFunction(kind)) { |
| (...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3682 has_seen_constructor_ = true; | 3689 has_seen_constructor_ = true; |
| 3683 return; | 3690 return; |
| 3684 } | 3691 } |
| 3685 } | 3692 } |
| 3686 | 3693 |
| 3687 | 3694 |
| 3688 } // namespace internal | 3695 } // namespace internal |
| 3689 } // namespace v8 | 3696 } // namespace v8 |
| 3690 | 3697 |
| 3691 #endif // V8_PARSING_PARSER_BASE_H | 3698 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |