| Index: src/parsing/expression-classifier.h
|
| diff --git a/src/parsing/expression-classifier.h b/src/parsing/expression-classifier.h
|
| index dfb582d326504bee5aa4d246432d1749f104a2d2..cb24011a5655451a684ca4d2a60e0376346b20e4 100644
|
| --- a/src/parsing/expression-classifier.h
|
| +++ b/src/parsing/expression-classifier.h
|
| @@ -40,6 +40,7 @@ class ExpressionClassifier {
|
| LetPatternProduction = 1 << 7,
|
| CoverInitializedNameProduction = 1 << 8,
|
| TailCallExpressionProduction = 1 << 9,
|
| + AsyncArrowFormalParametersProduction = 1 << 10,
|
|
|
| ExpressionProductions =
|
| (ExpressionProduction | FormalParameterInitializerProduction |
|
| @@ -51,7 +52,8 @@ class ExpressionClassifier {
|
| StandardProductions = ExpressionProductions | PatternProductions,
|
| AllProductions =
|
| (StandardProductions | FormalParametersProductions |
|
| - ArrowFormalParametersProduction | CoverInitializedNameProduction)
|
| + ArrowFormalParametersProduction | CoverInitializedNameProduction |
|
| + AsyncArrowFormalParametersProduction)
|
| };
|
|
|
| enum FunctionProperties { NonSimpleParameter = 1 << 0 };
|
| @@ -112,6 +114,10 @@ class ExpressionClassifier {
|
|
|
| bool is_valid_let_pattern() const { return is_valid(LetPatternProduction); }
|
|
|
| + bool is_valid_async_arrow_formal_parameters() const {
|
| + return is_valid(AsyncArrowFormalParametersProduction);
|
| + }
|
| +
|
| const Error& expression_error() const { return expression_error_; }
|
|
|
| const Error& formal_parameter_initializer_error() const {
|
| @@ -151,6 +157,9 @@ class ExpressionClassifier {
|
| const Error& tail_call_expression_error() const {
|
| return tail_call_expression_error_;
|
| }
|
| + const Error& async_arrow_formal_parameters_error() const {
|
| + return async_arrow_formal_parameters_error_;
|
| + }
|
|
|
| bool is_simple_parameter_list() const {
|
| return !(function_properties_ & NonSimpleParameter);
|
| @@ -228,6 +237,16 @@ class ExpressionClassifier {
|
| arrow_formal_parameters_error_.arg = arg;
|
| }
|
|
|
| + void RecordAsyncArrowFormalParametersError(const Scanner::Location& loc,
|
| + MessageTemplate::Template message,
|
| + const char* arg = nullptr) {
|
| + if (!is_valid_async_arrow_formal_parameters()) return;
|
| + invalid_productions_ |= AsyncArrowFormalParametersProduction;
|
| + async_arrow_formal_parameters_error_.location = loc;
|
| + async_arrow_formal_parameters_error_.message = message;
|
| + async_arrow_formal_parameters_error_.arg = arg;
|
| + }
|
| +
|
| void RecordDuplicateFormalParameterError(const Scanner::Location& loc) {
|
| if (!is_valid_formal_parameter_list_without_duplicates()) return;
|
| invalid_productions_ |= DistinctFormalParametersProduction;
|
| @@ -326,6 +345,9 @@ class ExpressionClassifier {
|
| cover_initialized_name_error_ = inner->cover_initialized_name_error_;
|
| if (errors & TailCallExpressionProduction)
|
| tail_call_expression_error_ = inner->tail_call_expression_error_;
|
| + if (errors & AsyncArrowFormalParametersProduction)
|
| + async_arrow_formal_parameters_error_ =
|
| + inner->async_arrow_formal_parameters_error_;
|
| }
|
|
|
| // As an exception to the above, the result continues to be a valid arrow
|
| @@ -373,6 +395,7 @@ class ExpressionClassifier {
|
| Error let_pattern_error_;
|
| Error cover_initialized_name_error_;
|
| Error tail_call_expression_error_;
|
| + Error async_arrow_formal_parameters_error_;
|
| DuplicateFinder* duplicate_finder_;
|
| };
|
|
|
|
|