Commit 2dc302ae authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] Move async arrow param validation closer to its parsing

Change-Id: I16f68db6b7793e3d7839e0afcd7c5bd6753b0913
Reviewed-on: https://chromium-review.googlesource.com/c/1292063Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56851}
parent 0abf84a9
......@@ -957,12 +957,8 @@ class ParserBase {
ReportClassifierError(classifier()->arrow_formal_parameters_error());
*ok = false;
}
if (is_async && !classifier()->is_valid_async_arrow_formal_parameters()) {
const typename ExpressionClassifier::Error& error =
classifier()->async_arrow_formal_parameters_error();
ReportClassifierError(error);
*ok = false;
}
DCHECK_IMPLIES(is_async,
classifier()->is_valid_async_arrow_formal_parameters());
}
void ValidateLetPattern(bool* ok) {
......@@ -1766,6 +1762,12 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePrimaryExpression(
// async Identifier => AsyncConciseBody
if (peek_any_identifier() && PeekAhead() == Token::ARROW) {
name = ParseAndClassifyIdentifier(CHECK_OK);
if (!classifier()->is_valid_async_arrow_formal_parameters()) {
ReportClassifierError(
classifier()->async_arrow_formal_parameters_error());
*ok = false;
return impl()->NullExpression();
}
infer = InferName::kNo;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment