Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 var _internal; | 1 var _internal; |
| 2 (function(exports) { | 2 (function(exports) { |
| 3 'use strict'; | 3 'use strict'; |
| 4 class EfficientLength extends core.Object {} | 4 class EfficientLength extends core.Object {} |
| 5 let ListIterable$ = dart.generic(function(E) { | 5 let ListIterable$ = dart.generic(function(E) { |
| 6 class ListIterable extends collection.IterableBase$(E) { | 6 class ListIterable extends collection.IterableBase$(E) { |
| 7 ListIterable() { | 7 ListIterable() { |
| 8 super.IterableBase(); | 8 super.IterableBase(); |
| 9 } | 9 } |
| 10 get [core.$iterator]() { | 10 get [core.$iterator]() { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 [core.$take](count) { | 193 [core.$take](count) { |
| 194 return new (SubListIterable$(E))(this, 0, count); | 194 return new (SubListIterable$(E))(this, 0, count); |
| 195 } | 195 } |
| 196 [core.$takeWhile](test) { | 196 [core.$takeWhile](test) { |
| 197 return super[core.$takeWhile](test); | 197 return super[core.$takeWhile](test); |
| 198 } | 198 } |
| 199 [core.$toList](opts) { | 199 [core.$toList](opts) { |
| 200 let growable = opts && 'growable' in opts ? opts.growable : true; | 200 let growable = opts && 'growable' in opts ? opts.growable : true; |
| 201 let result = null; | 201 let result = null; |
| 202 if (growable) { | 202 if (growable) { |
| 203 result = ((_) => { | 203 result = new (core.List$(E))(); |
| 204 _[core.$length] = this.length; | 204 result[core.$length] = this.length; |
| 205 return _; | |
| 206 }).bind(this)(new (core.List$(E))()); | |
| 207 } else { | 205 } else { |
| 208 result = new (core.List$(E))(this.length); | 206 result = new (core.List$(E))(this.length); |
| 209 } | 207 } |
| 210 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no tNull(i) + 1) { | 208 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no tNull(i) + 1) { |
| 211 result[core.$set](i, this.elementAt(i)); | 209 result[core.$set](i, this.elementAt(i)); |
| 212 } | 210 } |
| 213 return result; | 211 return result; |
| 214 } | 212 } |
| 215 [core.$toSet]() { | 213 [core.$toSet]() { |
| 216 let result = new (core.Set$(E))(); | 214 let result = new (core.Set$(E))(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 } | 291 } |
| 294 [core.$toList](opts) { | 292 [core.$toList](opts) { |
| 295 let growable = opts && 'growable' in opts ? opts.growable : true; | 293 let growable = opts && 'growable' in opts ? opts.growable : true; |
| 296 let start = this[_start]; | 294 let start = this[_start]; |
| 297 let end = this[_iterable][core.$length]; | 295 let end = this[_iterable][core.$length]; |
| 298 if (this[_endOrLength] != null && dart.notNull(this[_endOrLength]) < dar t.notNull(end)) | 296 if (this[_endOrLength] != null && dart.notNull(this[_endOrLength]) < dar t.notNull(end)) |
| 299 end = this[_endOrLength]; | 297 end = this[_endOrLength]; |
| 300 let length = dart.notNull(end) - dart.notNull(start); | 298 let length = dart.notNull(end) - dart.notNull(start); |
| 301 if (dart.notNull(length) < 0) | 299 if (dart.notNull(length) < 0) |
| 302 length = 0; | 300 length = 0; |
| 303 let result = growable ? ((_) => { | 301 let result = growable ? ((_) => (_ = new (core.List$(E))(), _[core.$leng th] = length, _))() : new (core.List$(E))(length); |
|
Jennifer Messerly
2015/04/07 22:00:28
hmm, we could just emit this into multiple lines a
| |
| 304 _[core.$length] = length; | |
| 305 return _; | |
| 306 })(new (core.List$(E))()) : new (core.List$(E))(length); | |
| 307 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { | 302 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { |
| 308 result[core.$set](i, this[_iterable][core.$elementAt](dart.notNull(sta rt) + dart.notNull(i))); | 303 result[core.$set](i, this[_iterable][core.$elementAt](dart.notNull(sta rt) + dart.notNull(i))); |
| 309 if (dart.notNull(this[_iterable][core.$length]) < dart.notNull(end)) | 304 if (dart.notNull(this[_iterable][core.$length]) < dart.notNull(end)) |
| 310 throw new core.ConcurrentModificationError(this); | 305 throw new core.ConcurrentModificationError(this); |
| 311 } | 306 } |
| 312 return dart.as(result, core.List$(E)); | 307 return dart.as(result, core.List$(E)); |
| 313 } | 308 } |
| 314 } | 309 } |
| 315 return SubListIterable; | 310 return SubListIterable; |
| 316 }); | 311 }); |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1091 if (compare == null) | 1086 if (compare == null) |
| 1092 compare = core.Comparable.compare; | 1087 compare = core.Comparable.compare; |
| 1093 Sort.sort(list, compare); | 1088 Sort.sort(list, compare); |
| 1094 } | 1089 } |
| 1095 static shuffleList(list, random) { | 1090 static shuffleList(list, random) { |
| 1096 if (random == null) | 1091 if (random == null) |
| 1097 random = new math.Random(); | 1092 random = new math.Random(); |
| 1098 let length = list[core.$length]; | 1093 let length = list[core.$length]; |
| 1099 while (dart.notNull(length) > 1) { | 1094 while (dart.notNull(length) > 1) { |
| 1100 let pos = random.nextInt(length); | 1095 let pos = random.nextInt(length); |
| 1101 length = 1; | 1096 length = dart.notNull(length) - 1; |
| 1102 let tmp = list[core.$get](length); | 1097 let tmp = list[core.$get](length); |
| 1103 list[core.$set](length, list[core.$get](pos)); | 1098 list[core.$set](length, list[core.$get](pos)); |
| 1104 list[core.$set](pos, tmp); | 1099 list[core.$set](pos, tmp); |
| 1105 } | 1100 } |
| 1106 } | 1101 } |
| 1107 static indexOfList(list, element, start) { | 1102 static indexOfList(list, element, start) { |
| 1108 return Lists.indexOf(list, element, start, list[core.$length]); | 1103 return Lists.indexOf(list, element, start, list[core.$length]); |
| 1109 } | 1104 } |
| 1110 static lastIndexOfList(list, element, start) { | 1105 static lastIndexOfList(list, element, start) { |
| 1111 if (start == null) | 1106 if (start == null) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1170 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { | 1165 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { |
| 1171 list[core.$set](i, fillValue); | 1166 list[core.$set](i, fillValue); |
| 1172 } | 1167 } |
| 1173 } | 1168 } |
| 1174 static insertAllList(list, index, iterable) { | 1169 static insertAllList(list, index, iterable) { |
| 1175 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde x"); | 1170 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde x"); |
| 1176 if (!dart.is(iterable, EfficientLength)) { | 1171 if (!dart.is(iterable, EfficientLength)) { |
| 1177 iterable = iterable[core.$toList]({growable: false}); | 1172 iterable = iterable[core.$toList]({growable: false}); |
| 1178 } | 1173 } |
| 1179 let insertionLength = iterable[core.$length]; | 1174 let insertionLength = iterable[core.$length]; |
| 1180 list[core.$length] = insertionLength; | 1175 list[core.$length] = dart.notNull(list[core.$length]) + dart.notNull(ins ertionLength); |
| 1181 list[core.$setRange](dart.notNull(index) + dart.notNull(insertionLength) , list[core.$length], list, index); | 1176 list[core.$setRange](dart.notNull(index) + dart.notNull(insertionLength) , list[core.$length], list, index); |
| 1182 for (let element of iterable) { | 1177 for (let element of iterable) { |
| 1183 list[core.$set](((x) => index = dart.notNull(x) + 1, x)(index), elemen t); | 1178 list[core.$set](((x) => (x = index, index = dart.notNull(x) + 1, x))() , element); |
| 1184 } | 1179 } |
| 1185 } | 1180 } |
| 1186 static setAllList(list, index, iterable) { | 1181 static setAllList(list, index, iterable) { |
| 1187 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde x"); | 1182 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde x"); |
| 1188 for (let element of iterable) { | 1183 for (let element of iterable) { |
| 1189 list[core.$set](((x) => index = dart.notNull(x) + 1, x)(index), elemen t); | 1184 list[core.$set](((x) => (x = index, index = dart.notNull(x) + 1, x))() , element); |
| 1190 } | 1185 } |
| 1191 } | 1186 } |
| 1192 asMapList(l) { | 1187 asMapList(l) { |
| 1193 return new (ListMapView$(T))(dart.as(l, core.List$(T))); | 1188 return new (ListMapView$(T))(dart.as(l, core.List$(T))); |
| 1194 } | 1189 } |
| 1195 static setContainsAll(set, other) { | 1190 static setContainsAll(set, other) { |
| 1196 for (let element of other) { | 1191 for (let element of other) { |
| 1197 if (!dart.notNull(set[core.$contains](element))) | 1192 if (!dart.notNull(set[core.$contains](element))) |
| 1198 return false; | 1193 return false; |
| 1199 } | 1194 } |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1678 } | 1673 } |
| 1679 less = dart.notNull(less) + 1; | 1674 less = dart.notNull(less) + 1; |
| 1680 } else { | 1675 } else { |
| 1681 while (true) { | 1676 while (true) { |
| 1682 comp = dart.dinvokef(compare, a[core.$get](great), pivot); | 1677 comp = dart.dinvokef(compare, a[core.$get](great), pivot); |
| 1683 if (dart.notNull(comp) > 0) { | 1678 if (dart.notNull(comp) > 0) { |
| 1684 great = dart.notNull(great) - 1; | 1679 great = dart.notNull(great) - 1; |
| 1685 continue; | 1680 continue; |
| 1686 } else if (dart.notNull(comp) < 0) { | 1681 } else if (dart.notNull(comp) < 0) { |
| 1687 a[core.$set](k, a[core.$get](less)); | 1682 a[core.$set](k, a[core.$get](less)); |
| 1688 a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a[cor e.$get](great)); | 1683 a[core.$set](((x) => (x = less, less = dart.notNull(x) + 1, x))( ), a[core.$get](great)); |
| 1689 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak) ; | 1684 a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1, x) )(), ak); |
| 1690 break; | 1685 break; |
| 1691 } else { | 1686 } else { |
| 1692 a[core.$set](k, a[core.$get](great)); | 1687 a[core.$set](k, a[core.$get](great)); |
| 1693 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak) ; | 1688 a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1, x) )(), ak); |
| 1694 break; | 1689 break; |
| 1695 } | 1690 } |
| 1696 } | 1691 } |
| 1697 } | 1692 } |
| 1698 } | 1693 } |
| 1699 } else { | 1694 } else { |
| 1700 for (let k = less; dart.notNull(k) <= dart.notNull(great); k = dart.notN ull(k) + 1) { | 1695 for (let k = less; dart.notNull(k) <= dart.notNull(great); k = dart.notN ull(k) + 1) { |
| 1701 let ak = a[core.$get](k); | 1696 let ak = a[core.$get](k); |
| 1702 let comp_pivot1 = dart.dinvokef(compare, ak, pivot1); | 1697 let comp_pivot1 = dart.dinvokef(compare, ak, pivot1); |
| 1703 if (dart.notNull(comp_pivot1) < 0) { | 1698 if (dart.notNull(comp_pivot1) < 0) { |
| 1704 if (k != less) { | 1699 if (k != less) { |
| 1705 a[core.$set](k, a[core.$get](less)); | 1700 a[core.$set](k, a[core.$get](less)); |
| 1706 a[core.$set](less, ak); | 1701 a[core.$set](less, ak); |
| 1707 } | 1702 } |
| 1708 less = dart.notNull(less) + 1; | 1703 less = dart.notNull(less) + 1; |
| 1709 } else { | 1704 } else { |
| 1710 let comp_pivot2 = dart.dinvokef(compare, ak, pivot2); | 1705 let comp_pivot2 = dart.dinvokef(compare, ak, pivot2); |
| 1711 if (dart.notNull(comp_pivot2) > 0) { | 1706 if (dart.notNull(comp_pivot2) > 0) { |
| 1712 while (true) { | 1707 while (true) { |
| 1713 let comp = dart.dinvokef(compare, a[core.$get](great), pivot2); | 1708 let comp = dart.dinvokef(compare, a[core.$get](great), pivot2); |
| 1714 if (dart.notNull(comp) > 0) { | 1709 if (dart.notNull(comp) > 0) { |
| 1715 great = dart.notNull(great) - 1; | 1710 great = dart.notNull(great) - 1; |
| 1716 if (dart.notNull(great) < dart.notNull(k)) | 1711 if (dart.notNull(great) < dart.notNull(k)) |
| 1717 break; | 1712 break; |
| 1718 continue; | 1713 continue; |
| 1719 } else { | 1714 } else { |
| 1720 comp = dart.dinvokef(compare, a[core.$get](great), pivot1); | 1715 comp = dart.dinvokef(compare, a[core.$get](great), pivot1); |
| 1721 if (dart.notNull(comp) < 0) { | 1716 if (dart.notNull(comp) < 0) { |
| 1722 a[core.$set](k, a[core.$get](less)); | 1717 a[core.$set](k, a[core.$get](less)); |
| 1723 a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a [core.$get](great)); | 1718 a[core.$set](((x) => (x = less, less = dart.notNull(x) + 1, x))(), a[core.$get](great)); |
| 1724 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak); | 1719 a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1 , x))(), ak); |
| 1725 } else { | 1720 } else { |
| 1726 a[core.$set](k, a[core.$get](great)); | 1721 a[core.$set](k, a[core.$get](great)); |
| 1727 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak); | 1722 a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1 , x))(), ak); |
| 1728 } | 1723 } |
| 1729 break; | 1724 break; |
| 1730 } | 1725 } |
| 1731 } | 1726 } |
| 1732 } | 1727 } |
| 1733 } | 1728 } |
| 1734 } | 1729 } |
| 1735 } | 1730 } |
| 1736 a[core.$set](left, a[core.$get](dart.notNull(less) - 1)); | 1731 a[core.$set](left, a[core.$get](dart.notNull(less) - 1)); |
| 1737 a[core.$set](dart.notNull(less) - 1, pivot1); | 1732 a[core.$set](dart.notNull(less) - 1, pivot1); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1765 let comp = dart.dinvokef(compare, a[core.$get](great), pivot2); | 1760 let comp = dart.dinvokef(compare, a[core.$get](great), pivot2); |
| 1766 if (comp == 0) { | 1761 if (comp == 0) { |
| 1767 great = dart.notNull(great) - 1; | 1762 great = dart.notNull(great) - 1; |
| 1768 if (dart.notNull(great) < dart.notNull(k)) | 1763 if (dart.notNull(great) < dart.notNull(k)) |
| 1769 break; | 1764 break; |
| 1770 continue; | 1765 continue; |
| 1771 } else { | 1766 } else { |
| 1772 comp = dart.dinvokef(compare, a[core.$get](great), pivot1); | 1767 comp = dart.dinvokef(compare, a[core.$get](great), pivot1); |
| 1773 if (dart.notNull(comp) < 0) { | 1768 if (dart.notNull(comp) < 0) { |
| 1774 a[core.$set](k, a[core.$get](less)); | 1769 a[core.$set](k, a[core.$get](less)); |
| 1775 a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a [core.$get](great)); | 1770 a[core.$set](((x) => (x = less, less = dart.notNull(x) + 1, x))(), a[core.$get](great)); |
| 1776 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak); | 1771 a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1 , x))(), ak); |
| 1777 } else { | 1772 } else { |
| 1778 a[core.$set](k, a[core.$get](great)); | 1773 a[core.$set](k, a[core.$get](great)); |
| 1779 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak); | 1774 a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1 , x))(), ak); |
| 1780 } | 1775 } |
| 1781 break; | 1776 break; |
| 1782 } | 1777 } |
| 1783 } | 1778 } |
| 1784 } | 1779 } |
| 1785 } | 1780 } |
| 1786 } | 1781 } |
| 1787 Sort[_doSort](a, less, great, compare); | 1782 Sort[_doSort](a, less, great, compare); |
| 1788 } else { | 1783 } else { |
| 1789 Sort[_doSort](a, less, great, compare); | 1784 Sort[_doSort](a, less, great, compare); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1910 exports.ReversedListIterable = ReversedListIterable; | 1905 exports.ReversedListIterable = ReversedListIterable; |
| 1911 exports.UnmodifiableListError = UnmodifiableListError; | 1906 exports.UnmodifiableListError = UnmodifiableListError; |
| 1912 exports.NonGrowableListError = NonGrowableListError; | 1907 exports.NonGrowableListError = NonGrowableListError; |
| 1913 exports.makeListFixedLength = makeListFixedLength; | 1908 exports.makeListFixedLength = makeListFixedLength; |
| 1914 exports.Lists = Lists; | 1909 exports.Lists = Lists; |
| 1915 exports.printToConsole = printToConsole; | 1910 exports.printToConsole = printToConsole; |
| 1916 exports.Sort = Sort; | 1911 exports.Sort = Sort; |
| 1917 exports.Symbol = Symbol; | 1912 exports.Symbol = Symbol; |
| 1918 exports.POWERS_OF_TEN = POWERS_OF_TEN; | 1913 exports.POWERS_OF_TEN = POWERS_OF_TEN; |
| 1919 })(_internal || (_internal = {})); | 1914 })(_internal || (_internal = {})); |
| OLD | NEW |