Index: src/parser.h |
diff --git a/src/parser.h b/src/parser.h |
index 58253e1bb6919309a444864f10bfff904efb837f..1a84ec4157aff1210e7a8aeb2458d6d4cd91a2e8 100644 |
--- a/src/parser.h |
+++ b/src/parser.h |
@@ -773,8 +773,9 @@ class ParserTraits { |
bool name_is_strict_reserved, FunctionKind kind, |
int function_token_position, FunctionLiteral::FunctionType type, |
FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
- V8_INLINE void SkipLazyFunctionBody(int* materialized_literal_count, |
- int* expected_property_count, bool* ok); |
+ V8_INLINE void SkipLazyFunctionBody( |
+ int* materialized_literal_count, int* expected_property_count, bool* ok, |
+ Scanner::BookmarkScope* bookmark = nullptr); |
V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
const AstRawString* name, int pos, Variable* fvar, |
Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
@@ -1023,12 +1024,16 @@ class Parser : public ParserBase<ParserTraits> { |
// Skip over a lazy function, either using cached data if we have it, or |
// by parsing the function with PreParser. Consumes the ending }. |
+ // |
+ // If bookmark is set, the (pre-)parser may decide to abort skipping |
+ // in order to force the function to be eagerly parsed, after all. |
+ // In this case, it'll reset the scanner using the bookmark. |
void SkipLazyFunctionBody(int* materialized_literal_count, |
- int* expected_property_count, |
- bool* ok); |
+ int* expected_property_count, bool* ok, |
+ Scanner::BookmarkScope* bookmark = nullptr); |
PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
- SingletonLogger* logger); |
+ SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); |
// Consumes the ending }. |
ZoneList<Statement*>* ParseEagerFunctionBody( |
@@ -1089,10 +1094,10 @@ const AstRawString* ParserTraits::EmptyIdentifierString() { |
void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, |
- int* expected_property_count, |
- bool* ok) { |
- return parser_->SkipLazyFunctionBody( |
- materialized_literal_count, expected_property_count, ok); |
+ int* expected_property_count, bool* ok, |
+ Scanner::BookmarkScope* bookmark) { |
+ return parser_->SkipLazyFunctionBody(materialized_literal_count, |
+ expected_property_count, ok, bookmark); |
} |