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