Commit 9a558c5f authored by adamk's avatar adamk Committed by Commit bot

Disallow 'yield' in async arrow parameter lists inside generators

R=littledan@chromium.org
BUG=v8:4483

Review-Url: https://codereview.chromium.org/2270223002
Cr-Commit-Position: refs/heads/master@{#38846}
parent cf5180c3
......@@ -2897,6 +2897,7 @@ ParserBase<Impl>::ParseLeftHandSideExpression(ExpressionClassifier* classifier,
fni_->RemoveAsyncKeywordFromEnd();
}
ValidateBindingPattern(&async_classifier, CHECK_OK);
ValidateFormalParameterInitializer(&async_classifier, CHECK_OK);
if (!async_classifier.is_valid_async_arrow_formal_parameters()) {
ReportClassifierError(
async_classifier.async_arrow_formal_parameters_error());
......
......@@ -7685,6 +7685,9 @@ TEST(AsyncAwait) {
"var asyncFn = async({ foo = 1 }) => foo;",
"var asyncFn = async({ foo = 1 } = {}) => foo;",
"function* g() { var f = async(yield); }",
"function* g() { var f = async(x = yield); }",
NULL
};
// clang-format on
......@@ -7792,6 +7795,11 @@ TEST(AsyncAwaitErrors) {
"var f = async(x = await) => 1;",
"function* g() { var f = async yield => 1; }",
"function* g() { var f = async(yield) => 1; }",
"function* g() { var f = async(x = yield) => 1; }",
"function* g() { var f = async({x = yield}) => 1; }",
"class C { async constructor() {} }",
"class C {}; class C2 extends C { async constructor() {} }",
"class C { static async prototype() {} }",
......
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