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

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

Issue 2158913005: Introduce NewScriptScope that creates a top-level scope (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/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/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
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
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
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