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

Side by Side Diff: test/codegen/language/syncstar_yieldstar_test.dart

Issue 1243503007: fixes #221, initial sync*, async, async* implementation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « test/codegen/language/syncstar_yield_test.dart ('k') | test/codegen/syncstar_syntax.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // TODO(jmesserly): this is a copy of the language test of the same name, 5 // TODO(jmesserly): this is a copy of the language test of the same name,
6 // we can remove this copy when we're running against those tests. 6 // we can remove this copy when we're running against those tests.
7 import "expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 bar() sync* { 9 bar() sync* {
10 int i = 1; 10 int i = 1;
11 int j = 1; 11 int j = 1;
12 while (true) { 12 while (true) {
13 yield i; 13 yield i;
14 j = i + j; 14 j = i + j;
15 i = j - i; 15 i = j - i;
16 } 16 }
17 } 17 }
18 18
19 foo() sync* { 19 foo() sync* {
20 yield* [1, 2, 3]; 20 yield* [1, 2, 3];
21 yield null; 21 yield null;
22 // TODO(jmesserly): added cast here to work around: 22 // TODO(jmesserly): added cast here to work around:
23 // https://codereview.chromium.org/1213503002/ 23 // https://codereview.chromium.org/1213503002/
24 yield* bar() as Iterable; 24 yield* bar() as Iterable;
25 } 25 }
26 26
27 main () async { 27 main () async {
28 Expect.listEquals([1, 2, 3, null, 1, 1, 2, 3, 5], foo().take(9).toList()); 28 Expect.listEquals([1, 2, 3, null, 1, 1, 2, 3, 5], foo().take(9).toList());
29 } 29 }
OLDNEW
« no previous file with comments | « test/codegen/language/syncstar_yield_test.dart ('k') | test/codegen/syncstar_syntax.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698