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

Unified Diff: src/parsing/parser-base.h

Issue 2235423003: [parser] improve inferred function names for async arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add braces around single-line if stmt 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
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index c7e4daf97c2b555056c1e17d9d7d78d09df19f0f..011999d27289f486ec406d3d53a82ba4796f8022 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2321,12 +2321,17 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN,
accept_IN, &arrow_formals_classifier, CHECK_OK);
}
- if (is_async && peek_any_identifier() && PeekAhead() == Token::ARROW) {
+ if (is_async && this->IsIdentifier(expression) && peek_any_identifier() &&
+ PeekAhead() == Token::ARROW) {
// async Identifier => AsyncConciseBody
IdentifierT name =
ParseAndClassifyIdentifier(&arrow_formals_classifier, CHECK_OK);
- expression = this->ExpressionFromIdentifier(name, position(),
- scanner()->location().end_pos);
+ expression = this->ExpressionFromIdentifier(
+ name, position(), scanner()->location().end_pos, InferName::No);
+ if (fni_) {
+ // Remove `async` keyword from inferred name stack.
+ fni_->RemoveAsyncKeywordFromEnd();
+ }
}
if (peek() == Token::ARROW) {
@@ -2882,10 +2887,13 @@ ParserBase<Traits>::ParseLeftHandSideExpression(
}
Scanner::Location spread_pos;
typename Traits::Type::ExpressionList args;
- if (V8_UNLIKELY(is_async)) {
+ if (V8_UNLIKELY(is_async && this->IsIdentifier(result))) {
ExpressionClassifier async_classifier(this);
args = ParseArguments(&spread_pos, true, &async_classifier, CHECK_OK);
if (peek() == Token::ARROW) {
+ if (fni_) {
+ fni_->RemoveAsyncKeywordFromEnd();
+ }
ValidateBindingPattern(&async_classifier, CHECK_OK);
if (!async_classifier.is_valid_async_arrow_formal_parameters()) {
ReportClassifierError(
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698