Commit 4efd20ab authored by caitpotter88's avatar caitpotter88 Committed by Commit bot

[parser] report error for shorthand property "await" in async arrow formals

In addition to recording the BindingPattern error, also record an
AsyncArrowFormalParameters error for shorthand property "await" in object
literals.

BUG=v8:4483, v8:5148
R=littledan@chromium.org, jwolfe@igalia.com, adamk@chromium.org, nikolaos@chromium.org

Review-Url: https://codereview.chromium.org/2100623002
Cr-Commit-Position: refs/heads/master@{#37302}
parent fd2bf837
......@@ -1946,10 +1946,16 @@ ParserBase<Traits>::ParsePropertyDefinition(
classifier->RecordLetPatternError(
scanner()->location(), MessageTemplate::kLetInLexicalBinding);
}
if (is_await && is_async_function()) {
classifier->RecordPatternError(
Scanner::Location(next_beg_pos, next_end_pos),
MessageTemplate::kAwaitBindingIdentifier);
if (is_await) {
if (is_async_function()) {
classifier->RecordPatternError(
Scanner::Location(next_beg_pos, next_end_pos),
MessageTemplate::kAwaitBindingIdentifier);
} else {
classifier->RecordAsyncArrowFormalParametersError(
Scanner::Location(next_beg_pos, next_end_pos),
MessageTemplate::kAwaitBindingIdentifier);
}
}
ExpressionT lhs = this->ExpressionFromIdentifier(
*name, next_beg_pos, next_end_pos, scope_, factory());
......
......@@ -7716,17 +7716,9 @@ TEST(AsyncAwaitErrors) {
arraysize(always_flags));
RunParserSyncTest(strict_context_data, strict_error_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
{
// TODO(caitp): support these early errors in preparser
USE(formal_parameters_data);
// const bool kIsModule = false;
// const bool kTestPreparser = false;
// TODO(caitp): These tests seem to fail test-parsing.cc, even with
// test_preparser disabled.
// RunParserSyncTest(context_data, formal_parameters_data, kError, NULL, 0,
// always_flags, arraysize(always_flags), NULL, 0,
// kIsModule, kTestPreparser);
}
RunParserSyncTest(context_data, formal_parameters_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
}
TEST(AsyncAwaitModule) {
......
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