Index: src/parsing/preparser.cc |
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc |
index f7d69cf7444f585cfc14840596e145902926e32c..ee5b3ca29a0a46c864b2391ae5fb90572e06146f 100644 |
--- a/src/parsing/preparser.cc |
+++ b/src/parsing/preparser.cc |
@@ -84,7 +84,7 @@ PreParserIdentifier PreParser::GetSymbol() const { |
} |
PreParser::PreParseResult PreParser::PreParseLazyFunction( |
- DeclarationScope* function_scope, bool parsing_module, ParserRecorder* log, |
+ DeclarationScope* function_scope, bool parsing_module, SingletonLogger* log, |
bool is_inner_function, bool may_abort, int* use_counts) { |
DCHECK_EQ(FUNCTION_SCOPE, function_scope->scope_type()); |
parsing_module_ = parsing_module; |
@@ -101,7 +101,7 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction( |
DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
bool ok = true; |
int start_position = peek_position(); |
- LazyParsingResult result = ParseLazyFunctionLiteralBody(may_abort, &ok); |
+ LazyParsingResult result = ParseStatementListAndLogFunction(may_abort, &ok); |
use_counts_ = nullptr; |
track_unresolved_variables_ = false; |
if (result == kLazyParsingAborted) { |
@@ -109,7 +109,7 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction( |
} else if (stack_overflow()) { |
return kPreParseStackOverflow; |
} else if (!ok) { |
- ReportUnexpectedToken(scanner()->current_token()); |
+ DCHECK(log->has_error()); |
} else { |
DCHECK_EQ(Token::RBRACE, scanner()->peek()); |
if (is_strict(function_scope->language_mode())) { |
@@ -145,7 +145,6 @@ PreParser::Expression PreParser::ParseFunctionLiteral( |
// Parse function body. |
PreParserStatementList body; |
- bool outer_is_script_scope = scope()->is_script_scope(); |
DeclarationScope* function_scope = NewFunctionScope(kind); |
function_scope->SetLanguageMode(language_mode); |
FunctionState function_state(&function_state_, &scope_state_, function_scope); |
@@ -163,17 +162,8 @@ PreParser::Expression PreParser::ParseFunctionLiteral( |
CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, |
formals_end_position, CHECK_OK); |
- // See Parser::ParseFunctionLiteral for more information about lazy parsing |
- // and lazy compilation. |
- bool is_lazily_parsed = (outer_is_script_scope && allow_lazy() && |
- !function_state_->this_function_is_parenthesized()); |
- |
Expect(Token::LBRACE, CHECK_OK); |
- if (is_lazily_parsed) { |
- ParseLazyFunctionLiteralBody(false, CHECK_OK); |
- } else { |
- ParseStatementList(body, Token::RBRACE, CHECK_OK); |
- } |
+ ParseStatementList(body, Token::RBRACE, CHECK_OK); |
Expect(Token::RBRACE, CHECK_OK); |
// Parsing the body may change the language mode in our scope. |
@@ -196,7 +186,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral( |
return Expression::Default(); |
} |
-PreParser::LazyParsingResult PreParser::ParseLazyFunctionLiteralBody( |
+PreParser::LazyParsingResult PreParser::ParseStatementListAndLogFunction( |
bool may_abort, bool* ok) { |
int body_start = position(); |
PreParserStatementList body; |