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

Side by Side Diff: src/parsing/preparser.h

Issue 2367383002: Don't track function-kind through FunctionState, always read from underlying scope (Closed)
Patch Set: rebase Created 4 years, 2 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/parsing/parser-base.h ('k') | src/parsing/preparser.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_PREPARSER_H 5 #ifndef V8_PARSING_PREPARSER_H
6 #define V8_PARSING_PREPARSER_H 6 #define V8_PARSING_PREPARSER_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/parsing/parser-base.h" 9 #include "src/parsing/parser-base.h"
10 10
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 PreParseResult PreParseProgram(int* materialized_literals = 0, 786 PreParseResult PreParseProgram(int* materialized_literals = 0,
787 bool is_module = false) { 787 bool is_module = false) {
788 DCHECK_NULL(scope_state_); 788 DCHECK_NULL(scope_state_);
789 DeclarationScope* scope = NewScriptScope(); 789 DeclarationScope* scope = NewScriptScope();
790 790
791 // ModuleDeclarationInstantiation for Source Text Module Records creates a 791 // ModuleDeclarationInstantiation for Source Text Module Records creates a
792 // new Module Environment Record whose outer lexical environment record is 792 // new Module Environment Record whose outer lexical environment record is
793 // the global scope. 793 // the global scope.
794 if (is_module) scope = NewModuleScope(scope); 794 if (is_module) scope = NewModuleScope(scope);
795 795
796 FunctionState top_scope(&function_state_, &scope_state_, scope, 796 FunctionState top_scope(&function_state_, &scope_state_, scope);
797 kNormalFunction);
798 bool ok = true; 797 bool ok = true;
799 int start_position = scanner()->peek_location().beg_pos; 798 int start_position = scanner()->peek_location().beg_pos;
800 parsing_module_ = is_module; 799 parsing_module_ = is_module;
801 PreParserStatementList body; 800 PreParserStatementList body;
802 ParseStatementList(body, Token::EOS, &ok); 801 ParseStatementList(body, Token::EOS, &ok);
803 if (stack_overflow()) return kPreParseStackOverflow; 802 if (stack_overflow()) return kPreParseStackOverflow;
804 if (!ok) { 803 if (!ok) {
805 ReportUnexpectedToken(scanner()->current_token()); 804 ReportUnexpectedToken(scanner()->current_token());
806 } else if (is_strict(this->scope()->language_mode())) { 805 } else if (is_strict(this->scope()->language_mode())) {
807 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos, 806 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos,
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 function_state_->NextMaterializedLiteralIndex(); 1460 function_state_->NextMaterializedLiteralIndex();
1462 function_state_->NextMaterializedLiteralIndex(); 1461 function_state_->NextMaterializedLiteralIndex();
1463 } 1462 }
1464 return EmptyExpression(); 1463 return EmptyExpression();
1465 } 1464 }
1466 1465
1467 } // namespace internal 1466 } // namespace internal
1468 } // namespace v8 1467 } // namespace v8
1469 1468
1470 #endif // V8_PARSING_PREPARSER_H 1469 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698