OLD | NEW |
1 dart_library.library('syncstar_syntax', null, /* Imports */[ | 1 dart_library.library('syncstar_syntax', null, /* Imports */[ |
2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
3 'dart/core' | 3 'dart/core', |
| 4 'expect/expect' |
4 ], /* Lazy imports */[ | 5 ], /* Lazy imports */[ |
5 ], function(exports, dart, core) { | 6 ], function(exports, dart, core, expect) { |
6 'use strict'; | 7 'use strict'; |
7 let dartx = dart.dartx; | 8 let dartx = dart.dartx; |
8 function* foo() { | 9 function foo() { |
9 yield 1; | 10 return dart.syncStar(function*() { |
10 yield* dart.list([2, 3], core.int); | 11 yield 1; |
| 12 yield* dart.list([2, 3], core.int); |
| 13 }, core.int); |
11 } | 14 } |
12 dart.fn(foo, core.Iterable$(core.int), []); | 15 dart.fn(foo, core.Iterable$(core.int), []); |
13 class Class extends core.Object { | 16 class Class extends core.Object { |
14 *bar() { | 17 bar() { |
15 yield 1; | 18 return dart.syncStar(function*() { |
16 yield* dart.list([2, 3], core.int); | 19 yield 1; |
| 20 yield* dart.list([2, 3], core.int); |
| 21 }, core.int); |
17 } | 22 } |
18 static *baz() { | 23 static baz() { |
19 yield 1; | 24 return dart.syncStar(function*() { |
20 yield* dart.list([2, 3], core.int); | 25 yield 1; |
| 26 yield* dart.list([2, 3], core.int); |
| 27 }, core.int); |
21 } | 28 } |
22 } | 29 } |
23 dart.setSignature(Class, { | 30 dart.setSignature(Class, { |
24 methods: () => ({bar: [core.Iterable$(core.int), []]}), | 31 methods: () => ({bar: [core.Iterable$(core.int), []]}), |
25 statics: () => ({baz: [core.Iterable$(core.int), []]}), | 32 statics: () => ({baz: [core.Iterable$(core.int), []]}), |
26 names: ['baz'] | 33 names: ['baz'] |
27 }); | 34 }); |
28 function main() { | 35 function main() { |
29 function* qux() { | 36 function qux() { |
30 yield 1; | 37 return dart.syncStar(function*() { |
31 yield* dart.list([2, 3], core.int); | 38 yield 1; |
| 39 yield* dart.list([2, 3], core.int); |
| 40 }, core.int); |
32 } | 41 } |
33 dart.fn(qux, core.Iterable$(core.int), []); | 42 dart.fn(qux, core.Iterable$(core.int), []); |
34 foo()[dartx.forEach](core.print); | 43 expect.Expect.listEquals([1, 2, 3], foo()[dartx.toList]()); |
35 new Class().bar()[dartx.forEach](core.print); | 44 expect.Expect.listEquals([1, 2, 3], new Class().bar()[dartx.toList]()); |
36 Class.baz()[dartx.forEach](core.print); | 45 expect.Expect.listEquals([1, 2, 3], Class.baz()[dartx.toList]()); |
37 qux()[dartx.forEach](core.print); | 46 expect.Expect.listEquals([1, 2, 3], qux()[dartx.toList]()); |
38 } | 47 } |
39 dart.fn(main); | 48 dart.fn(main); |
40 // Exports: | 49 // Exports: |
41 exports.foo = foo; | 50 exports.foo = foo; |
42 exports.Class = Class; | 51 exports.Class = Class; |
43 exports.main = main; | 52 exports.main = main; |
44 }); | 53 }); |
OLD | NEW |