Commit a868f6e3 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[cctest] Add a bit of test coverage for disallowing `await` in async params

This enforces that we use ParseExpressionCoverGrammar, and not ParseExpression,
for several tricky cases. Also clarify comment on ParserBase::ParseExpression().

Change-Id: I1d1289abdf539c96f4b42f97c79a8adf3c06e728
Reviewed-on: https://chromium-review.googlesource.com/783171
Commit-Queue: Adam Klein <adamk@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49647}
parent bfa90f7e
...@@ -1082,8 +1082,8 @@ class ParserBase { ...@@ -1082,8 +1082,8 @@ class ParserBase {
// This method wraps the parsing of the expression inside a new expression // This method wraps the parsing of the expression inside a new expression
// classifier and calls RewriteNonPattern if parsing is successful. // classifier and calls RewriteNonPattern if parsing is successful.
// It should be used whenever we're parsing an expression that will be // It should be used whenever we're parsing an expression that is known
// used as a non-pattern (i.e., in most cases). // to not be a pattern or part of a pattern.
V8_INLINE ExpressionT ParseExpression(bool accept_IN, bool* ok); V8_INLINE ExpressionT ParseExpression(bool accept_IN, bool* ok);
// This method does not wrap the parsing of the expression inside a // This method does not wrap the parsing of the expression inside a
......
...@@ -8638,6 +8638,11 @@ TEST(AsyncAwaitFormalParameters) { ...@@ -8638,6 +8638,11 @@ TEST(AsyncAwaitFormalParameters) {
"x = class await {}", "x = class await {}",
"x = 1 ? class await {} : 0", "x = 1 ? class await {} : 0",
"x = async function await() {}", "x = async function await() {}",
"x = y[await]",
"x = `${await}`",
"x = y()[await]",
nullptr nullptr
}; };
// clang-format on // clang-format on
......
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