Commit e50f6432 authored by Caitlin Potter's avatar Caitlin Potter Committed by Commit Bot

[parser] propagate async arrow formal parameter error in arrow parameters

Instead of just discarding the expression classifier after parsing an after
parsing an arrow function, accumulate the async arrow formal parameters errors

BUG=v8:7817
R=gsathya@chromium.org, littledan@chromium.org, marja@chromium.org

Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I0a84a25d7d42f89200b6fbf05eab3d39ab51fb10
Reviewed-on: https://chromium-review.googlesource.com/1113622Reviewed-by: 's avatarDaniel Ehrenberg <littledan@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Cr-Commit-Position: refs/heads/master@{#54034}
parent 1744f10a
......@@ -2942,7 +2942,7 @@ ParserBase<Impl>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
}
expression = ParseArrowFunctionLiteral(accept_IN, parameters,
rewritable_length, CHECK_OK);
DiscardExpressionClassifier();
Accumulate(ExpressionClassifier::AsyncArrowFormalParametersProduction);
classifier()->RecordPatternError(arrow_loc,
MessageTemplate::kUnexpectedToken,
Token::String(Token::ARROW));
......
......@@ -8693,6 +8693,14 @@ TEST(AsyncAwait) {
"function* g() { var f = async(yield); }",
"function* g() { var f = async(x = yield); }",
// v8:7817 assert that `await` is still allowed in the body of an arrow fn
// within formal parameters
"async(a = a => { var await = 1; return 1; }) => a()",
"async(a = await => 1); async(a) => 1",
"(async(a = await => 1), async(a) => 1)",
"async(a = await => 1, b = async() => 1);",
nullptr
};
// clang-format on
......@@ -8839,6 +8847,12 @@ TEST(AsyncAwaitErrors) {
"async(...a = b) => b",
"async(...a,) => b",
"async(...a, b) => b",
// v8:7817 assert that `await` is an invalid identifier in arrow formal
// parameters nested within an async arrow function
"async(a = await => 1) => a",
"async(a = (await) => 1) => a",
"async(a = (...await) => 1) => a",
nullptr
};
......
......@@ -603,11 +603,6 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=7814
'built-ins/Array/prototype/splice/property-traps-order-with-species': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=7817
'language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position': [FAIL],
'language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position': [FAIL],
'language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=6705
'built-ins/Object/assign/strings-and-symbol-order': [FAIL],
......
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