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_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 Loading... |
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 Loading... |
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 |
OLD | NEW |