Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1808)

Unified Diff: src/parsing/expression-classifier.h

Issue 1841543003: [esnext] implement frontend changes for async/await proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase over generator change cl Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/parsing/parser.h » ('j') | src/parsing/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/expression-classifier.h
diff --git a/src/parsing/expression-classifier.h b/src/parsing/expression-classifier.h
index 71fa3d3e89b16018137605ed014740e5027beca4..86e4a4caf9c8caeb46762e58bb6b8adf69a3d054 100644
--- a/src/parsing/expression-classifier.h
+++ b/src/parsing/expression-classifier.h
@@ -39,6 +39,7 @@ class ExpressionClassifier {
ArrowFormalParametersProduction = 1 << 6,
LetPatternProduction = 1 << 7,
CoverInitializedNameProduction = 1 << 8,
+ AsyncArrowFormalParametersProduction = 1 << 9,
ExpressionProductions =
(ExpressionProduction | FormalParameterInitializerProduction),
@@ -49,7 +50,8 @@ class ExpressionClassifier {
StandardProductions = ExpressionProductions | PatternProductions,
AllProductions =
(StandardProductions | FormalParametersProductions |
- ArrowFormalParametersProduction | CoverInitializedNameProduction)
+ ArrowFormalParametersProduction | CoverInitializedNameProduction |
+ AsyncArrowFormalParametersProduction)
};
enum FunctionProperties { NonSimpleParameter = 1 << 0 };
@@ -110,6 +112,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 {
@@ -143,6 +149,10 @@ class ExpressionClassifier {
return cover_initialized_name_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);
}
@@ -219,6 +229,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;
@@ -305,6 +325,9 @@ class ExpressionClassifier {
let_pattern_error_ = inner->let_pattern_error_;
if (errors & CoverInitializedNameProduction)
cover_initialized_name_error_ = inner->cover_initialized_name_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
@@ -349,6 +372,7 @@ class ExpressionClassifier {
Error strict_mode_formal_parameter_error_;
Error let_pattern_error_;
Error cover_initialized_name_error_;
+ Error async_arrow_formal_parameters_error_;
DuplicateFinder* duplicate_finder_;
};
« no previous file with comments | « src/objects.h ('k') | src/parsing/parser.h » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698