OLD | NEW |
1 dart_library.library('collection/src/iterable_zip', null, /* Imports */[ | 1 dart_library.library('collection/src/iterable_zip', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart/_runtime', |
3 'dart/core', | 3 'dart/core', |
4 'dart/collection' | 4 'dart/collection' |
5 ], /* Lazy imports */[ | 5 ], /* Lazy imports */[ |
6 ], function(exports, dart, core, collection) { | 6 ], function(exports, dart, core, collection) { |
7 'use strict'; | 7 'use strict'; |
8 let dartx = dart.dartx; | 8 let dartx = dart.dartx; |
9 const _iterables = Symbol('_iterables'); | 9 const _iterables = Symbol('_iterables'); |
10 class IterableZip extends collection.IterableBase$(core.List) { | 10 const IterableZip$ = dart.generic(function(T) { |
11 IterableZip(iterables) { | 11 class IterableZip extends collection.IterableBase$(core.List$(T)) { |
12 this[_iterables] = iterables; | 12 IterableZip(iterables) { |
13 super.IterableBase(); | 13 this[_iterables] = iterables; |
| 14 super.IterableBase(); |
| 15 } |
| 16 get iterator() { |
| 17 let iterators = this[_iterables][dartx.map](dart.fn(x => { |
| 18 dart.as(x, core.Iterable$(T)); |
| 19 return x[dartx.iterator]; |
| 20 }, core.Iterator$(T), [core.Iterable$(T)]))[dartx.toList]({growable: fal
se}); |
| 21 return new (_IteratorZip$(T))(iterators); |
| 22 } |
14 } | 23 } |
15 get iterator() { | 24 dart.setSignature(IterableZip, { |
16 let iterators = this[_iterables][dartx.map](dart.fn(x => x[dartx.iterator]
, core.Iterator, [core.Iterable]))[dartx.toList]({growable: false}); | 25 constructors: () => ({IterableZip: [IterableZip$(T), [core.Iterable$(core.
Iterable$(T))]]}) |
17 return new _IteratorZip(iterators); | 26 }); |
18 } | 27 dart.defineExtensionMembers(IterableZip, ['iterator']); |
19 } | 28 return IterableZip; |
20 dart.setSignature(IterableZip, { | |
21 constructors: () => ({IterableZip: [IterableZip, [core.Iterable$(core.Iterab
le)]]}) | |
22 }); | 29 }); |
23 dart.defineExtensionMembers(IterableZip, ['iterator']); | 30 let IterableZip = IterableZip$(); |
24 const _iterators = Symbol('_iterators'); | 31 const _iterators = Symbol('_iterators'); |
25 const _current = Symbol('_current'); | 32 const _current = Symbol('_current'); |
26 class _IteratorZip extends core.Object { | 33 const _IteratorZip$ = dart.generic(function(T) { |
27 _IteratorZip(iterators) { | 34 class _IteratorZip extends core.Object { |
28 this[_iterators] = dart.as(iterators, core.List$(core.Iterator)); | 35 _IteratorZip(iterators) { |
29 this[_current] = null; | 36 this[_iterators] = iterators; |
| 37 this[_current] = null; |
| 38 } |
| 39 moveNext() { |
| 40 if (dart.notNull(this[_iterators][dartx.isEmpty])) return false; |
| 41 for (let i = 0; i < dart.notNull(this[_iterators][dartx.length]); i++) { |
| 42 if (!dart.notNull(this[_iterators][dartx.get](i).moveNext())) { |
| 43 this[_current] = null; |
| 44 return false; |
| 45 } |
| 46 } |
| 47 this[_current] = core.List$(T).new(this[_iterators][dartx.length]); |
| 48 for (let i = 0; i < dart.notNull(this[_iterators][dartx.length]); i++) { |
| 49 this[_current][dartx.set](i, this[_iterators][dartx.get](i).current); |
| 50 } |
| 51 return true; |
| 52 } |
| 53 get current() { |
| 54 return this[_current]; |
| 55 } |
30 } | 56 } |
31 moveNext() { | 57 _IteratorZip[dart.implements] = () => [core.Iterator$(core.List$(T))]; |
32 if (dart.notNull(this[_iterators][dartx.isEmpty])) return false; | 58 dart.setSignature(_IteratorZip, { |
33 for (let i = 0; i < dart.notNull(this[_iterators][dartx.length]); i++) { | 59 constructors: () => ({_IteratorZip: [_IteratorZip$(T), [core.List$(core.It
erator$(T))]]}), |
34 if (!dart.notNull(this[_iterators][dartx.get](i).moveNext())) { | 60 methods: () => ({moveNext: [core.bool, []]}) |
35 this[_current] = null; | 61 }); |
36 return false; | 62 return _IteratorZip; |
37 } | |
38 } | |
39 this[_current] = core.List.new(this[_iterators][dartx.length]); | |
40 for (let i = 0; i < dart.notNull(this[_iterators][dartx.length]); i++) { | |
41 this[_current][dartx.set](i, this[_iterators][dartx.get](i).current); | |
42 } | |
43 return true; | |
44 } | |
45 get current() { | |
46 return this[_current]; | |
47 } | |
48 } | |
49 _IteratorZip[dart.implements] = () => [core.Iterator$(core.List)]; | |
50 dart.setSignature(_IteratorZip, { | |
51 constructors: () => ({_IteratorZip: [_IteratorZip, [core.List]]}), | |
52 methods: () => ({moveNext: [core.bool, []]}) | |
53 }); | 63 }); |
| 64 let _IteratorZip = _IteratorZip$(); |
54 // Exports: | 65 // Exports: |
| 66 exports.IterableZip$ = IterableZip$; |
55 exports.IterableZip = IterableZip; | 67 exports.IterableZip = IterableZip; |
56 }); | 68 }); |
OLD | NEW |