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/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/hashmap.h" | 10 #include "src/base/hashmap.h" |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 DCHECK_NULL(scope_state_); | 1042 DCHECK_NULL(scope_state_); |
1043 Scope* scope = NewScriptScope(); | 1043 Scope* scope = NewScriptScope(); |
1044 | 1044 |
1045 // ModuleDeclarationInstantiation for Source Text Module Records creates a | 1045 // ModuleDeclarationInstantiation for Source Text Module Records creates a |
1046 // new Module Environment Record whose outer lexical environment record is | 1046 // new Module Environment Record whose outer lexical environment record is |
1047 // the global scope. | 1047 // the global scope. |
1048 if (is_module) { | 1048 if (is_module) { |
1049 scope = NewScopeWithParent(scope, MODULE_SCOPE); | 1049 scope = NewScopeWithParent(scope, MODULE_SCOPE); |
1050 } | 1050 } |
1051 | 1051 |
1052 PreParserFactory factory(nullptr); | |
1053 FunctionState top_scope(&function_state_, &scope_state_, scope, | 1052 FunctionState top_scope(&function_state_, &scope_state_, scope, |
1054 kNormalFunction, &factory); | 1053 kNormalFunction); |
1055 bool ok = true; | 1054 bool ok = true; |
1056 int start_position = scanner()->peek_location().beg_pos; | 1055 int start_position = scanner()->peek_location().beg_pos; |
1057 parsing_module_ = is_module; | 1056 parsing_module_ = is_module; |
1058 ParseStatementList(Token::EOS, &ok); | 1057 ParseStatementList(Token::EOS, &ok); |
1059 if (stack_overflow()) return kPreParseStackOverflow; | 1058 if (stack_overflow()) return kPreParseStackOverflow; |
1060 if (!ok) { | 1059 if (!ok) { |
1061 ReportUnexpectedToken(scanner()->current_token()); | 1060 ReportUnexpectedToken(scanner()->current_token()); |
1062 } else if (is_strict(this->scope()->language_mode())) { | 1061 } else if (is_strict(this->scope()->language_mode())) { |
1063 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos, | 1062 CheckStrictOctalLiteral(start_position, scanner()->location().end_pos, |
1064 &ok); | 1063 &ok); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 const PreParserFormalParameters& parameters, FunctionKind kind, | 1266 const PreParserFormalParameters& parameters, FunctionKind kind, |
1268 FunctionLiteral::FunctionType function_type, bool* ok) { | 1267 FunctionLiteral::FunctionType function_type, bool* ok) { |
1269 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1268 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
1270 kind, function_type, ok); | 1269 kind, function_type, ok); |
1271 } | 1270 } |
1272 | 1271 |
1273 } // namespace internal | 1272 } // namespace internal |
1274 } // namespace v8 | 1273 } // namespace v8 |
1275 | 1274 |
1276 #endif // V8_PARSING_PREPARSER_H | 1275 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |