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

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: Rebase 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
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparser.h
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h
index 9704b929dcbe201b33dbfc7aec30632105800fa4..1c4c22741d14373e6aab935e8cab094be52048d0 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -1037,7 +1037,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(scope_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
@@ -1046,9 +1047,9 @@ class PreParser : public ParserBase<PreParserTraits> {
scope = NewScope(scope, MODULE_SCOPE);
}
- PreParserFactory factory(NULL);
- FunctionState top_scope(&function_state_, &scope_, scope, kNormalFunction,
- &factory);
+ PreParserFactory factory(nullptr);
+ FunctionState top_scope(&function_state_, &scope_state_, scope,
+ kNormalFunction, &factory);
bool ok = true;
int start_position = scanner()->peek_location().beg_pos;
parsing_module_ = is_module;
@@ -1056,7 +1057,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,
@@ -1245,11 +1246,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(&scope_state_, inner_scope);
ParseStatementList(Token::RBRACE, ok);
if (!*ok) return PreParserStatementList();
}
« 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