| Index: src/parsing/expression-classifier.h
|
| diff --git a/src/parsing/expression-classifier.h b/src/parsing/expression-classifier.h
|
| index 7b31a2143f281149e3751564ee5c0f8adcfbe6e2..1b50204b6e4910c7a3db76a2a74c86bfee120ec4 100644
|
| --- a/src/parsing/expression-classifier.h
|
| +++ b/src/parsing/expression-classifier.h
|
| @@ -394,11 +394,21 @@ class ExpressionClassifier {
|
| if (errors != 0) {
|
| invalid_productions_ |= errors;
|
| int arrow_index = inner->reported_errors_end_;
|
| + int hole_index = inner->reported_errors_end_;
|
| for (int i = inner->reported_errors_begin_;
|
| i < inner->reported_errors_end_; i++) {
|
| - if (reported_errors_->at(i).kind == kUnusedError ||
|
| - reported_errors_->at(i).kind == kArrowFormalParametersProduction)
|
| + if (reported_errors_->at(i).kind == kUnusedError) continue;
|
| + if (reported_errors_->at(i).kind ==
|
| + kArrowFormalParametersProduction) {
|
| + // Accumulate an ArrowFormalParametersProduction error as a hole in
|
| + // the list, to avoid having to shift all the remaining errors.
|
| + // This is an optimization for a frequently occurring case.
|
| + if (reported_errors_end_ == i) {
|
| + hole_index = reported_errors_end_++;
|
| + reported_errors_->at(i).kind = kUnusedError;
|
| + }
|
| continue;
|
| + }
|
| if (errors & (1 << reported_errors_->at(i).kind))
|
| Move(i);
|
| if (reported_errors_->at(i).kind == kBindingPatternProduction &&
|
| @@ -414,7 +424,13 @@ class ExpressionClassifier {
|
| }
|
| }
|
| if (arrow_index < inner->reported_errors_end_) {
|
| - if (reported_errors_end_ < inner->reported_errors_end_) {
|
| + if (hole_index < inner->reported_errors_end_) {
|
| + // Use a hole in the list (if any exists) to store the additional
|
| + // ArrowFormalParametersProduction error.
|
| + Replace(hole_index, arrow_index);
|
| + reported_errors_->at(hole_index).kind =
|
| + kArrowFormalParametersProduction;
|
| + } else if (reported_errors_end_ < inner->reported_errors_end_) {
|
| Replace(reported_errors_end_, arrow_index);
|
| reported_errors_->at(reported_errors_end_++).kind =
|
| kArrowFormalParametersProduction;
|
|
|