Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: lib/runtime/dart/collection.js

Issue 1178523004: fixes #215, removes special case for length (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 dart.library('dart/collection', null, /* Imports */[ 1 dart.library('dart/collection', null, /* Imports */[
2 'dart/core' 2 'dart/core'
3 ], /* Lazy imports */[ 3 ], /* Lazy imports */[
4 'dart/_internal', 4 'dart/_internal',
5 'dart/_js_helper', 5 'dart/_js_helper',
6 'dart/math' 6 'dart/math'
7 ], function(exports, core, _internal, _js_helper, math) { 7 ], function(exports, core, _internal, _js_helper, math) {
8 'use strict'; 8 'use strict';
9 let _source = Symbol('_source'); 9 let _source = Symbol('_source');
10 let UnmodifiableListView$ = dart.generic(function(E) { 10 let UnmodifiableListView$ = dart.generic(function(E) {
11 class UnmodifiableListView extends _internal.UnmodifiableListBase$(E) { 11 class UnmodifiableListView extends _internal.UnmodifiableListBase$(E) {
12 UnmodifiableListView(source) { 12 UnmodifiableListView(source) {
13 this[_source] = source; 13 this[_source] = source;
14 } 14 }
15 get length() { 15 get length() {
16 return this[_source].length; 16 return this[_source][dartx.length];
17 } 17 }
18 get(index) { 18 get(index) {
19 return this[_source][dartx.elementAt](index); 19 return this[_source][dartx.elementAt](index);
20 } 20 }
21 } 21 }
22 dart.setSignature(UnmodifiableListView, { 22 dart.setSignature(UnmodifiableListView, {
23 constructors: () => ({UnmodifiableListView: [exports.UnmodifiableListView$ (E), [core.Iterable$(E)]]}), 23 constructors: () => ({UnmodifiableListView: [exports.UnmodifiableListView$ (E), [core.Iterable$(E)]]}),
24 methods: () => ({get: [E, [core.int]]}) 24 methods: () => ({get: [E, [core.int]]})
25 }); 25 });
26 dart.defineExtensionMembers(UnmodifiableListView, ['get', 'length']); 26 dart.defineExtensionMembers(UnmodifiableListView, ['get', 'length']);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 for (let element of this) { 185 for (let element of this) {
186 if (dart.notNull(other.contains(element))) 186 if (dart.notNull(other.contains(element)))
187 result.remove(element); 187 result.remove(element);
188 } 188 }
189 return result; 189 return result;
190 } 190 }
191 toList(opts) { 191 toList(opts) {
192 let growable = opts && 'growable' in opts ? opts.growable : true; 192 let growable = opts && 'growable' in opts ? opts.growable : true;
193 let result = dart.notNull(growable) ? (() => { 193 let result = dart.notNull(growable) ? (() => {
194 let _ = core.List$(E).new(); 194 let _ = core.List$(E).new();
195 _.length = this.length; 195 _[dartx.length] = this.length;
196 return _; 196 return _;
197 })() : core.List$(E).new(this.length); 197 })() : core.List$(E).new(this.length);
198 let i = 0; 198 let i = 0;
199 for (let element of this) 199 for (let element of this)
200 result[dartx.set]((() => { 200 result[dartx.set]((() => {
201 let x = i; 201 let x = i;
202 i = dart.notNull(x) + 1; 202 i = dart.notNull(x) + 1;
203 return x; 203 return x;
204 })(), element); 204 })(), element);
205 return result; 205 return result;
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 try { 1059 try {
1060 buffer.writeAll(iterable, ", "); 1060 buffer.writeAll(iterable, ", ");
1061 } finally { 1061 } finally {
1062 dart.assert(core.identical(IterableBase$()._toStringVisiting[dartx.las t], iterable)); 1062 dart.assert(core.identical(IterableBase$()._toStringVisiting[dartx.las t], iterable));
1063 IterableBase$()._toStringVisiting[dartx.removeLast](); 1063 IterableBase$()._toStringVisiting[dartx.removeLast]();
1064 } 1064 }
1065 buffer.write(rightDelimiter); 1065 buffer.write(rightDelimiter);
1066 return dart.toString(buffer); 1066 return dart.toString(buffer);
1067 } 1067 }
1068 static _isToStringVisiting(o) { 1068 static _isToStringVisiting(o) {
1069 for (let i = 0; dart.notNull(i) < dart.notNull(IterableBase$()._toString Visiting.length); i = dart.notNull(i) + 1) { 1069 for (let i = 0; dart.notNull(i) < dart.notNull(IterableBase$()._toString Visiting[dartx.length]); i = dart.notNull(i) + 1) {
1070 if (dart.notNull(core.identical(o, IterableBase$()._toStringVisiting[d artx.get](i)))) 1070 if (dart.notNull(core.identical(o, IterableBase$()._toStringVisiting[d artx.get](i))))
1071 return true; 1071 return true;
1072 } 1072 }
1073 return false; 1073 return false;
1074 } 1074 }
1075 static _iterablePartsToStrings(iterable, parts) { 1075 static _iterablePartsToStrings(iterable, parts) {
1076 let LENGTH_LIMIT = 80; 1076 let LENGTH_LIMIT = 80;
1077 let HEAD_COUNT = 3; 1077 let HEAD_COUNT = 3;
1078 let TAIL_COUNT = 2; 1078 let TAIL_COUNT = 2;
1079 let MAX_COUNT = 100; 1079 let MAX_COUNT = 100;
1080 let OVERHEAD = 2; 1080 let OVERHEAD = 2;
1081 let ELLIPSIS_SIZE = 3; 1081 let ELLIPSIS_SIZE = 3;
1082 let length = 0; 1082 let length = 0;
1083 let count = 0; 1083 let count = 0;
1084 let it = iterable[dartx.iterator]; 1084 let it = iterable[dartx.iterator];
1085 while (dart.notNull(length) < dart.notNull(LENGTH_LIMIT) || dart.notNull (count) < dart.notNull(HEAD_COUNT)) { 1085 while (dart.notNull(length) < dart.notNull(LENGTH_LIMIT) || dart.notNull (count) < dart.notNull(HEAD_COUNT)) {
1086 if (!dart.notNull(it.moveNext())) 1086 if (!dart.notNull(it.moveNext()))
1087 return; 1087 return;
1088 let next = `${it.current}`; 1088 let next = `${it.current}`;
1089 parts[dartx.add](next); 1089 parts[dartx.add](next);
1090 length = dart.notNull(length) + (dart.notNull(next.length) + dart.notN ull(OVERHEAD)); 1090 length = dart.notNull(length) + (dart.notNull(next[dartx.length]) + da rt.notNull(OVERHEAD));
1091 count = dart.notNull(count) + 1; 1091 count = dart.notNull(count) + 1;
1092 } 1092 }
1093 let penultimateString = null; 1093 let penultimateString = null;
1094 let ultimateString = null; 1094 let ultimateString = null;
1095 let penultimate = null; 1095 let penultimate = null;
1096 let ultimate = null; 1096 let ultimate = null;
1097 if (!dart.notNull(it.moveNext())) { 1097 if (!dart.notNull(it.moveNext())) {
1098 if (dart.notNull(count) <= dart.notNull(HEAD_COUNT) + dart.notNull(TAI L_COUNT)) 1098 if (dart.notNull(count) <= dart.notNull(HEAD_COUNT) + dart.notNull(TAI L_COUNT))
1099 return; 1099 return;
1100 ultimateString = dart.as(parts[dartx.removeLast](), core.String); 1100 ultimateString = dart.as(parts[dartx.removeLast](), core.String);
1101 penultimateString = dart.as(parts[dartx.removeLast](), core.String); 1101 penultimateString = dart.as(parts[dartx.removeLast](), core.String);
1102 } else { 1102 } else {
1103 penultimate = it.current; 1103 penultimate = it.current;
1104 count = dart.notNull(count) + 1; 1104 count = dart.notNull(count) + 1;
1105 if (!dart.notNull(it.moveNext())) { 1105 if (!dart.notNull(it.moveNext())) {
1106 if (dart.notNull(count) <= dart.notNull(HEAD_COUNT) + 1) { 1106 if (dart.notNull(count) <= dart.notNull(HEAD_COUNT) + 1) {
1107 parts[dartx.add](`${penultimate}`); 1107 parts[dartx.add](`${penultimate}`);
1108 return; 1108 return;
1109 } 1109 }
1110 ultimateString = `${penultimate}`; 1110 ultimateString = `${penultimate}`;
1111 penultimateString = dart.as(parts[dartx.removeLast](), core.String); 1111 penultimateString = dart.as(parts[dartx.removeLast](), core.String);
1112 length = dart.notNull(length) + (dart.notNull(ultimateString.length) + dart.notNull(OVERHEAD)); 1112 length = dart.notNull(length) + (dart.notNull(ultimateString[dartx.l ength]) + dart.notNull(OVERHEAD));
1113 } else { 1113 } else {
1114 ultimate = it.current; 1114 ultimate = it.current;
1115 count = dart.notNull(count) + 1; 1115 count = dart.notNull(count) + 1;
1116 dart.assert(dart.notNull(count) < dart.notNull(MAX_COUNT)); 1116 dart.assert(dart.notNull(count) < dart.notNull(MAX_COUNT));
1117 while (dart.notNull(it.moveNext())) { 1117 while (dart.notNull(it.moveNext())) {
1118 penultimate = ultimate; 1118 penultimate = ultimate;
1119 ultimate = it.current; 1119 ultimate = it.current;
1120 count = dart.notNull(count) + 1; 1120 count = dart.notNull(count) + 1;
1121 if (dart.notNull(count) > dart.notNull(MAX_COUNT)) { 1121 if (dart.notNull(count) > dart.notNull(MAX_COUNT)) {
1122 while (dart.notNull(length) > dart.notNull(LENGTH_LIMIT) - dart. notNull(ELLIPSIS_SIZE) - dart.notNull(OVERHEAD) && dart.notNull(count) > dart.no tNull(HEAD_COUNT)) { 1122 while (dart.notNull(length) > dart.notNull(LENGTH_LIMIT) - dart. notNull(ELLIPSIS_SIZE) - dart.notNull(OVERHEAD) && dart.notNull(count) > dart.no tNull(HEAD_COUNT)) {
1123 length = dart.notNull(length) - dart.notNull(dart.as(dart.dsen d(dart.dload(parts[dartx.removeLast](), 'length'), '+', OVERHEAD), core.int)); 1123 length = dart.notNull(length) - dart.notNull(dart.as(dart.dsen d(dart.dload(parts[dartx.removeLast](), 'length'), '+', OVERHEAD), core.int));
1124 count = dart.notNull(count) - 1; 1124 count = dart.notNull(count) - 1;
1125 } 1125 }
1126 parts[dartx.add]("..."); 1126 parts[dartx.add]("...");
1127 return; 1127 return;
1128 } 1128 }
1129 } 1129 }
1130 penultimateString = `${penultimate}`; 1130 penultimateString = `${penultimate}`;
1131 ultimateString = `${ultimate}`; 1131 ultimateString = `${ultimate}`;
1132 length = dart.notNull(length) + (dart.notNull(ultimateString.length) + dart.notNull(penultimateString.length) + 2 * dart.notNull(OVERHEAD)); 1132 length = dart.notNull(length) + (dart.notNull(ultimateString[dartx.l ength]) + dart.notNull(penultimateString[dartx.length]) + 2 * dart.notNull(OVERH EAD));
1133 } 1133 }
1134 } 1134 }
1135 let elision = null; 1135 let elision = null;
1136 if (dart.notNull(count) > dart.notNull(parts.length) + dart.notNull(TAIL _COUNT)) { 1136 if (dart.notNull(count) > dart.notNull(parts[dartx.length]) + dart.notNu ll(TAIL_COUNT)) {
1137 elision = "..."; 1137 elision = "...";
1138 length = dart.notNull(length) + (dart.notNull(ELLIPSIS_SIZE) + dart.no tNull(OVERHEAD)); 1138 length = dart.notNull(length) + (dart.notNull(ELLIPSIS_SIZE) + dart.no tNull(OVERHEAD));
1139 } 1139 }
1140 while (dart.notNull(length) > dart.notNull(LENGTH_LIMIT) && dart.notNull (parts.length) > dart.notNull(HEAD_COUNT)) { 1140 while (dart.notNull(length) > dart.notNull(LENGTH_LIMIT) && dart.notNull (parts[dartx.length]) > dart.notNull(HEAD_COUNT)) {
1141 length = dart.notNull(length) - dart.notNull(dart.as(dart.dsend(dart.d load(parts[dartx.removeLast](), 'length'), '+', OVERHEAD), core.int)); 1141 length = dart.notNull(length) - dart.notNull(dart.as(dart.dsend(dart.d load(parts[dartx.removeLast](), 'length'), '+', OVERHEAD), core.int));
1142 if (elision == null) { 1142 if (elision == null) {
1143 elision = "..."; 1143 elision = "...";
1144 length = dart.notNull(length) + (dart.notNull(ELLIPSIS_SIZE) + dart. notNull(OVERHEAD)); 1144 length = dart.notNull(length) + (dart.notNull(ELLIPSIS_SIZE) + dart. notNull(OVERHEAD));
1145 } 1145 }
1146 } 1146 }
1147 if (elision != null) { 1147 if (elision != null) {
1148 parts[dartx.add](elision); 1148 parts[dartx.add](elision);
1149 } 1149 }
1150 parts[dartx.add](penultimateString); 1150 parts[dartx.add](penultimateString);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 dart.as(action, dart.functionType(dart.void, [E])); 1632 dart.as(action, dart.functionType(dart.void, [E]));
1633 let length = this.length; 1633 let length = this.length;
1634 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 1634 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
1635 action(this.get(i)); 1635 action(this.get(i));
1636 if (length != this.length) { 1636 if (length != this.length) {
1637 throw new core.ConcurrentModificationError(this); 1637 throw new core.ConcurrentModificationError(this);
1638 } 1638 }
1639 } 1639 }
1640 } 1640 }
1641 get isEmpty() { 1641 get isEmpty() {
1642 return this.length == 0; 1642 return this[dartx.length] == 0;
1643 } 1643 }
1644 get isNotEmpty() { 1644 get isNotEmpty() {
1645 return !dart.notNull(this.isEmpty); 1645 return !dart.notNull(this.isEmpty);
1646 } 1646 }
1647 get first() { 1647 get first() {
1648 if (this.length == 0) 1648 if (this[dartx.length] == 0)
1649 throw _internal.IterableElementError.noElement(); 1649 throw _internal.IterableElementError.noElement();
1650 return this.get(0); 1650 return this.get(0);
1651 } 1651 }
1652 get last() { 1652 get last() {
1653 if (this.length == 0) 1653 if (this[dartx.length] == 0)
1654 throw _internal.IterableElementError.noElement(); 1654 throw _internal.IterableElementError.noElement();
1655 return this.get(dart.notNull(this.length) - 1); 1655 return this.get(dart.notNull(this[dartx.length]) - 1);
1656 } 1656 }
1657 get single() { 1657 get single() {
1658 if (this.length == 0) 1658 if (this[dartx.length] == 0)
1659 throw _internal.IterableElementError.noElement(); 1659 throw _internal.IterableElementError.noElement();
1660 if (dart.notNull(this.length) > 1) 1660 if (dart.notNull(this[dartx.length]) > 1)
1661 throw _internal.IterableElementError.tooMany(); 1661 throw _internal.IterableElementError.tooMany();
1662 return this.get(0); 1662 return this.get(0);
1663 } 1663 }
1664 contains(element) { 1664 contains(element) {
1665 let length = this.length; 1665 let length = this.length;
1666 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no tNull(i) + 1) { 1666 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no tNull(i) + 1) {
1667 if (dart.equals(this.get(i), element)) 1667 if (dart.equals(this.get(i), element))
1668 return true; 1668 return true;
1669 if (length != this.length) { 1669 if (length != this.length) {
1670 throw new core.ConcurrentModificationError(this); 1670 throw new core.ConcurrentModificationError(this);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 throw new core.ConcurrentModificationError(this); 1748 throw new core.ConcurrentModificationError(this);
1749 } 1749 }
1750 } 1750 }
1751 if (dart.notNull(matchFound)) 1751 if (dart.notNull(matchFound))
1752 return match; 1752 return match;
1753 throw _internal.IterableElementError.noElement(); 1753 throw _internal.IterableElementError.noElement();
1754 } 1754 }
1755 join(separator) { 1755 join(separator) {
1756 if (separator === void 0) 1756 if (separator === void 0)
1757 separator = ""; 1757 separator = "";
1758 if (this.length == 0) 1758 if (this[dartx.length] == 0)
1759 return ""; 1759 return "";
1760 let buffer = new core.StringBuffer(); 1760 let buffer = new core.StringBuffer();
1761 buffer.writeAll(this, separator); 1761 buffer.writeAll(this, separator);
1762 return dart.toString(buffer); 1762 return dart.toString(buffer);
1763 } 1763 }
1764 where(test) { 1764 where(test) {
1765 dart.as(test, dart.functionType(core.bool, [E])); 1765 dart.as(test, dart.functionType(core.bool, [E]));
1766 return new (_internal.WhereIterable$(E))(this, test); 1766 return new (_internal.WhereIterable$(E))(this, test);
1767 } 1767 }
1768 map(f) { 1768 map(f) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 } 1811 }
1812 takeWhile(test) { 1812 takeWhile(test) {
1813 dart.as(test, dart.functionType(core.bool, [E])); 1813 dart.as(test, dart.functionType(core.bool, [E]));
1814 return new (_internal.TakeWhileIterable$(E))(this, test); 1814 return new (_internal.TakeWhileIterable$(E))(this, test);
1815 } 1815 }
1816 toList(opts) { 1816 toList(opts) {
1817 let growable = opts && 'growable' in opts ? opts.growable : true; 1817 let growable = opts && 'growable' in opts ? opts.growable : true;
1818 let result = null; 1818 let result = null;
1819 if (dart.notNull(growable)) { 1819 if (dart.notNull(growable)) {
1820 result = core.List$(E).new(); 1820 result = core.List$(E).new();
1821 result.length = this.length; 1821 result[dartx.length] = this[dartx.length];
1822 } else { 1822 } else {
1823 result = core.List$(E).new(this.length); 1823 result = core.List$(E).new(this[dartx.length]);
1824 } 1824 }
1825 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no tNull(i) + 1) { 1825 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) {
1826 result[dartx.set](i, this.get(i)); 1826 result[dartx.set](i, this.get(i));
1827 } 1827 }
1828 return result; 1828 return result;
1829 } 1829 }
1830 toSet() { 1830 toSet() {
1831 let result = core.Set$(E).new(); 1831 let result = core.Set$(E).new();
1832 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); i = dart.no tNull(i) + 1) { 1832 for (let i = 0; dart.notNull(i) < dart.notNull(this[dartx.length]); i = dart.notNull(i) + 1) {
1833 result.add(this.get(i)); 1833 result.add(this.get(i));
1834 } 1834 }
1835 return result; 1835 return result;
1836 } 1836 }
1837 add(element) { 1837 add(element) {
1838 dart.as(element, E); 1838 dart.as(element, E);
1839 this.set((() => { 1839 this.set((() => {
1840 let x = this.length; 1840 let x = this.length;
1841 this.length = dart.notNull(x) + 1; 1841 this.length = dart.notNull(x) + 1;
1842 return x; 1842 return x;
(...skipping 23 matching lines...) Expand all
1866 dart.as(test, dart.functionType(core.bool, [E])); 1866 dart.as(test, dart.functionType(core.bool, [E]));
1867 ListMixin$()._filter(this, test, false); 1867 ListMixin$()._filter(this, test, false);
1868 } 1868 }
1869 retainWhere(test) { 1869 retainWhere(test) {
1870 dart.as(test, dart.functionType(core.bool, [E])); 1870 dart.as(test, dart.functionType(core.bool, [E]));
1871 ListMixin$()._filter(this, test, true); 1871 ListMixin$()._filter(this, test, true);
1872 } 1872 }
1873 static _filter(source, test, retainMatching) { 1873 static _filter(source, test, retainMatching) {
1874 dart.as(test, dart.functionType(core.bool, [dart.bottom])); 1874 dart.as(test, dart.functionType(core.bool, [dart.bottom]));
1875 let retained = []; 1875 let retained = [];
1876 let length = source.length; 1876 let length = source[dartx.length];
1877 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 1877 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
1878 let element = source[dartx.get](i); 1878 let element = source[dartx.get](i);
1879 if (dart.dcall(test, element) == retainMatching) { 1879 if (dart.dcall(test, element) == retainMatching) {
1880 retained[dartx.add](element); 1880 retained[dartx.add](element);
1881 } 1881 }
1882 if (length != source.length) { 1882 if (length != source[dartx.length]) {
1883 throw new core.ConcurrentModificationError(source); 1883 throw new core.ConcurrentModificationError(source);
1884 } 1884 }
1885 } 1885 }
1886 if (retained.length != source.length) { 1886 if (retained[dartx.length] != source[dartx.length]) {
1887 source[dartx.setRange](0, retained.length, retained); 1887 source[dartx.setRange](0, retained[dartx.length], retained);
1888 source.length = retained.length; 1888 source[dartx.length] = retained[dartx.length];
1889 } 1889 }
1890 } 1890 }
1891 clear() { 1891 clear() {
1892 this.length = 0; 1892 this.length = 0;
1893 } 1893 }
1894 removeLast() { 1894 removeLast() {
1895 if (this.length == 0) { 1895 if (this[dartx.length] == 0) {
1896 throw _internal.IterableElementError.noElement(); 1896 throw _internal.IterableElementError.noElement();
1897 } 1897 }
1898 let result = this.get(dart.notNull(this.length) - 1); 1898 let result = this.get(dart.notNull(this[dartx.length]) - 1);
1899 this.length = dart.notNull(this.length) - 1; 1899 this[dartx.length] = dart.notNull(this[dartx.length]) - 1;
1900 return result; 1900 return result;
1901 } 1901 }
1902 sort(compare) { 1902 sort(compare) {
1903 if (compare === void 0) 1903 if (compare === void 0)
1904 compare = null; 1904 compare = null;
1905 dart.as(compare, dart.functionType(core.int, [E, E])); 1905 dart.as(compare, dart.functionType(core.int, [E, E]));
1906 _internal.Sort.sort(this, compare == null ? core.Comparable.compare : co mpare); 1906 _internal.Sort.sort(this, compare == null ? core.Comparable.compare : co mpare);
1907 } 1907 }
1908 shuffle(random) { 1908 shuffle(random) {
1909 if (random === void 0) 1909 if (random === void 0)
(...skipping 14 matching lines...) Expand all
1924 } 1924 }
1925 sublist(start, end) { 1925 sublist(start, end) {
1926 if (end === void 0) 1926 if (end === void 0)
1927 end = null; 1927 end = null;
1928 let listLength = this.length; 1928 let listLength = this.length;
1929 if (end == null) 1929 if (end == null)
1930 end = listLength; 1930 end = listLength;
1931 core.RangeError.checkValidRange(start, end, listLength); 1931 core.RangeError.checkValidRange(start, end, listLength);
1932 let length = dart.notNull(end) - dart.notNull(start); 1932 let length = dart.notNull(end) - dart.notNull(start);
1933 let result = core.List$(E).new(); 1933 let result = core.List$(E).new();
1934 result.length = length; 1934 result[dartx.length] = length;
1935 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 1935 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
1936 result[dartx.set](i, this.get(dart.notNull(start) + dart.notNull(i))); 1936 result[dartx.set](i, this.get(dart.notNull(start) + dart.notNull(i)));
1937 } 1937 }
1938 return result; 1938 return result;
1939 } 1939 }
1940 getRange(start, end) { 1940 getRange(start, end) {
1941 core.RangeError.checkValidRange(start, end, this.length); 1941 core.RangeError.checkValidRange(start, end, this.length);
1942 return new (_internal.SubListIterable$(E))(this, start, end); 1942 return new (_internal.SubListIterable$(E))(this, start, end);
1943 } 1943 }
1944 removeRange(start, end) { 1944 removeRange(start, end) {
(...skipping 22 matching lines...) Expand all
1967 core.RangeError.checkNotNegative(skipCount, "skipCount"); 1967 core.RangeError.checkNotNegative(skipCount, "skipCount");
1968 let otherList = null; 1968 let otherList = null;
1969 let otherStart = null; 1969 let otherStart = null;
1970 if (dart.is(iterable, core.List)) { 1970 if (dart.is(iterable, core.List)) {
1971 otherList = dart.as(iterable, core.List); 1971 otherList = dart.as(iterable, core.List);
1972 otherStart = skipCount; 1972 otherStart = skipCount;
1973 } else { 1973 } else {
1974 otherList = iterable[dartx.skip](skipCount)[dartx.toList]({growable: f alse}); 1974 otherList = iterable[dartx.skip](skipCount)[dartx.toList]({growable: f alse});
1975 otherStart = 0; 1975 otherStart = 0;
1976 } 1976 }
1977 if (dart.notNull(otherStart) + dart.notNull(length) > dart.notNull(other List.length)) { 1977 if (dart.notNull(otherStart) + dart.notNull(length) > dart.notNull(other List[dartx.length])) {
1978 throw _internal.IterableElementError.tooFew(); 1978 throw _internal.IterableElementError.tooFew();
1979 } 1979 }
1980 if (dart.notNull(otherStart) < dart.notNull(start)) { 1980 if (dart.notNull(otherStart) < dart.notNull(start)) {
1981 for (let i = dart.notNull(length) - 1; dart.notNull(i) >= 0; i = dart. notNull(i) - 1) { 1981 for (let i = dart.notNull(length) - 1; dart.notNull(i) >= 0; i = dart. notNull(i) - 1) {
1982 this.set(dart.notNull(start) + dart.notNull(i), dart.as(otherList[da rtx.get](dart.notNull(otherStart) + dart.notNull(i)), E)); 1982 this.set(dart.notNull(start) + dart.notNull(i), dart.as(otherList[da rtx.get](dart.notNull(otherStart) + dart.notNull(i)), E));
1983 } 1983 }
1984 } else { 1984 } else {
1985 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNu ll(i) + 1) { 1985 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNu ll(i) + 1) {
1986 this.set(dart.notNull(start) + dart.notNull(i), dart.as(otherList[da rtx.get](dart.notNull(otherStart) + dart.notNull(i)), E)); 1986 this.set(dart.notNull(start) + dart.notNull(i), dart.as(otherList[da rtx.get](dart.notNull(otherStart) + dart.notNull(i)), E));
1987 } 1987 }
1988 } 1988 }
1989 } 1989 }
1990 replaceRange(start, end, newContents) { 1990 replaceRange(start, end, newContents) {
1991 dart.as(newContents, core.Iterable$(E)); 1991 dart.as(newContents, core.Iterable$(E));
1992 core.RangeError.checkValidRange(start, end, this.length); 1992 core.RangeError.checkValidRange(start, end, this.length);
1993 if (!dart.is(newContents, _internal.EfficientLength)) { 1993 if (!dart.is(newContents, _internal.EfficientLength)) {
1994 newContents = newContents[dartx.toList](); 1994 newContents = newContents[dartx.toList]();
1995 } 1995 }
1996 let removeLength = dart.notNull(end) - dart.notNull(start); 1996 let removeLength = dart.notNull(end) - dart.notNull(start);
1997 let insertLength = newContents.length; 1997 let insertLength = newContents[dartx.length];
1998 if (dart.notNull(removeLength) >= dart.notNull(insertLength)) { 1998 if (dart.notNull(removeLength) >= dart.notNull(insertLength)) {
1999 let delta = dart.notNull(removeLength) - dart.notNull(insertLength); 1999 let delta = dart.notNull(removeLength) - dart.notNull(insertLength);
2000 let insertEnd = dart.notNull(start) + dart.notNull(insertLength); 2000 let insertEnd = dart.notNull(start) + dart.notNull(insertLength);
2001 let newLength = dart.notNull(this.length) - dart.notNull(delta); 2001 let newLength = dart.notNull(this.length) - dart.notNull(delta);
2002 this.setRange(start, insertEnd, newContents); 2002 this.setRange(start, insertEnd, newContents);
2003 if (delta != 0) { 2003 if (delta != 0) {
2004 this.setRange(insertEnd, newLength, this, end); 2004 this.setRange(insertEnd, newLength, this, end);
2005 this.length = newLength; 2005 this.length = newLength;
2006 } 2006 }
2007 } else { 2007 } else {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 } 2044 }
2045 for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { 2045 for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
2046 if (dart.equals(this.get(i), element)) { 2046 if (dart.equals(this.get(i), element)) {
2047 return i; 2047 return i;
2048 } 2048 }
2049 } 2049 }
2050 return -1; 2050 return -1;
2051 } 2051 }
2052 insert(index, element) { 2052 insert(index, element) {
2053 dart.as(element, E); 2053 dart.as(element, E);
2054 core.RangeError.checkValueInInterval(index, 0, this.length, "index"); 2054 core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "inde x");
2055 if (index == this.length) { 2055 if (index == this.length) {
2056 this.add(element); 2056 this.add(element);
2057 return; 2057 return;
2058 } 2058 }
2059 if (!(typeof index == 'number')) 2059 if (!(typeof index == 'number'))
2060 throw new core.ArgumentError(index); 2060 throw new core.ArgumentError(index);
2061 this.length = dart.notNull(this.length) + 1; 2061 this.length = dart.notNull(this.length) + 1;
2062 this.setRange(dart.notNull(index) + 1, this.length, this, index); 2062 this.setRange(dart.notNull(index) + 1, this.length, this, index);
2063 this.set(index, element); 2063 this.set(index, element);
2064 } 2064 }
2065 removeAt(index) { 2065 removeAt(index) {
2066 let result = this.get(index); 2066 let result = this.get(index);
2067 this.setRange(index, dart.notNull(this.length) - 1, this, dart.notNull(i ndex) + 1); 2067 this.setRange(index, dart.notNull(this.length) - 1, this, dart.notNull(i ndex) + 1);
2068 this.length = dart.notNull(this.length) - 1; 2068 this[dartx.length] = dart.notNull(this[dartx.length]) - 1;
2069 return result; 2069 return result;
2070 } 2070 }
2071 insertAll(index, iterable) { 2071 insertAll(index, iterable) {
2072 dart.as(iterable, core.Iterable$(E)); 2072 dart.as(iterable, core.Iterable$(E));
2073 core.RangeError.checkValueInInterval(index, 0, this.length, "index"); 2073 core.RangeError.checkValueInInterval(index, 0, this[dartx.length], "inde x");
2074 if (dart.is(iterable, _internal.EfficientLength)) { 2074 if (dart.is(iterable, _internal.EfficientLength)) {
2075 iterable = iterable[dartx.toList](); 2075 iterable = iterable[dartx.toList]();
2076 } 2076 }
2077 let insertionLength = iterable.length; 2077 let insertionLength = iterable[dartx.length];
2078 this.length = dart.notNull(this.length) + dart.notNull(insertionLength); 2078 this.length = dart.notNull(this.length) + dart.notNull(insertionLength);
2079 this.setRange(dart.notNull(index) + dart.notNull(insertionLength), this. length, this, index); 2079 this.setRange(dart.notNull(index) + dart.notNull(insertionLength), this. length, this, index);
2080 this.setAll(index, iterable); 2080 this.setAll(index, iterable);
2081 } 2081 }
2082 setAll(index, iterable) { 2082 setAll(index, iterable) {
2083 dart.as(iterable, core.Iterable$(E)); 2083 dart.as(iterable, core.Iterable$(E));
2084 if (dart.is(iterable, core.List)) { 2084 if (dart.is(iterable, core.List)) {
2085 this.setRange(index, dart.notNull(index) + dart.notNull(iterable.lengt h), iterable); 2085 this.setRange(index, dart.notNull(index) + dart.notNull(iterable[dartx .length]), iterable);
2086 } else { 2086 } else {
2087 for (let element of iterable) { 2087 for (let element of iterable) {
2088 this.set((() => { 2088 this.set((() => {
2089 let x = index; 2089 let x = index;
2090 index = dart.notNull(x) + 1; 2090 index = dart.notNull(x) + 1;
2091 return x; 2091 return x;
2092 })(), element); 2092 })(), element);
2093 } 2093 }
2094 } 2094 }
2095 } 2095 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 dart.as(ifAbsent, dart.functionType(V, [])); 2242 dart.as(ifAbsent, dart.functionType(V, []));
2243 if (dart.notNull(this.keys[dartx.contains](key))) { 2243 if (dart.notNull(this.keys[dartx.contains](key))) {
2244 return this.get(key); 2244 return this.get(key);
2245 } 2245 }
2246 return this.set(key, ifAbsent()); 2246 return this.set(key, ifAbsent());
2247 } 2247 }
2248 containsKey(key) { 2248 containsKey(key) {
2249 return this.keys[dartx.contains](key); 2249 return this.keys[dartx.contains](key);
2250 } 2250 }
2251 get length() { 2251 get length() {
2252 return this.keys.length; 2252 return this.keys[dartx.length];
2253 } 2253 }
2254 get isEmpty() { 2254 get isEmpty() {
2255 return this.keys[dartx.isEmpty]; 2255 return this.keys[dartx.isEmpty];
2256 } 2256 }
2257 get isNotEmpty() { 2257 get isNotEmpty() {
2258 return this.keys[dartx.isNotEmpty]; 2258 return this.keys[dartx.isNotEmpty];
2259 } 2259 }
2260 get values() { 2260 get values() {
2261 return new (_MapBaseValueIterable$(V))(this); 2261 return new (_MapBaseValueIterable$(V))(this);
2262 } 2262 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 } 2508 }
2509 static forEach(map, f) { 2509 static forEach(map, f) {
2510 for (let k of map.keys) { 2510 for (let k of map.keys) {
2511 dart.dcall(f, k, map.get(k)); 2511 dart.dcall(f, k, map.get(k));
2512 } 2512 }
2513 } 2513 }
2514 static getValues(map) { 2514 static getValues(map) {
2515 return map.keys[dartx.map](dart.fn(key => map.get(key))); 2515 return map.keys[dartx.map](dart.fn(key => map.get(key)));
2516 } 2516 }
2517 static length(map) { 2517 static length(map) {
2518 return map.keys.length; 2518 return map.keys[dartx.length];
2519 } 2519 }
2520 static isEmpty(map) { 2520 static isEmpty(map) {
2521 return map.keys[dartx.isEmpty]; 2521 return map.keys[dartx.isEmpty];
2522 } 2522 }
2523 static isNotEmpty(map) { 2523 static isNotEmpty(map) {
2524 return map.keys[dartx.isNotEmpty]; 2524 return map.keys[dartx.isNotEmpty];
2525 } 2525 }
2526 static mapToString(m) { 2526 static mapToString(m) {
2527 if (dart.notNull(IterableBase._isToStringVisiting(m))) { 2527 if (dart.notNull(IterableBase._isToStringVisiting(m))) {
2528 return '{...}'; 2528 return '{...}';
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 if (initialCapacity == null || dart.notNull(initialCapacity) < dart.notN ull(ListQueue$()._INITIAL_CAPACITY)) { 2924 if (initialCapacity == null || dart.notNull(initialCapacity) < dart.notN ull(ListQueue$()._INITIAL_CAPACITY)) {
2925 initialCapacity = ListQueue$()._INITIAL_CAPACITY; 2925 initialCapacity = ListQueue$()._INITIAL_CAPACITY;
2926 } else if (!dart.notNull(ListQueue$()._isPowerOf2(initialCapacity))) { 2926 } else if (!dart.notNull(ListQueue$()._isPowerOf2(initialCapacity))) {
2927 initialCapacity = ListQueue$()._nextPowerOf2(initialCapacity); 2927 initialCapacity = ListQueue$()._nextPowerOf2(initialCapacity);
2928 } 2928 }
2929 dart.assert(ListQueue$()._isPowerOf2(initialCapacity)); 2929 dart.assert(ListQueue$()._isPowerOf2(initialCapacity));
2930 this[_table] = core.List$(E).new(initialCapacity); 2930 this[_table] = core.List$(E).new(initialCapacity);
2931 } 2931 }
2932 static from(elements) { 2932 static from(elements) {
2933 if (dart.is(elements, core.List)) { 2933 if (dart.is(elements, core.List)) {
2934 let length = elements.length; 2934 let length = elements[dartx.length];
2935 let queue = new (ListQueue$(E))(dart.notNull(length) + 1); 2935 let queue = new (ListQueue$(E))(dart.notNull(length) + 1);
2936 dart.assert(dart.notNull(queue[_table].length) > dart.notNull(length)) ; 2936 dart.assert(dart.notNull(queue[_table][dartx.length]) > dart.notNull(l ength));
2937 let sourceList = elements; 2937 let sourceList = elements;
2938 queue[_table][dartx.setRange](0, length, dart.as(sourceList, core.Iter able$(E)), 0); 2938 queue[_table][dartx.setRange](0, length, dart.as(sourceList, core.Iter able$(E)), 0);
2939 queue[_tail] = length; 2939 queue[_tail] = length;
2940 return queue; 2940 return queue;
2941 } else { 2941 } else {
2942 let capacity = ListQueue$()._INITIAL_CAPACITY; 2942 let capacity = ListQueue$()._INITIAL_CAPACITY;
2943 if (dart.is(elements, _internal.EfficientLength)) { 2943 if (dart.is(elements, _internal.EfficientLength)) {
2944 capacity = elements.length; 2944 capacity = elements[dartx.length];
2945 } 2945 }
2946 let result = new (ListQueue$(E))(capacity); 2946 let result = new (ListQueue$(E))(capacity);
2947 for (let element of dart.as(elements, core.Iterable$(E))) { 2947 for (let element of dart.as(elements, core.Iterable$(E))) {
2948 result.addLast(element); 2948 result.addLast(element);
2949 } 2949 }
2950 return result; 2950 return result;
2951 } 2951 }
2952 } 2952 }
2953 get iterator() { 2953 get iterator() {
2954 return new (_ListQueueIterator$(E))(this); 2954 return new (_ListQueueIterator$(E))(this);
2955 } 2955 }
2956 forEach(action) { 2956 forEach(action) {
2957 dart.as(action, dart.functionType(dart.void, [E])); 2957 dart.as(action, dart.functionType(dart.void, [E]));
2958 let modificationCount = this[_modificationCount]; 2958 let modificationCount = this[_modificationCount];
2959 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & da rt.notNull(this[_table].length) - 1) { 2959 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & da rt.notNull(this[_table][dartx.length]) - 1) {
2960 action(this[_table][dartx.get](i)); 2960 action(this[_table][dartx.get](i));
2961 this[_checkModification](modificationCount); 2961 this[_checkModification](modificationCount);
2962 } 2962 }
2963 } 2963 }
2964 get isEmpty() { 2964 get isEmpty() {
2965 return this[_head] == this[_tail]; 2965 return this[_head] == this[_tail];
2966 } 2966 }
2967 get length() { 2967 get length() {
2968 return dart.notNull(this[_tail]) - dart.notNull(this[_head]) & dart.notN ull(this[_table].length) - 1; 2968 return dart.notNull(this[_tail]) - dart.notNull(this[_head]) & dart.notN ull(this[_table][dartx.length]) - 1;
2969 } 2969 }
2970 get first() { 2970 get first() {
2971 if (this[_head] == this[_tail]) 2971 if (this[_head] == this[_tail])
2972 throw _internal.IterableElementError.noElement(); 2972 throw _internal.IterableElementError.noElement();
2973 return this[_table][dartx.get](this[_head]); 2973 return this[_table][dartx.get](this[_head]);
2974 } 2974 }
2975 get last() { 2975 get last() {
2976 if (this[_head] == this[_tail]) 2976 if (this[_head] == this[_tail])
2977 throw _internal.IterableElementError.noElement(); 2977 throw _internal.IterableElementError.noElement();
2978 return this[_table][dartx.get](dart.notNull(this[_tail]) - 1 & dart.notN ull(this[_table].length) - 1); 2978 return this[_table][dartx.get](dart.notNull(this[_tail]) - 1 & dart.notN ull(this[_table][dartx.length]) - 1);
2979 } 2979 }
2980 get single() { 2980 get single() {
2981 if (this[_head] == this[_tail]) 2981 if (this[_head] == this[_tail])
2982 throw _internal.IterableElementError.noElement(); 2982 throw _internal.IterableElementError.noElement();
2983 if (dart.notNull(this.length) > 1) 2983 if (dart.notNull(this.length) > 1)
2984 throw _internal.IterableElementError.tooMany(); 2984 throw _internal.IterableElementError.tooMany();
2985 return this[_table][dartx.get](this[_head]); 2985 return this[_table][dartx.get](this[_head]);
2986 } 2986 }
2987 elementAt(index) { 2987 elementAt(index) {
2988 core.RangeError.checkValidIndex(index, this); 2988 core.RangeError.checkValidIndex(index, this);
2989 return this[_table][dartx.get](dart.notNull(this[_head]) + dart.notNull( index) & dart.notNull(this[_table].length) - 1); 2989 return this[_table][dartx.get](dart.notNull(this[_head]) + dart.notNull( index) & dart.notNull(this[_table][dartx.length]) - 1);
2990 } 2990 }
2991 toList(opts) { 2991 toList(opts) {
2992 let growable = opts && 'growable' in opts ? opts.growable : true; 2992 let growable = opts && 'growable' in opts ? opts.growable : true;
2993 let list = null; 2993 let list = null;
2994 if (dart.notNull(growable)) { 2994 if (dart.notNull(growable)) {
2995 list = core.List$(E).new(); 2995 list = core.List$(E).new();
2996 list.length = this.length; 2996 list[dartx.length] = this.length;
2997 } else { 2997 } else {
2998 list = core.List$(E).new(this.length); 2998 list = core.List$(E).new(this.length);
2999 } 2999 }
3000 this[_writeToList](list); 3000 this[_writeToList](list);
3001 return list; 3001 return list;
3002 } 3002 }
3003 add(element) { 3003 add(element) {
3004 dart.as(element, E); 3004 dart.as(element, E);
3005 this[_add](element); 3005 this[_add](element);
3006 } 3006 }
3007 addAll(elements) { 3007 addAll(elements) {
3008 dart.as(elements, core.Iterable$(E)); 3008 dart.as(elements, core.Iterable$(E));
3009 if (dart.is(elements, core.List)) { 3009 if (dart.is(elements, core.List)) {
3010 let list = dart.as(elements, core.List); 3010 let list = dart.as(elements, core.List);
3011 let addCount = list.length; 3011 let addCount = list[dartx.length];
3012 let length = this.length; 3012 let length = this.length;
3013 if (dart.notNull(length) + dart.notNull(addCount) >= dart.notNull(this [_table].length)) { 3013 if (dart.notNull(length) + dart.notNull(addCount) >= dart.notNull(this [_table][dartx.length])) {
3014 this[_preGrow](dart.notNull(length) + dart.notNull(addCount)); 3014 this[_preGrow](dart.notNull(length) + dart.notNull(addCount));
3015 this[_table][dartx.setRange](length, dart.notNull(length) + dart.not Null(addCount), dart.as(list, core.Iterable$(E)), 0); 3015 this[_table][dartx.setRange](length, dart.notNull(length) + dart.not Null(addCount), dart.as(list, core.Iterable$(E)), 0);
3016 this[_tail] = dart.notNull(this[_tail]) + dart.notNull(addCount); 3016 this[_tail] = dart.notNull(this[_tail]) + dart.notNull(addCount);
3017 } else { 3017 } else {
3018 let endSpace = dart.notNull(this[_table].length) - dart.notNull(this [_tail]); 3018 let endSpace = dart.notNull(this[_table][dartx.length]) - dart.notNu ll(this[_tail]);
3019 if (dart.notNull(addCount) < dart.notNull(endSpace)) { 3019 if (dart.notNull(addCount) < dart.notNull(endSpace)) {
3020 this[_table][dartx.setRange](this[_tail], dart.notNull(this[_tail] ) + dart.notNull(addCount), dart.as(list, core.Iterable$(E)), 0); 3020 this[_table][dartx.setRange](this[_tail], dart.notNull(this[_tail] ) + dart.notNull(addCount), dart.as(list, core.Iterable$(E)), 0);
3021 this[_tail] = dart.notNull(this[_tail]) + dart.notNull(addCount); 3021 this[_tail] = dart.notNull(this[_tail]) + dart.notNull(addCount);
3022 } else { 3022 } else {
3023 let preSpace = dart.notNull(addCount) - dart.notNull(endSpace); 3023 let preSpace = dart.notNull(addCount) - dart.notNull(endSpace);
3024 this[_table][dartx.setRange](this[_tail], dart.notNull(this[_tail] ) + dart.notNull(endSpace), dart.as(list, core.Iterable$(E)), 0); 3024 this[_table][dartx.setRange](this[_tail], dart.notNull(this[_tail] ) + dart.notNull(endSpace), dart.as(list, core.Iterable$(E)), 0);
3025 this[_table][dartx.setRange](0, preSpace, dart.as(list, core.Itera ble$(E)), endSpace); 3025 this[_table][dartx.setRange](0, preSpace, dart.as(list, core.Itera ble$(E)), endSpace);
3026 this[_tail] = preSpace; 3026 this[_tail] = preSpace;
3027 } 3027 }
3028 } 3028 }
3029 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3029 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3030 } else { 3030 } else {
3031 for (let element of elements) 3031 for (let element of elements)
3032 this[_add](element); 3032 this[_add](element);
3033 } 3033 }
3034 } 3034 }
3035 remove(object) { 3035 remove(object) {
3036 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & da rt.notNull(this[_table].length) - 1) { 3036 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & da rt.notNull(this[_table][dartx.length]) - 1) {
3037 let element = this[_table][dartx.get](i); 3037 let element = this[_table][dartx.get](i);
3038 if (dart.equals(element, object)) { 3038 if (dart.equals(element, object)) {
3039 this[_remove](i); 3039 this[_remove](i);
3040 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3040 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3041 return true; 3041 return true;
3042 } 3042 }
3043 } 3043 }
3044 return false; 3044 return false;
3045 } 3045 }
3046 [_filterWhere](test, removeMatching) { 3046 [_filterWhere](test, removeMatching) {
3047 dart.as(test, dart.functionType(core.bool, [E])); 3047 dart.as(test, dart.functionType(core.bool, [E]));
3048 let index = this[_head]; 3048 let index = this[_head];
3049 let modificationCount = this[_modificationCount]; 3049 let modificationCount = this[_modificationCount];
3050 let i = this[_head]; 3050 let i = this[_head];
3051 while (i != this[_tail]) { 3051 while (i != this[_tail]) {
3052 let element = this[_table][dartx.get](i); 3052 let element = this[_table][dartx.get](i);
3053 let remove = core.identical(removeMatching, test(element)); 3053 let remove = core.identical(removeMatching, test(element));
3054 this[_checkModification](modificationCount); 3054 this[_checkModification](modificationCount);
3055 if (dart.notNull(remove)) { 3055 if (dart.notNull(remove)) {
3056 i = this[_remove](i); 3056 i = this[_remove](i);
3057 modificationCount = this[_modificationCount] = dart.notNull(this[_mo dificationCount]) + 1; 3057 modificationCount = this[_modificationCount] = dart.notNull(this[_mo dificationCount]) + 1;
3058 } else { 3058 } else {
3059 i = dart.notNull(i) + 1 & dart.notNull(this[_table].length) - 1; 3059 i = dart.notNull(i) + 1 & dart.notNull(this[_table][dartx.length]) - 1;
3060 } 3060 }
3061 } 3061 }
3062 } 3062 }
3063 removeWhere(test) { 3063 removeWhere(test) {
3064 dart.as(test, dart.functionType(core.bool, [E])); 3064 dart.as(test, dart.functionType(core.bool, [E]));
3065 this[_filterWhere](test, true); 3065 this[_filterWhere](test, true);
3066 } 3066 }
3067 retainWhere(test) { 3067 retainWhere(test) {
3068 dart.as(test, dart.functionType(core.bool, [E])); 3068 dart.as(test, dart.functionType(core.bool, [E]));
3069 this[_filterWhere](test, false); 3069 this[_filterWhere](test, false);
3070 } 3070 }
3071 clear() { 3071 clear() {
3072 if (this[_head] != this[_tail]) { 3072 if (this[_head] != this[_tail]) {
3073 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table].length) - 1) { 3073 for (let i = this[_head]; i != this[_tail]; i = dart.notNull(i) + 1 & dart.notNull(this[_table][dartx.length]) - 1) {
3074 this[_table][dartx.set](i, null); 3074 this[_table][dartx.set](i, null);
3075 } 3075 }
3076 this[_head] = this[_tail] = 0; 3076 this[_head] = this[_tail] = 0;
3077 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3077 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3078 } 3078 }
3079 } 3079 }
3080 toString() { 3080 toString() {
3081 return IterableBase.iterableToFullString(this, "{", "}"); 3081 return IterableBase.iterableToFullString(this, "{", "}");
3082 } 3082 }
3083 addLast(element) { 3083 addLast(element) {
3084 dart.as(element, E); 3084 dart.as(element, E);
3085 this[_add](element); 3085 this[_add](element);
3086 } 3086 }
3087 addFirst(element) { 3087 addFirst(element) {
3088 dart.as(element, E); 3088 dart.as(element, E);
3089 this[_head] = dart.notNull(this[_head]) - 1 & dart.notNull(this[_table]. length) - 1; 3089 this[_head] = dart.notNull(this[_head]) - 1 & dart.notNull(this[_table][ dartx.length]) - 1;
3090 this[_table][dartx.set](this[_head], element); 3090 this[_table][dartx.set](this[_head], element);
3091 if (this[_head] == this[_tail]) 3091 if (this[_head] == this[_tail])
3092 this[_grow](); 3092 this[_grow]();
3093 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3093 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3094 } 3094 }
3095 removeFirst() { 3095 removeFirst() {
3096 if (this[_head] == this[_tail]) 3096 if (this[_head] == this[_tail])
3097 throw _internal.IterableElementError.noElement(); 3097 throw _internal.IterableElementError.noElement();
3098 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3098 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3099 let result = this[_table][dartx.get](this[_head]); 3099 let result = this[_table][dartx.get](this[_head]);
3100 this[_table][dartx.set](this[_head], null); 3100 this[_table][dartx.set](this[_head], null);
3101 this[_head] = dart.notNull(this[_head]) + 1 & dart.notNull(this[_table]. length) - 1; 3101 this[_head] = dart.notNull(this[_head]) + 1 & dart.notNull(this[_table][ dartx.length]) - 1;
3102 return result; 3102 return result;
3103 } 3103 }
3104 removeLast() { 3104 removeLast() {
3105 if (this[_head] == this[_tail]) 3105 if (this[_head] == this[_tail])
3106 throw _internal.IterableElementError.noElement(); 3106 throw _internal.IterableElementError.noElement();
3107 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3107 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3108 this[_tail] = dart.notNull(this[_tail]) - 1 & dart.notNull(this[_table]. length) - 1; 3108 this[_tail] = dart.notNull(this[_tail]) - 1 & dart.notNull(this[_table][ dartx.length]) - 1;
3109 let result = this[_table][dartx.get](this[_tail]); 3109 let result = this[_table][dartx.get](this[_tail]);
3110 this[_table][dartx.set](this[_tail], null); 3110 this[_table][dartx.set](this[_tail], null);
3111 return result; 3111 return result;
3112 } 3112 }
3113 static _isPowerOf2(number) { 3113 static _isPowerOf2(number) {
3114 return (dart.notNull(number) & dart.notNull(number) - 1) == 0; 3114 return (dart.notNull(number) & dart.notNull(number) - 1) == 0;
3115 } 3115 }
3116 static _nextPowerOf2(number) { 3116 static _nextPowerOf2(number) {
3117 dart.assert(dart.notNull(number) > 0); 3117 dart.assert(dart.notNull(number) > 0);
3118 number = (dart.notNull(number) << 1) - 1; 3118 number = (dart.notNull(number) << 1) - 1;
3119 for (;;) { 3119 for (;;) {
3120 let nextNumber = dart.notNull(number) & dart.notNull(number) - 1; 3120 let nextNumber = dart.notNull(number) & dart.notNull(number) - 1;
3121 if (nextNumber == 0) 3121 if (nextNumber == 0)
3122 return number; 3122 return number;
3123 number = nextNumber; 3123 number = nextNumber;
3124 } 3124 }
3125 } 3125 }
3126 [_checkModification](expectedModificationCount) { 3126 [_checkModification](expectedModificationCount) {
3127 if (expectedModificationCount != this[_modificationCount]) { 3127 if (expectedModificationCount != this[_modificationCount]) {
3128 throw new core.ConcurrentModificationError(this); 3128 throw new core.ConcurrentModificationError(this);
3129 } 3129 }
3130 } 3130 }
3131 [_add](element) { 3131 [_add](element) {
3132 dart.as(element, E); 3132 dart.as(element, E);
3133 this[_table][dartx.set](this[_tail], element); 3133 this[_table][dartx.set](this[_tail], element);
3134 this[_tail] = dart.notNull(this[_tail]) + 1 & dart.notNull(this[_table]. length) - 1; 3134 this[_tail] = dart.notNull(this[_tail]) + 1 & dart.notNull(this[_table][ dartx.length]) - 1;
3135 if (this[_head] == this[_tail]) 3135 if (this[_head] == this[_tail])
3136 this[_grow](); 3136 this[_grow]();
3137 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3137 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3138 } 3138 }
3139 [_remove](offset) { 3139 [_remove](offset) {
3140 let mask = dart.notNull(this[_table].length) - 1; 3140 let mask = dart.notNull(this[_table][dartx.length]) - 1;
3141 let startDistance = dart.notNull(offset) - dart.notNull(this[_head]) & d art.notNull(mask); 3141 let startDistance = dart.notNull(offset) - dart.notNull(this[_head]) & d art.notNull(mask);
3142 let endDistance = dart.notNull(this[_tail]) - dart.notNull(offset) & dar t.notNull(mask); 3142 let endDistance = dart.notNull(this[_tail]) - dart.notNull(offset) & dar t.notNull(mask);
3143 if (dart.notNull(startDistance) < dart.notNull(endDistance)) { 3143 if (dart.notNull(startDistance) < dart.notNull(endDistance)) {
3144 let i = offset; 3144 let i = offset;
3145 while (i != this[_head]) { 3145 while (i != this[_head]) {
3146 let prevOffset = dart.notNull(i) - 1 & dart.notNull(mask); 3146 let prevOffset = dart.notNull(i) - 1 & dart.notNull(mask);
3147 this[_table][dartx.set](i, this[_table][dartx.get](prevOffset)); 3147 this[_table][dartx.set](i, this[_table][dartx.get](prevOffset));
3148 i = prevOffset; 3148 i = prevOffset;
3149 } 3149 }
3150 this[_table][dartx.set](this[_head], null); 3150 this[_table][dartx.set](this[_head], null);
3151 this[_head] = dart.notNull(this[_head]) + 1 & dart.notNull(mask); 3151 this[_head] = dart.notNull(this[_head]) + 1 & dart.notNull(mask);
3152 return dart.notNull(offset) + 1 & dart.notNull(mask); 3152 return dart.notNull(offset) + 1 & dart.notNull(mask);
3153 } else { 3153 } else {
3154 this[_tail] = dart.notNull(this[_tail]) - 1 & dart.notNull(mask); 3154 this[_tail] = dart.notNull(this[_tail]) - 1 & dart.notNull(mask);
3155 let i = offset; 3155 let i = offset;
3156 while (i != this[_tail]) { 3156 while (i != this[_tail]) {
3157 let nextOffset = dart.notNull(i) + 1 & dart.notNull(mask); 3157 let nextOffset = dart.notNull(i) + 1 & dart.notNull(mask);
3158 this[_table][dartx.set](i, this[_table][dartx.get](nextOffset)); 3158 this[_table][dartx.set](i, this[_table][dartx.get](nextOffset));
3159 i = nextOffset; 3159 i = nextOffset;
3160 } 3160 }
3161 this[_table][dartx.set](this[_tail], null); 3161 this[_table][dartx.set](this[_tail], null);
3162 return offset; 3162 return offset;
3163 } 3163 }
3164 } 3164 }
3165 [_grow]() { 3165 [_grow]() {
3166 let newTable = core.List$(E).new(dart.notNull(this[_table].length) * 2); 3166 let newTable = core.List$(E).new(dart.notNull(this[_table][dartx.length] ) * 2);
3167 let split = dart.notNull(this[_table].length) - dart.notNull(this[_head] ); 3167 let split = dart.notNull(this[_table][dartx.length]) - dart.notNull(this [_head]);
3168 newTable[dartx.setRange](0, split, this[_table], this[_head]); 3168 newTable[dartx.setRange](0, split, this[_table], this[_head]);
3169 newTable[dartx.setRange](split, dart.notNull(split) + dart.notNull(this[ _head]), this[_table], 0); 3169 newTable[dartx.setRange](split, dart.notNull(split) + dart.notNull(this[ _head]), this[_table], 0);
3170 this[_head] = 0; 3170 this[_head] = 0;
3171 this[_tail] = this[_table].length; 3171 this[_tail] = this[_table][dartx.length];
3172 this[_table] = newTable; 3172 this[_table] = newTable;
3173 } 3173 }
3174 [_writeToList](target) { 3174 [_writeToList](target) {
3175 dart.as(target, core.List$(E)); 3175 dart.as(target, core.List$(E));
3176 dart.assert(dart.notNull(target.length) >= dart.notNull(this.length)); 3176 dart.assert(dart.notNull(target[dartx.length]) >= dart.notNull(this.leng th));
3177 if (dart.notNull(this[_head]) <= dart.notNull(this[_tail])) { 3177 if (dart.notNull(this[_head]) <= dart.notNull(this[_tail])) {
3178 let length = dart.notNull(this[_tail]) - dart.notNull(this[_head]); 3178 let length = dart.notNull(this[_tail]) - dart.notNull(this[_head]);
3179 target[dartx.setRange](0, length, this[_table], this[_head]); 3179 target[dartx.setRange](0, length, this[_table], this[_head]);
3180 return length; 3180 return length;
3181 } else { 3181 } else {
3182 let firstPartSize = dart.notNull(this[_table].length) - dart.notNull(t his[_head]); 3182 let firstPartSize = dart.notNull(this[_table][dartx.length]) - dart.no tNull(this[_head]);
3183 target[dartx.setRange](0, firstPartSize, this[_table], this[_head]); 3183 target[dartx.setRange](0, firstPartSize, this[_table], this[_head]);
3184 target[dartx.setRange](firstPartSize, dart.notNull(firstPartSize) + da rt.notNull(this[_tail]), this[_table], 0); 3184 target[dartx.setRange](firstPartSize, dart.notNull(firstPartSize) + da rt.notNull(this[_tail]), this[_table], 0);
3185 return dart.notNull(this[_tail]) + dart.notNull(firstPartSize); 3185 return dart.notNull(this[_tail]) + dart.notNull(firstPartSize);
3186 } 3186 }
3187 } 3187 }
3188 [_preGrow](newElementCount) { 3188 [_preGrow](newElementCount) {
3189 dart.assert(dart.notNull(newElementCount) >= dart.notNull(this.length)); 3189 dart.assert(dart.notNull(newElementCount) >= dart.notNull(this.length));
3190 newElementCount = dart.notNull(newElementCount) + (dart.notNull(newEleme ntCount) >> 1); 3190 newElementCount = dart.notNull(newElementCount) + (dart.notNull(newEleme ntCount) >> 1);
3191 let newCapacity = ListQueue$()._nextPowerOf2(newElementCount); 3191 let newCapacity = ListQueue$()._nextPowerOf2(newElementCount);
3192 let newTable = core.List$(E).new(newCapacity); 3192 let newTable = core.List$(E).new(newCapacity);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 get current() { 3259 get current() {
3260 return this[_current]; 3260 return this[_current];
3261 } 3261 }
3262 moveNext() { 3262 moveNext() {
3263 this[_queue][_checkModification](this[_modificationCount]); 3263 this[_queue][_checkModification](this[_modificationCount]);
3264 if (this[_position] == this[_end]) { 3264 if (this[_position] == this[_end]) {
3265 this[_current] = null; 3265 this[_current] = null;
3266 return false; 3266 return false;
3267 } 3267 }
3268 this[_current] = dart.as(this[_queue][_table][dartx.get](this[_position] ), E); 3268 this[_current] = dart.as(this[_queue][_table][dartx.get](this[_position] ), E);
3269 this[_position] = dart.notNull(this[_position]) + 1 & dart.notNull(this[ _queue][_table].length) - 1; 3269 this[_position] = dart.notNull(this[_position]) + 1 & dart.notNull(this[ _queue][_table][dartx.length]) - 1;
3270 return true; 3270 return true;
3271 } 3271 }
3272 } 3272 }
3273 _ListQueueIterator[dart.implements] = () => [core.Iterator$(E)]; 3273 _ListQueueIterator[dart.implements] = () => [core.Iterator$(E)];
3274 dart.setSignature(_ListQueueIterator, { 3274 dart.setSignature(_ListQueueIterator, {
3275 constructors: () => ({_ListQueueIterator: [_ListQueueIterator$(E), [ListQu eue]]}), 3275 constructors: () => ({_ListQueueIterator: [_ListQueueIterator$(E), [ListQu eue]]}),
3276 methods: () => ({moveNext: [core.bool, []]}) 3276 methods: () => ({moveNext: [core.bool, []]})
3277 }); 3277 });
3278 return _ListQueueIterator; 3278 return _ListQueueIterator;
3279 }); 3279 });
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4273 } 4273 }
4274 clear() { 4274 clear() {
4275 if (dart.notNull(this[_length]) > 0) { 4275 if (dart.notNull(this[_length]) > 0) {
4276 this[_strings] = this[_nums] = this[_rest] = this[_keys] = null; 4276 this[_strings] = this[_nums] = this[_rest] = this[_keys] = null;
4277 this[_length] = 0; 4277 this[_length] = 0;
4278 } 4278 }
4279 } 4279 }
4280 forEach(action) { 4280 forEach(action) {
4281 dart.as(action, dart.functionType(dart.void, [K, V])); 4281 dart.as(action, dart.functionType(dart.void, [K, V]));
4282 let keys = this[_computeKeys](); 4282 let keys = this[_computeKeys]();
4283 for (let i = 0, length = keys.length; dart.notNull(i) < dart.notNull(len gth); i = dart.notNull(i) + 1) { 4283 for (let i = 0, length = keys[dartx.length]; dart.notNull(i) < dart.notN ull(length); i = dart.notNull(i) + 1) {
4284 let key = keys[i]; 4284 let key = keys[i];
4285 action(dart.as(key, K), this.get(key)); 4285 action(dart.as(key, K), this.get(key));
4286 if (keys !== this[_keys]) { 4286 if (keys !== this[_keys]) {
4287 throw new core.ConcurrentModificationError(this); 4287 throw new core.ConcurrentModificationError(this);
4288 } 4288 }
4289 } 4289 }
4290 } 4290 }
4291 [_computeKeys]() { 4291 [_computeKeys]() {
4292 if (this[_keys] != null) 4292 if (this[_keys] != null)
4293 return this[_keys]; 4293 return this[_keys];
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after
6010 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; 6010 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$;
6011 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; 6011 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable;
6012 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; 6012 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$;
6013 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; 6013 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator;
6014 exports.HashSetIterator$ = HashSetIterator$; 6014 exports.HashSetIterator$ = HashSetIterator$;
6015 exports.HashSetIterator = HashSetIterator; 6015 exports.HashSetIterator = HashSetIterator;
6016 exports.LinkedHashSetCell = LinkedHashSetCell; 6016 exports.LinkedHashSetCell = LinkedHashSetCell;
6017 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; 6017 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$;
6018 exports.LinkedHashSetIterator = LinkedHashSetIterator; 6018 exports.LinkedHashSetIterator = LinkedHashSetIterator;
6019 }); 6019 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698