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

Side by Side Diff: test/mjsunit/harmony/generators.js

Issue 1901713003: [generators] Perform state dispatch in loop header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --ignition-generators --harmony-do-expressions 5 // Flags: --ignition-generators --harmony-do-expressions
6 6
7 7
8 { // yield in try-catch 8 { // yield in try-catch
9 9
10 let g = function*() { 10 let g = function*() {
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 yield 42; 568 yield 42;
569 yield 42; 569 yield 42;
570 yield 42; 570 yield 42;
571 } 571 }
572 g = foo(); 572 g = foo();
573 for (let i = 0; i < 100; ++i) { 573 for (let i = 0; i < 100; ++i) {
574 assertEquals({value: 42, done: false}, g.next()); 574 assertEquals({value: 42, done: false}, g.next());
575 } 575 }
576 assertEquals({value: undefined, done: true}, g.next()); 576 assertEquals({value: undefined, done: true}, g.next());
577 } 577 }
578
579 {
580 function* foo() {
581 for (let i = 0; i < 3; ++i) {
582 let j = 0
583 yield i;
584 do {
585 yield (i + 10);
586 } while (++j < 2);
587 }
588 }
589 g = foo();
590 assertEquals({value: 0, done: false}, g.next());
591 assertEquals({value: 10, done: false}, g.next());
592 assertEquals({value: 10, done: false}, g.next());
593 assertEquals({value: 1, done: false}, g.next());
594 assertEquals({value: 11, done: false}, g.next());
595 assertEquals({value: 11, done: false}, g.next());
596 assertEquals({value: 2, done: false}, g.next());
597 assertEquals({value: 12, done: false}, g.next());
598 assertEquals({value: 12, done: false}, g.next());
599 assertEquals({value: undefined, done: true}, g.next());
600 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698