OLD | NEW |
| (Empty) |
1 dart_library.library('collection/src/iterable_zip', null, /* Imports */[ | |
2 'dart/_runtime', | |
3 'dart/core', | |
4 'dart/collection' | |
5 ], /* Lazy imports */[ | |
6 ], function(exports, dart, core, collection) { | |
7 'use strict'; | |
8 let dartx = dart.dartx; | |
9 const _iterables = Symbol('_iterables'); | |
10 const IterableZip$ = dart.generic(function(T) { | |
11 class IterableZip extends collection.IterableBase$(core.List$(T)) { | |
12 IterableZip(iterables) { | |
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 } | |
23 } | |
24 dart.setSignature(IterableZip, { | |
25 constructors: () => ({IterableZip: [IterableZip$(T), [core.Iterable$(core.
Iterable$(T))]]}) | |
26 }); | |
27 dart.defineExtensionMembers(IterableZip, ['iterator']); | |
28 return IterableZip; | |
29 }); | |
30 let IterableZip = IterableZip$(); | |
31 const _iterators = Symbol('_iterators'); | |
32 const _current = Symbol('_current'); | |
33 const _IteratorZip$ = dart.generic(function(T) { | |
34 class _IteratorZip extends core.Object { | |
35 _IteratorZip(iterators) { | |
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 } | |
56 } | |
57 _IteratorZip[dart.implements] = () => [core.Iterator$(core.List$(T))]; | |
58 dart.setSignature(_IteratorZip, { | |
59 constructors: () => ({_IteratorZip: [_IteratorZip$(T), [core.List$(core.It
erator$(T))]]}), | |
60 methods: () => ({moveNext: [core.bool, []]}) | |
61 }); | |
62 return _IteratorZip; | |
63 }); | |
64 let _IteratorZip = _IteratorZip$(); | |
65 // Exports: | |
66 exports.IterableZip$ = IterableZip$; | |
67 exports.IterableZip = IterableZip; | |
68 }); | |
OLD | NEW |