Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index f450608259a9ae845280f38a274eb103771deddc..9744252b3c7d904b6e8fff5935201453ae17025a 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -6,6 +6,7 @@ |
#include "src/api.h" |
#include "src/ast.h" |
+#include "src/ast-literal-reindexer.h" |
#include "src/bailout-reason.h" |
#include "src/base/platform/platform.h" |
#include "src/bootstrapper.h" |
@@ -1180,6 +1181,7 @@ FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info, |
scope->set_start_position(shared_info->start_position()); |
ExpressionClassifier formals_classifier; |
ParserFormalParameterParsingState parsing_state(scope); |
+ Checkpoint checkpoint(this); |
{ |
// Parsing patterns as variable reference expression creates |
// NewUnresolved references in current scope. Entrer arrow function |
@@ -1198,6 +1200,7 @@ FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info, |
} |
if (ok) { |
+ checkpoint.Restore(&parsing_state.materialized_literals_count); |
Expression* expression = |
ParseArrowFunctionLiteral(parsing_state, formals_classifier, &ok); |
if (ok) { |
@@ -3854,6 +3857,20 @@ void ParserTraits::ParseArrowFunctionFormalParameters( |
} |
+void ParserTraits::ReindexLiterals( |
+ const ParserFormalParameterParsingState& parsing_state) { |
+ if (parser_->function_state_->materialized_literal_count() > 0) { |
+ AstLiteralReindexer reindexer; |
+ |
+ for (const auto p : parsing_state.params) { |
+ if (p.pattern != nullptr) reindexer.Reindex(p.pattern); |
+ } |
+ DCHECK(reindexer.count() <= |
+ parser_->function_state_->materialized_literal_count()); |
+ } |
+} |
+ |
+ |
FunctionLiteral* Parser::ParseFunctionLiteral( |
const AstRawString* function_name, Scanner::Location function_name_location, |
bool name_is_strict_reserved, FunctionKind kind, int function_token_pos, |