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

Unified Diff: src/parsing/parser.cc

Issue 1639343005: [generators] Implement Generator.prototype.return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@yield-star
Patch Set: Another rebase 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/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index dfac2c994fb991771c9f01271653405bb97405af..74e7bf4fc3faa6982c35c1638f4afb7ae4f9c1bb 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -5869,9 +5869,6 @@ Expression* ParserTraits::RewriteYieldStar(
Statement* skip = factory->NewEmptyStatement(nopos);
- enum { kNext, kReturn, kThrow };
- // TODO(neis): Use JSGenerator::ResumeMode once extended with RETURN.
-
// Forward definition for break/continue statements.
WhileStatement* loop = factory->NewWhileStatement(nullptr, nopos);
@@ -5892,7 +5889,7 @@ Expression* ParserTraits::RewriteYieldStar(
Statement* initialize_mode;
{
Expression* mode_proxy = factory->NewVariableProxy(var_mode);
- Expression* knext = factory->NewSmiLiteral(kNext, nopos);
+ Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::NEXT, nopos);
Expression* assignment =
factory->NewAssignment(Token::ASSIGN, mode_proxy, knext, nopos);
initialize_mode = factory->NewExpressionStatement(assignment, nopos);
@@ -6087,7 +6084,8 @@ Expression* ParserTraits::RewriteYieldStar(
Statement* set_mode_return;
{
Expression* mode_proxy = factory->NewVariableProxy(var_mode);
- Expression* kreturn = factory->NewSmiLiteral(kReturn, nopos);
+ Expression* kreturn =
+ factory->NewSmiLiteral(JSGeneratorObject::RETURN, nopos);
Expression* assignment =
factory->NewAssignment(Token::ASSIGN, mode_proxy, kreturn, nopos);
set_mode_return = factory->NewExpressionStatement(assignment, nopos);
@@ -6108,7 +6106,7 @@ Expression* ParserTraits::RewriteYieldStar(
Statement* set_mode_next;
{
Expression* mode_proxy = factory->NewVariableProxy(var_mode);
- Expression* knext = factory->NewSmiLiteral(kNext, nopos);
+ Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::NEXT, nopos);
Expression* assignment =
factory->NewAssignment(Token::ASSIGN, mode_proxy, knext, nopos);
set_mode_next = factory->NewExpressionStatement(assignment, nopos);
@@ -6119,7 +6117,8 @@ Expression* ParserTraits::RewriteYieldStar(
Statement* set_mode_throw;
{
Expression* mode_proxy = factory->NewVariableProxy(var_mode);
- Expression* kthrow = factory->NewSmiLiteral(kThrow, nopos);
+ Expression* kthrow =
+ factory->NewSmiLiteral(JSGeneratorObject::THROW, nopos);
Expression* assignment =
factory->NewAssignment(Token::ASSIGN, mode_proxy, kthrow, nopos);
set_mode_throw = factory->NewExpressionStatement(assignment, nopos);
@@ -6208,9 +6207,11 @@ Expression* ParserTraits::RewriteYieldStar(
case_throw->Add(factory->NewBreakStatement(switch_mode, nopos), zone);
auto cases = new (zone) ZoneList<CaseClause*>(3, zone);
- Expression* knext = factory->NewSmiLiteral(kNext, nopos);
- Expression* kreturn = factory->NewSmiLiteral(kReturn, nopos);
- Expression* kthrow = factory->NewSmiLiteral(kThrow, nopos);
+ Expression* knext = factory->NewSmiLiteral(JSGeneratorObject::NEXT, nopos);
+ Expression* kreturn =
+ factory->NewSmiLiteral(JSGeneratorObject::RETURN, nopos);
+ Expression* kthrow =
+ factory->NewSmiLiteral(JSGeneratorObject::THROW, nopos);
cases->Add(factory->NewCaseClause(knext, case_next, nopos), zone);
cases->Add(factory->NewCaseClause(kreturn, case_return, nopos), zone);
cases->Add(factory->NewCaseClause(kthrow, case_throw, nopos), zone);
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698