Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: src/parsing/parser-base.h

Issue 2165923002: Inline Scope::Initialize into the only constructor that's always called right before (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 private: 613 private:
614 ParserBase* parser_; 614 ParserBase* parser_;
615 Mode old_mode_; 615 Mode old_mode_;
616 }; 616 };
617 617
618 Scope* NewScope(Scope* parent, ScopeType scope_type) { 618 Scope* NewScope(Scope* parent, ScopeType scope_type) {
619 // Must always pass the function kind for FUNCTION_SCOPE. 619 // Must always pass the function kind for FUNCTION_SCOPE.
620 DCHECK(scope_type != FUNCTION_SCOPE); 620 DCHECK(scope_type != FUNCTION_SCOPE);
621 Scope* result = 621 Scope* result =
622 new (zone()) Scope(zone(), parent, scope_type, kNormalFunction); 622 new (zone()) Scope(zone(), parent, scope_type, kNormalFunction);
623 result->Initialize();
624 if (scope_type == MODULE_SCOPE) result->DeclareThis(ast_value_factory()); 623 if (scope_type == MODULE_SCOPE) result->DeclareThis(ast_value_factory());
625 return result; 624 return result;
626 } 625 }
627 626
628 Scope* NewFunctionScope(FunctionKind kind) { 627 Scope* NewFunctionScope(FunctionKind kind) {
629 DCHECK(ast_value_factory()); 628 DCHECK(ast_value_factory());
630 Scope* result = new (zone()) Scope(zone(), scope(), FUNCTION_SCOPE, kind); 629 Scope* result = new (zone()) Scope(zone(), scope(), FUNCTION_SCOPE, kind);
631 result->Initialize();
632 if (!IsArrowFunction(kind)) { 630 if (!IsArrowFunction(kind)) {
633 result->DeclareThis(ast_value_factory()); 631 result->DeclareThis(ast_value_factory());
634 result->DeclareDefaultFunctionVariables(ast_value_factory()); 632 result->DeclareDefaultFunctionVariables(ast_value_factory());
635 } 633 }
636 return result; 634 return result;
637 } 635 }
638 636
639 Scanner* scanner() const { return scanner_; } 637 Scanner* scanner() const { return scanner_; }
640 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } 638 AstValueFactory* ast_value_factory() const { return ast_value_factory_; }
641 int position() { return scanner_->location().beg_pos; } 639 int position() { return scanner_->location().beg_pos; }
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 has_seen_constructor_ = true; 3682 has_seen_constructor_ = true;
3685 return; 3683 return;
3686 } 3684 }
3687 } 3685 }
3688 3686
3689 3687
3690 } // namespace internal 3688 } // namespace internal
3691 } // namespace v8 3689 } // namespace v8
3692 3690
3693 #endif // V8_PARSING_PARSER_BASE_H 3691 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698