Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Unified Diff: src/parsing/parser.cc

Issue 2267493002: Disallow 'await' in object literal shorthand position (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More cleanup Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 60938c7036dc22222409df0c516109dcd8dd233a..970d49dc0ac410994e736bdad7c072a62eb33848 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -401,10 +401,6 @@ bool ParserTraits::IsUndefined(const AstRawString* identifier) const {
return identifier == parser_->ast_value_factory()->undefined_string();
}
-bool ParserTraits::IsAwait(const AstRawString* identifier) const {
- return identifier == parser_->ast_value_factory()->await_string();
-}
-
bool ParserTraits::IsPrototype(const AstRawString* identifier) const {
return identifier == parser_->ast_value_factory()->prototype_string();
}
@@ -2179,13 +2175,6 @@ Statement* Parser::ParseHoistableDeclaration(
variable_name = name;
}
- if (V8_UNLIKELY(is_async_function() && this->IsAwait(name))) {
- ReportMessageAt(scanner()->location(),
- MessageTemplate::kAwaitBindingIdentifier);
- *ok = false;
- return nullptr;
- }
-
FuncNameInferrer::State fni_state(fni_);
if (fni_ != NULL) fni_->PushEnclosingName(name);
FunctionLiteral* fun = ParseFunctionLiteral(
@@ -4490,13 +4479,8 @@ Expression* Parser::ParseAsyncFunctionExpression(bool* ok) {
if (peek_any_identifier()) {
type = FunctionLiteral::kNamedExpression;
- name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK);
- if (this->IsAwait(name)) {
- ReportMessageAt(scanner()->location(),
- MessageTemplate::kAwaitBindingIdentifier);
- *ok = false;
- return nullptr;
- }
+ name = ParseIdentifierOrStrictReservedWord(FunctionKind::kAsyncFunction,
+ &is_strict_reserved, CHECK_OK);
}
return ParseFunctionLiteral(name, scanner()->location(),
is_strict_reserved ? kFunctionNameIsStrictReserved
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698