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

Unified Diff: src/parsing/parser-base.h

Issue 2258313002: [async functions] Disallow 'await' in arrow params inside async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 4 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/parsing/expression-classifier.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 1be215d162542a9c8dbee1f59e1e846f2fcd6595..de30e1bc5420eecdb42810f53c16976baa6b8235 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -929,16 +929,8 @@ class ParserBase : public Traits {
void ValidateBindingPattern(const ExpressionClassifier* classifier,
bool* ok) {
- if (!classifier->is_valid_binding_pattern() ||
- !classifier->is_valid_async_binding_pattern()) {
- const Scanner::Location& a = classifier->binding_pattern_error().location;
- const Scanner::Location& b =
- classifier->async_binding_pattern_error().location;
- if (a.beg_pos < 0 || (b.beg_pos >= 0 && a.beg_pos > b.beg_pos)) {
- ReportClassifierError(classifier->async_binding_pattern_error());
- } else {
- ReportClassifierError(classifier->binding_pattern_error());
- }
+ if (!classifier->is_valid_binding_pattern()) {
+ ReportClassifierError(classifier->binding_pattern_error());
*ok = false;
}
}
@@ -2758,40 +2750,15 @@ ParserBase<Traits>::ParseUnaryExpression(ExpressionClassifier* classifier,
position());
} else if (is_async_function() && peek() == Token::AWAIT) {
- int beg_pos = peek_position();
- switch (PeekAhead()) {
- case Token::RPAREN:
- case Token::RBRACK:
- case Token::RBRACE:
- case Token::ASSIGN:
- case Token::COMMA: {
- Next();
- IdentifierT name = this->GetSymbol(scanner());
-
- // Possibly async arrow formals --- record ExpressionError just in case.
- ExpressionUnexpectedToken(classifier);
- classifier->RecordAsyncBindingPatternError(
- Scanner::Location(beg_pos, scanner()->location().end_pos),
- MessageTemplate::kAwaitBindingIdentifier);
- classifier->RecordAsyncArrowFormalParametersError(
- Scanner::Location(beg_pos, scanner()->location().end_pos),
- MessageTemplate::kAwaitBindingIdentifier);
-
- return this->ExpressionFromIdentifier(name, beg_pos,
- scanner()->location().end_pos);
- }
- default:
- break;
- }
+ classifier->RecordFormalParameterInitializerError(
+ scanner()->peek_location(),
+ MessageTemplate::kAwaitExpressionFormalParameter);
int await_pos = peek_position();
Consume(Token::AWAIT);
ExpressionT value = ParseUnaryExpression(classifier, CHECK_OK);
- classifier->RecordFormalParameterInitializerError(
- Scanner::Location(beg_pos, scanner()->location().end_pos),
- MessageTemplate::kAwaitExpressionFormalParameter);
return Traits::RewriteAwaitExpression(value, await_pos);
} else {
return this->ParsePostfixExpression(classifier, ok);
« no previous file with comments | « src/parsing/expression-classifier.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698