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

Unified Diff: src/parsing/parser.cc

Issue 2039883002: Version 5.2.361.16 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.2
Patch Set: Created 4 years, 6 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 | « include/v8-version.h ('k') | test/mjsunit/harmony/iterator-close.js » ('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 b74c027842ecf174e339c0aeaea41844749ce9a5..b4e4176d657f47d00b52c958eb029fb20150a8b3 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -6400,12 +6400,18 @@ void ParserTraits::BuildIteratorClose(ZoneList<Statement*>* statements,
// following code:
//
// let iteratorReturn = iterator.return;
- // if (IS_NULL_OR_UNDEFINED(iteratorReturn) return |input|;
- // output = %_Call(iteratorReturn, iterator|, input|);
+ // if (IS_NULL_OR_UNDEFINED(iteratorReturn) {
+ // return {value: input, done: true};
+ // }
+ // output = %_Call(iteratorReturn, iterator, input);
// if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output);
//
- // Here, |...| denotes optional parts, depending on the presence of the
- // input variable. The reason for allowing input is that BuildIteratorClose
+ // When the input variable is not given, the return statement becomes
+ // return {value: undefined, done: true};
+ // and %_Call has only two arguments:
+ // output = %_Call(iteratorReturn, iterator);
+ //
+ // The reason for allowing input is that BuildIteratorClose
// can then be reused to handle the return case in yield*.
//
@@ -6429,7 +6435,9 @@ void ParserTraits::BuildIteratorClose(ZoneList<Statement*>* statements,
get_return = factory->NewExpressionStatement(assignment, nopos);
}
- // if (IS_NULL_OR_UNDEFINED(iteratorReturn) return |input|;
+ // if (IS_NULL_OR_UNDEFINED(iteratorReturn) {
+ // return {value: input, done: true};
+ // }
Statement* check_return;
{
Expression* condition = factory->NewCompareOperation(
@@ -6441,13 +6449,14 @@ void ParserTraits::BuildIteratorClose(ZoneList<Statement*>* statements,
factory->NewVariableProxy(input.FromJust()))
: factory->NewUndefinedLiteral(nopos);
- Statement* return_input = factory->NewReturnStatement(value, nopos);
+ Statement* return_input =
+ factory->NewReturnStatement(BuildIteratorResult(value, true), nopos);
check_return = factory->NewIfStatement(
condition, return_input, factory->NewEmptyStatement(nopos), nopos);
}
- // output = %_Call(iteratorReturn, iterator, |input|);
+ // output = %_Call(iteratorReturn, iterator, input);
Statement* call_return;
{
auto args = new (zone) ZoneList<Expression*>(3, zone);
« no previous file with comments | « include/v8-version.h ('k') | test/mjsunit/harmony/iterator-close.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698