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

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

Issue 1710583002: Fix tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix hints and reformat Created 4 years, 10 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
« no previous file with comments | « lib/runtime/dart/async.js ('k') | lib/runtime/dart/js.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/collection', null, /* Imports */[ 1 dart_library.library('dart/collection', null, /* Imports */[
2 'dart/_runtime', 2 'dart/_runtime',
3 'dart/core' 3 'dart/core'
4 ], /* Lazy imports */[ 4 ], /* Lazy imports */[
5 'dart/_internal', 5 'dart/_internal',
6 'dart/_js_helper', 6 'dart/_js_helper',
7 'dart/math' 7 'dart/math'
8 ], function(exports, dart, core, _internal, _js_helper, math) { 8 ], function(exports, dart, core, _internal, _js_helper, math) {
9 'use strict'; 9 'use strict';
10 let dartx = dart.dartx; 10 let dartx = dart.dartx;
(...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 } 1839 }
1840 [dartx.removeWhere](test) { 1840 [dartx.removeWhere](test) {
1841 dart.as(test, dart.functionType(core.bool, [E])); 1841 dart.as(test, dart.functionType(core.bool, [E]));
1842 ListMixin$()._filter(this, test, false); 1842 ListMixin$()._filter(this, test, false);
1843 } 1843 }
1844 [dartx.retainWhere](test) { 1844 [dartx.retainWhere](test) {
1845 dart.as(test, dart.functionType(core.bool, [E])); 1845 dart.as(test, dart.functionType(core.bool, [E]));
1846 ListMixin$()._filter(this, test, true); 1846 ListMixin$()._filter(this, test, true);
1847 } 1847 }
1848 static _filter(source, test, retainMatching) { 1848 static _filter(source, test, retainMatching) {
1849 dart.as(test, dart.functionType(core.bool, [dart.dynamic]));
1850 let retained = []; 1849 let retained = [];
1851 let length = source[dartx.length]; 1850 let length = source[dartx.length];
1852 for (let i = 0; i < dart.notNull(length); i++) { 1851 for (let i = 0; i < dart.notNull(length); i++) {
1853 let element = source[dartx.get](i); 1852 let element = source[dartx.get](i);
1854 if (dart.dcall(test, element) == retainMatching) { 1853 if (dart.dcall(test, element) == retainMatching) {
1855 retained[dartx.add](element); 1854 retained[dartx.add](element);
1856 } 1855 }
1857 if (length != source[dartx.length]) { 1856 if (length != source[dartx.length]) {
1858 dart.throw(new core.ConcurrentModificationError(source)); 1857 dart.throw(new core.ConcurrentModificationError(source));
1859 } 1858 }
(...skipping 10 matching lines...) Expand all
1870 if (this[dartx.length] == 0) { 1869 if (this[dartx.length] == 0) {
1871 dart.throw(_internal.IterableElementError.noElement()); 1870 dart.throw(_internal.IterableElementError.noElement());
1872 } 1871 }
1873 let result = this[dartx.get](dart.notNull(this[dartx.length]) - 1); 1872 let result = this[dartx.get](dart.notNull(this[dartx.length]) - 1);
1874 this[dartx.length] = dart.notNull(this[dartx.length]) - 1; 1873 this[dartx.length] = dart.notNull(this[dartx.length]) - 1;
1875 return result; 1874 return result;
1876 } 1875 }
1877 [dartx.sort](compare) { 1876 [dartx.sort](compare) {
1878 if (compare === void 0) compare = null; 1877 if (compare === void 0) compare = null;
1879 dart.as(compare, dart.functionType(core.int, [E, E])); 1878 dart.as(compare, dart.functionType(core.int, [E, E]));
1880 _internal.Sort.sort(this, dart.as(compare == null ? core.Comparable.comp are : compare, __CastType0)); 1879 _internal.Sort.sort(this, compare == null ? core.Comparable.compare : co mpare);
1881 } 1880 }
1882 [dartx.shuffle](random) { 1881 [dartx.shuffle](random) {
1883 if (random === void 0) random = null; 1882 if (random === void 0) random = null;
1884 if (random == null) random = math.Random.new(); 1883 if (random == null) random = math.Random.new();
1885 let length = this[dartx.length]; 1884 let length = this[dartx.length];
1886 while (dart.notNull(length) > 1) { 1885 while (dart.notNull(length) > 1) {
1887 let pos = random.nextInt(length); 1886 let pos = random.nextInt(length);
1888 length = dart.notNull(length) - 1; 1887 length = dart.notNull(length) - 1;
1889 let tmp = this[dartx.get](length); 1888 let tmp = this[dartx.get](length);
1890 this[dartx.set](length, this[dartx.get](pos)); 1889 this[dartx.set](length, this[dartx.get](pos));
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 return IterableBase.iterableToFullString(list, '[', ']'); 2121 return IterableBase.iterableToFullString(list, '[', ']');
2123 } 2122 }
2124 } 2123 }
2125 dart.setSignature(ListBase, { 2124 dart.setSignature(ListBase, {
2126 statics: () => ({listToString: [core.String, [core.List]]}), 2125 statics: () => ({listToString: [core.String, [core.List]]}),
2127 names: ['listToString'] 2126 names: ['listToString']
2128 }); 2127 });
2129 return ListBase; 2128 return ListBase;
2130 }); 2129 });
2131 let ListBase = ListBase$(); 2130 let ListBase = ListBase$();
2132 const __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.i nt, [dart.dynamic, dart.dynamic]));
2133 const MapMixin$ = dart.generic(function(K, V) { 2131 const MapMixin$ = dart.generic(function(K, V) {
2134 class MapMixin extends core.Object { 2132 class MapMixin extends core.Object {
2135 forEach(action) { 2133 forEach(action) {
2136 dart.as(action, dart.functionType(dart.void, [K, V])); 2134 dart.as(action, dart.functionType(dart.void, [K, V]));
2137 for (let key of this.keys) { 2135 for (let key of this.keys) {
2138 action(key, this.get(key)); 2136 action(key, this.get(key));
2139 } 2137 }
2140 } 2138 }
2141 addAll(other) { 2139 addAll(other) {
2142 dart.as(other, core.Map$(K, V)); 2140 dart.as(other, core.Map$(K, V));
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 return _SplayTree; 3376 return _SplayTree;
3379 }); 3377 });
3380 let _SplayTree = _SplayTree$(); 3378 let _SplayTree = _SplayTree$();
3381 const _comparator = Symbol('_comparator'); 3379 const _comparator = Symbol('_comparator');
3382 const _validKey = Symbol('_validKey'); 3380 const _validKey = Symbol('_validKey');
3383 const SplayTreeMap$ = dart.generic(function(K, V) { 3381 const SplayTreeMap$ = dart.generic(function(K, V) {
3384 class SplayTreeMap extends _SplayTree$(K) { 3382 class SplayTreeMap extends _SplayTree$(K) {
3385 SplayTreeMap(compare, isValidKey) { 3383 SplayTreeMap(compare, isValidKey) {
3386 if (compare === void 0) compare = null; 3384 if (compare === void 0) compare = null;
3387 if (isValidKey === void 0) isValidKey = null; 3385 if (isValidKey === void 0) isValidKey = null;
3388 this[_comparator] = dart.as(compare == null ? core.Comparable.compare : compare, core.Comparator$(K)); 3386 this[_comparator] = compare == null ? core.Comparable.compare : compare;
3389 this[_validKey] = dart.as(isValidKey != null ? isValidKey : dart.fn(v => dart.is(v, K), core.bool, [core.Object]), _Predicate$(core.Object)); 3387 this[_validKey] = isValidKey != null ? isValidKey : dart.fn(v => dart.is (v, K), core.bool, [core.Object]);
3390 super._SplayTree(); 3388 super._SplayTree();
3391 } 3389 }
3392 static from(other, compare, isValidKey) { 3390 static from(other, compare, isValidKey) {
3393 if (compare === void 0) compare = null; 3391 if (compare === void 0) compare = null;
3394 if (isValidKey === void 0) isValidKey = null; 3392 if (isValidKey === void 0) isValidKey = null;
3395 let result = new (SplayTreeMap$(K, V))(); 3393 let result = new (SplayTreeMap$(K, V))();
3396 other.forEach(dart.fn((k, v) => { 3394 other.forEach(dart.fn((k, v) => {
3397 result.set(dart.as(k, K), dart.as(v, V)); 3395 result.set(dart.as(k, K), dart.as(v, V));
3398 }, dart.void, [dart.dynamic, dart.dynamic])); 3396 }, dart.void, [dart.dynamic, dart.dynamic]));
3399 return result; 3397 return result;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3796 }); 3794 });
3797 return _SplayTreeNodeIterator; 3795 return _SplayTreeNodeIterator;
3798 }); 3796 });
3799 let _SplayTreeNodeIterator = _SplayTreeNodeIterator$(); 3797 let _SplayTreeNodeIterator = _SplayTreeNodeIterator$();
3800 const _clone = Symbol('_clone'); 3798 const _clone = Symbol('_clone');
3801 const SplayTreeSet$ = dart.generic(function(E) { 3799 const SplayTreeSet$ = dart.generic(function(E) {
3802 class SplayTreeSet extends dart.mixin(_SplayTree$(E), IterableMixin$(E), Set Mixin$(E)) { 3800 class SplayTreeSet extends dart.mixin(_SplayTree$(E), IterableMixin$(E), Set Mixin$(E)) {
3803 SplayTreeSet(compare, isValidKey) { 3801 SplayTreeSet(compare, isValidKey) {
3804 if (compare === void 0) compare = null; 3802 if (compare === void 0) compare = null;
3805 if (isValidKey === void 0) isValidKey = null; 3803 if (isValidKey === void 0) isValidKey = null;
3806 this[_comparator] = dart.as(compare == null ? core.Comparable.compare : compare, core.Comparator$(E)); 3804 this[_comparator] = compare == null ? core.Comparable.compare : compare;
3807 this[_validKey] = dart.as(isValidKey != null ? isValidKey : dart.fn(v => dart.is(v, E), core.bool, [core.Object]), _Predicate$(core.Object)); 3805 this[_validKey] = isValidKey != null ? isValidKey : dart.fn(v => dart.is (v, E), core.bool, [core.Object]);
3808 super._SplayTree(); 3806 super._SplayTree();
3809 } 3807 }
3810 static from(elements, compare, isValidKey) { 3808 static from(elements, compare, isValidKey) {
3811 if (compare === void 0) compare = null; 3809 if (compare === void 0) compare = null;
3812 if (isValidKey === void 0) isValidKey = null; 3810 if (isValidKey === void 0) isValidKey = null;
3813 let result = new (SplayTreeSet$(E))(compare, isValidKey); 3811 let result = new (SplayTreeSet$(E))(compare, isValidKey);
3814 for (let element of dart.as(elements, core.Iterable$(E))) { 3812 for (let element of dart.as(elements, core.Iterable$(E))) {
3815 result.add(element); 3813 result.add(element);
3816 } 3814 }
3817 return result; 3815 return result;
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
4304 return _IdentityHashMap; 4302 return _IdentityHashMap;
4305 }); 4303 });
4306 let _IdentityHashMap = _IdentityHashMap$(); 4304 let _IdentityHashMap = _IdentityHashMap$();
4307 const _equals = Symbol('_equals'); 4305 const _equals = Symbol('_equals');
4308 const _hashCode = Symbol('_hashCode'); 4306 const _hashCode = Symbol('_hashCode');
4309 const _CustomHashMap$ = dart.generic(function(K, V) { 4307 const _CustomHashMap$ = dart.generic(function(K, V) {
4310 class _CustomHashMap extends _HashMap$(K, V) { 4308 class _CustomHashMap extends _HashMap$(K, V) {
4311 _CustomHashMap(equals, hashCode, validKey) { 4309 _CustomHashMap(equals, hashCode, validKey) {
4312 this[_equals] = equals; 4310 this[_equals] = equals;
4313 this[_hashCode] = hashCode; 4311 this[_hashCode] = hashCode;
4314 this[_validKey] = dart.as(validKey != null ? validKey : dart.fn(v => dar t.is(v, K), core.bool, [core.Object]), _Predicate$(core.Object)); 4312 this[_validKey] = validKey != null ? validKey : dart.fn(v => dart.is(v, K), core.bool, [core.Object]);
4315 super._HashMap(); 4313 super._HashMap();
4316 } 4314 }
4317 get(key) { 4315 get(key) {
4318 if (!dart.notNull(this[_validKey](key))) return null; 4316 if (!dart.notNull(this[_validKey](key))) return null;
4319 return super[_get](key); 4317 return super[_get](key);
4320 } 4318 }
4321 set(key, value) { 4319 set(key, value) {
4322 dart.as(key, K); 4320 dart.as(key, K);
4323 dart.as(value, V); 4321 dart.as(value, V);
4324 super[_set](key, value); 4322 super[_set](key, value);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
4763 } 4761 }
4764 } 4762 }
4765 return _LinkedIdentityHashMap; 4763 return _LinkedIdentityHashMap;
4766 }); 4764 });
4767 let _LinkedIdentityHashMap = _LinkedIdentityHashMap$(); 4765 let _LinkedIdentityHashMap = _LinkedIdentityHashMap$();
4768 const _LinkedCustomHashMap$ = dart.generic(function(K, V) { 4766 const _LinkedCustomHashMap$ = dart.generic(function(K, V) {
4769 class _LinkedCustomHashMap extends _LinkedHashMap$(K, V) { 4767 class _LinkedCustomHashMap extends _LinkedHashMap$(K, V) {
4770 _LinkedCustomHashMap(equals, hashCode, validKey) { 4768 _LinkedCustomHashMap(equals, hashCode, validKey) {
4771 this[_equals] = equals; 4769 this[_equals] = equals;
4772 this[_hashCode] = hashCode; 4770 this[_hashCode] = hashCode;
4773 this[_validKey] = dart.as(validKey != null ? validKey : dart.fn(v => dar t.is(v, K), core.bool, [core.Object]), _Predicate$(core.Object)); 4771 this[_validKey] = validKey != null ? validKey : dart.fn(v => dart.is(v, K), core.bool, [core.Object]);
4774 super._LinkedHashMap(); 4772 super._LinkedHashMap();
4775 } 4773 }
4776 get(key) { 4774 get(key) {
4777 if (!dart.notNull(this[_validKey](key))) return null; 4775 if (!dart.notNull(this[_validKey](key))) return null;
4778 return super[_get](key); 4776 return super[_get](key);
4779 } 4777 }
4780 set(key, value) { 4778 set(key, value) {
4781 dart.as(key, K); 4779 dart.as(key, K);
4782 dart.as(value, V); 4780 dart.as(value, V);
4783 super[_set](key, value); 4781 super[_set](key, value);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
5194 return _IdentityHashSet; 5192 return _IdentityHashSet;
5195 }); 5193 });
5196 let _IdentityHashSet = _IdentityHashSet$(); 5194 let _IdentityHashSet = _IdentityHashSet$();
5197 const _equality = Symbol('_equality'); 5195 const _equality = Symbol('_equality');
5198 const _hasher = Symbol('_hasher'); 5196 const _hasher = Symbol('_hasher');
5199 const _CustomHashSet$ = dart.generic(function(E) { 5197 const _CustomHashSet$ = dart.generic(function(E) {
5200 class _CustomHashSet extends _HashSet$(E) { 5198 class _CustomHashSet extends _HashSet$(E) {
5201 _CustomHashSet(equality, hasher, validKey) { 5199 _CustomHashSet(equality, hasher, validKey) {
5202 this[_equality] = equality; 5200 this[_equality] = equality;
5203 this[_hasher] = hasher; 5201 this[_hasher] = hasher;
5204 this[_validKey] = dart.as(validKey != null ? validKey : dart.fn(x => dar t.is(x, E), core.bool, [core.Object]), _Predicate$(core.Object)); 5202 this[_validKey] = validKey != null ? validKey : dart.fn(x => dart.is(x, E), core.bool, [core.Object]);
5205 super._HashSet(); 5203 super._HashSet();
5206 } 5204 }
5207 [_newSet]() { 5205 [_newSet]() {
5208 return new (_CustomHashSet$(E))(this[_equality], this[_hasher], this[_va lidKey]); 5206 return new (_CustomHashSet$(E))(this[_equality], this[_hasher], this[_va lidKey]);
5209 } 5207 }
5210 [_findBucketIndex](bucket, element) { 5208 [_findBucketIndex](bucket, element) {
5211 if (bucket == null) return -1; 5209 if (bucket == null) return -1;
5212 let length = bucket.length; 5210 let length = bucket.length;
5213 for (let i = 0; i < length; i++) { 5211 for (let i = 0; i < length; i++) {
5214 if (dart.notNull(this[_equality](dart.as(bucket[i], E), dart.as(elemen t, E)))) return i; 5212 if (dart.notNull(this[_equality](dart.as(bucket[i], E), dart.as(elemen t, E)))) return i;
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
5612 methods: () => ({[_newSet]: [core.Set$(E), []]}) 5610 methods: () => ({[_newSet]: [core.Set$(E), []]})
5613 }); 5611 });
5614 return _LinkedIdentityHashSet; 5612 return _LinkedIdentityHashSet;
5615 }); 5613 });
5616 let _LinkedIdentityHashSet = _LinkedIdentityHashSet$(); 5614 let _LinkedIdentityHashSet = _LinkedIdentityHashSet$();
5617 const _LinkedCustomHashSet$ = dart.generic(function(E) { 5615 const _LinkedCustomHashSet$ = dart.generic(function(E) {
5618 class _LinkedCustomHashSet extends _LinkedHashSet$(E) { 5616 class _LinkedCustomHashSet extends _LinkedHashSet$(E) {
5619 _LinkedCustomHashSet(equality, hasher, validKey) { 5617 _LinkedCustomHashSet(equality, hasher, validKey) {
5620 this[_equality] = equality; 5618 this[_equality] = equality;
5621 this[_hasher] = hasher; 5619 this[_hasher] = hasher;
5622 this[_validKey] = dart.as(validKey != null ? validKey : dart.fn(x => dar t.is(x, E), core.bool, [core.Object]), _Predicate$(core.Object)); 5620 this[_validKey] = validKey != null ? validKey : dart.fn(x => dart.is(x, E), core.bool, [core.Object]);
5623 super._LinkedHashSet(); 5621 super._LinkedHashSet();
5624 } 5622 }
5625 [_newSet]() { 5623 [_newSet]() {
5626 return new (_LinkedCustomHashSet$(E))(this[_equality], this[_hasher], th is[_validKey]); 5624 return new (_LinkedCustomHashSet$(E))(this[_equality], this[_hasher], th is[_validKey]);
5627 } 5625 }
5628 [_findBucketIndex](bucket, element) { 5626 [_findBucketIndex](bucket, element) {
5629 if (bucket == null) return -1; 5627 if (bucket == null) return -1;
5630 let length = bucket.length; 5628 let length = bucket.length;
5631 for (let i = 0; i < length; i++) { 5629 for (let i = 0; i < length; i++) {
5632 let cell = dart.as(bucket[i], LinkedHashSetCell); 5630 let cell = dart.as(bucket[i], LinkedHashSetCell);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
5781 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; 5779 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$;
5782 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; 5780 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable;
5783 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; 5781 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$;
5784 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; 5782 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator;
5785 exports.HashSetIterator$ = HashSetIterator$; 5783 exports.HashSetIterator$ = HashSetIterator$;
5786 exports.HashSetIterator = HashSetIterator; 5784 exports.HashSetIterator = HashSetIterator;
5787 exports.LinkedHashSetCell = LinkedHashSetCell; 5785 exports.LinkedHashSetCell = LinkedHashSetCell;
5788 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; 5786 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$;
5789 exports.LinkedHashSetIterator = LinkedHashSetIterator; 5787 exports.LinkedHashSetIterator = LinkedHashSetIterator;
5790 }); 5788 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/async.js ('k') | lib/runtime/dart/js.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698