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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 ast_value_factory, log, this), | 1031 ast_value_factory, log, this), |
1032 use_counts_(nullptr) {} | 1032 use_counts_(nullptr) {} |
1033 | 1033 |
1034 // Pre-parse the program from the character stream; returns true on | 1034 // Pre-parse the program from the character stream; returns true on |
1035 // success (even if parsing failed, the pre-parse data successfully | 1035 // success (even if parsing failed, the pre-parse data successfully |
1036 // captured the syntax error), and false if a stack-overflow happened | 1036 // captured the syntax error), and false if a stack-overflow happened |
1037 // during parsing. | 1037 // during parsing. |
1038 PreParseResult PreParseProgram(int* materialized_literals = 0, | 1038 PreParseResult PreParseProgram(int* materialized_literals = 0, |
1039 bool is_module = false) { | 1039 bool is_module = false) { |
1040 DCHECK_NULL(scope_state_); | 1040 DCHECK_NULL(scope_state_); |
1041 Scope* scope = NewScope(nullptr, SCRIPT_SCOPE); | 1041 Scope* scope = NewScriptScope(); |
1042 | 1042 |
1043 // ModuleDeclarationInstantiation for Source Text Module Records creates a | 1043 // ModuleDeclarationInstantiation for Source Text Module Records creates a |
1044 // new Module Environment Record whose outer lexical environment record is | 1044 // new Module Environment Record whose outer lexical environment record is |
1045 // the global scope. | 1045 // the global scope. |
1046 if (is_module) { | 1046 if (is_module) { |
1047 scope = NewScope(scope, MODULE_SCOPE); | 1047 scope = NewScope(scope, MODULE_SCOPE); |
1048 } | 1048 } |
1049 | 1049 |
1050 PreParserFactory factory(nullptr); | 1050 PreParserFactory factory(nullptr); |
1051 FunctionState top_scope(&function_state_, &scope_state_, scope, | 1051 FunctionState top_scope(&function_state_, &scope_state_, scope, |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 const PreParserFormalParameters& parameters, FunctionKind kind, | 1265 const PreParserFormalParameters& parameters, FunctionKind kind, |
1266 FunctionLiteral::FunctionType function_type, bool* ok) { | 1266 FunctionLiteral::FunctionType function_type, bool* ok) { |
1267 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, | 1267 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, |
1268 kind, function_type, ok); | 1268 kind, function_type, ok); |
1269 } | 1269 } |
1270 | 1270 |
1271 } // namespace internal | 1271 } // namespace internal |
1272 } // namespace v8 | 1272 } // namespace v8 |
1273 | 1273 |
1274 #endif // V8_PARSING_PREPARSER_H | 1274 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |