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

Unified Diff: src/parsing/preparser.h

Issue 2160593002: Introduce parent ScopeState class and track the scope through the state in the parser (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add module() helper 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 side-by-side diff with in-line comments
Download patch
Index: src/parsing/preparser.h
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h
index c246fb14a68a7f195ac4dffc7fc34245edd2f009..a010d6775898ddc5f03b44bc514fb25278fdb9c8 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -1034,7 +1034,8 @@ class PreParser : public ParserBase<PreParserTraits> {
// during parsing.
PreParseResult PreParseProgram(int* materialized_literals = 0,
bool is_module = false) {
- Scope* scope = NewScope(scope_, SCRIPT_SCOPE);
+ DCHECK_NULL(state_);
+ Scope* scope = NewScope(nullptr, SCRIPT_SCOPE);
// ModuleDeclarationInstantiation for Source Text Module Records creates a
// new Module Environment Record whose outer lexical environment record is
@@ -1043,8 +1044,8 @@ class PreParser : public ParserBase<PreParserTraits> {
scope = NewScope(scope, MODULE_SCOPE);
}
- PreParserFactory factory(NULL);
- FunctionState top_scope(&function_state_, &scope_, scope, kNormalFunction,
+ PreParserFactory factory(nullptr);
+ FunctionState top_scope(&function_state_, &state_, scope, kNormalFunction,
&factory);
bool ok = true;
int start_position = scanner()->peek_location().beg_pos;
@@ -1053,7 +1054,7 @@ class PreParser : public ParserBase<PreParserTraits> {
if (stack_overflow()) return kPreParseStackOverflow;
if (!ok) {
ReportUnexpectedToken(scanner()->current_token());
- } else if (is_strict(scope_->language_mode())) {
+ } else if (is_strict(this->scope()->language_mode())) {
CheckStrictOctalLiteral(start_position, scanner()->location().end_pos,
&ok);
CheckDecimalLiteralWithLeadingZero(use_counts_, start_position,
@@ -1242,11 +1243,11 @@ PreParserStatementList PreParser::ParseEagerFunctionBody(
FunctionLiteral::FunctionType function_type, bool* ok) {
ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
- Scope* inner_scope = scope_;
- if (!parameters.is_simple) inner_scope = NewScope(scope_, BLOCK_SCOPE);
+ Scope* inner_scope = scope();
+ if (!parameters.is_simple) inner_scope = NewScope(scope(), BLOCK_SCOPE);
{
- BlockState block_state(&scope_, inner_scope);
+ BlockState block_state(&state_, inner_scope);
ParseStatementList(Token::RBRACE, ok);
if (!*ok) return PreParserStatementList();
}

Powered by Google App Engine
This is Rietveld 408576698