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

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

Issue 1751613004: Get rid of the different kinds of yield in the AST & full-codegen. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do an inline call. Created 4 years, 10 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 86e4826ddfee58787d056b831f6616d5bab14526..137cf085c5af5f2fd3001a606f3c5d50c1f29b92 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2129,9 +2129,9 @@ ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier,
ExpressionT generator_object =
factory()->NewVariableProxy(function_state_->generator_object_variable());
ExpressionT expression = Traits::EmptyExpression();
- Yield::Kind kind = Yield::kSuspend;
+ bool delegating = false; // yield*
if (!scanner()->HasAnyLineTerminatorBeforeNext()) {
- if (Check(Token::MUL)) kind = Yield::kDelegating;
+ if (Check(Token::MUL)) delegating = true;
switch (peek()) {
case Token::EOS:
case Token::SEMICOLON:
@@ -2143,10 +2143,8 @@ ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier,
// The above set of tokens is the complete set of tokens that can appear
// after an AssignmentExpression, and none of them can start an
// AssignmentExpression. This allows us to avoid looking for an RHS for
- // a Yield::kSuspend operation, given only one look-ahead token.
- if (kind == Yield::kSuspend)
- break;
- DCHECK_EQ(Yield::kDelegating, kind);
+ // a regular yield, given only one look-ahead token.
+ if (!delegating) break;
// Delegating yields require an RHS; fall through.
default:
expression = ParseAssignmentExpression(false, classifier, CHECK_OK);
@@ -2154,13 +2152,16 @@ ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier,
break;
}
}
- if (kind == Yield::kDelegating) {
+
+ if (delegating) {
return Traits::RewriteYieldStar(generator_object, expression, pos);
}
+
+ expression = Traits::BuildIteratorResult(expression, false);
// Hackily disambiguate o from o.next and o [Symbol.iterator]().
// TODO(verwaest): Come up with a better solution.
typename Traits::Type::YieldExpression yield =
- factory()->NewYield(generator_object, expression, kind, pos);
+ factory()->NewYield(generator_object, expression, pos);
return yield;
}
« 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