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

Unified Diff: test/mjsunit/harmony/generators.js

Issue 1750543002: Fix accidental bug in yield* desugaring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/generators.js
diff --git a/test/mjsunit/harmony/generators.js b/test/mjsunit/harmony/generators.js
index 5b045049e9963c1d31bf15584544d6906f3b3a31..df6cec892532b83d37601f639ccda8aed6188d12 100644
--- a/test/mjsunit/harmony/generators.js
+++ b/test/mjsunit/harmony/generators.js
@@ -237,8 +237,8 @@
let x = g();
assertEquals({value: 1, done: false}, x.next());
assertEquals({value: 42, done: false}, x.next());
- assertEquals({value: 43, done: false}, x.return(666));
- assertEquals({value: undefined, done: false}, x.next());
+ assertEquals({value: 43, done: false}, x.return(44));
+ assertEquals({value: 44, done: false}, x.next());
assertEquals({value: undefined, done: true}, x.next());
}
@@ -250,3 +250,23 @@
assertThrowsEquals(() => x.next(), 666);
}
}
+
+
+{ // yield*, .return argument is final result
+
+ function* inner() {
+ yield 2;
+ }
+
+ function* g() {
+ yield 1;
+ return yield* inner();
+ }
+
+ {
+ let x = g();
+ assertEquals({value: 1, done: false}, x.next());
+ assertEquals({value: 2, done: false}, x.next());
+ assertEquals({value: 42, done: true}, x.return(42));
+ }
+}
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698