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

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

Issue 1112403004: SDK fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Formatting fix Created 5 years, 7 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 var collection; 1 var collection;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 let _source = Symbol('_source'); 4 let _source = Symbol('_source');
5 let UnmodifiableListView$ = dart.generic(function(E) { 5 let UnmodifiableListView$ = dart.generic(function(E) {
6 class UnmodifiableListView extends _internal.UnmodifiableListBase$(E) { 6 class UnmodifiableListView extends _internal.UnmodifiableListBase$(E) {
7 UnmodifiableListView(source) { 7 UnmodifiableListView(source) {
8 this[_source] = source; 8 this[_source] = source;
9 } 9 }
10 get [core.$length]() { 10 get [core.$length]() {
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 throw _internal.IterableElementError.noElement(); 1668 throw _internal.IterableElementError.noElement();
1669 } 1669 }
1670 let result = this[core.$get](dart.notNull(this[core.$length]) - 1); 1670 let result = this[core.$get](dart.notNull(this[core.$length]) - 1);
1671 this[core.$length] = dart.notNull(this[core.$length]) - 1; 1671 this[core.$length] = dart.notNull(this[core.$length]) - 1;
1672 return result; 1672 return result;
1673 } 1673 }
1674 [core.$sort](compare) { 1674 [core.$sort](compare) {
1675 if (compare === void 0) 1675 if (compare === void 0)
1676 compare = null; 1676 compare = null;
1677 dart.as(compare, dart.functionType(core.int, [E, E])); 1677 dart.as(compare, dart.functionType(core.int, [E, E]));
1678 if (compare == null) { 1678 _internal.Sort.sort(this, dart.as(compare == null ? dart.bind(core.Compa rable, 'compare') : compare, __CastType20));
1679 let defaultCompare = dart.bind(core.Comparable, 'compare');
1680 compare = defaultCompare;
1681 }
1682 _internal.Sort.sort(this, compare);
1683 } 1679 }
1684 [core.$shuffle](random) { 1680 [core.$shuffle](random) {
1685 if (random === void 0) 1681 if (random === void 0)
1686 random = null; 1682 random = null;
1687 if (random == null) 1683 if (random == null)
1688 random = new math.Random(); 1684 random = new math.Random();
1689 let length = this[core.$length]; 1685 let length = this[core.$length];
1690 while (dart.notNull(length) > 1) { 1686 while (dart.notNull(length) > 1) {
1691 let pos = random.nextInt(length); 1687 let pos = random.nextInt(length);
1692 length = dart.notNull(length) - 1; 1688 length = dart.notNull(length) - 1;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 let ListMixin = ListMixin$(); 1881 let ListMixin = ListMixin$();
1886 let ListBase$ = dart.generic(function(E) { 1882 let ListBase$ = dart.generic(function(E) {
1887 class ListBase extends dart.mixin(core.Object, ListMixin$(E)) { 1883 class ListBase extends dart.mixin(core.Object, ListMixin$(E)) {
1888 static listToString(list) { 1884 static listToString(list) {
1889 return IterableBase.iterableToFullString(list, '[', ']'); 1885 return IterableBase.iterableToFullString(list, '[', ']');
1890 } 1886 }
1891 } 1887 }
1892 return ListBase; 1888 return ListBase;
1893 }); 1889 });
1894 let ListBase = ListBase$(); 1890 let ListBase = ListBase$();
1891 let __CastType20 = dart.typedef('__CastType20', () => dart.functionType(core.i nt, [dart.dynamic, dart.dynamic]));
1895 let MapMixin$ = dart.generic(function(K, V) { 1892 let MapMixin$ = dart.generic(function(K, V) {
1896 class MapMixin extends core.Object { 1893 class MapMixin extends core.Object {
1897 forEach(action) { 1894 forEach(action) {
1898 dart.as(action, dart.functionType(dart.void, [K, V])); 1895 dart.as(action, dart.functionType(dart.void, [K, V]));
1899 for (let key of this.keys) { 1896 for (let key of this.keys) {
1900 action(key, this.get(key)); 1897 action(key, this.get(key));
1901 } 1898 }
1902 } 1899 }
1903 addAll(other) { 1900 addAll(other) {
1904 dart.as(other, core.Map$(K, V)); 1901 dart.as(other, core.Map$(K, V));
1905 for (let key of other.keys) { 1902 for (let key of other.keys) {
1906 this.set(key, other.get(key)); 1903 this.set(key, other.get(key));
1907 } 1904 }
1908 } 1905 }
1909 containsValue(value) { 1906 containsValue(value) {
1910 dart.as(value, V);
1911 for (let key of this.keys) { 1907 for (let key of this.keys) {
1912 if (dart.equals(this.get(key), value)) 1908 if (dart.equals(this.get(key), value))
1913 return true; 1909 return true;
1914 } 1910 }
1915 return false; 1911 return false;
1916 } 1912 }
1917 putIfAbsent(key, ifAbsent) { 1913 putIfAbsent(key, ifAbsent) {
1918 dart.as(key, K); 1914 dart.as(key, K);
1919 dart.as(ifAbsent, dart.functionType(V, [])); 1915 dart.as(ifAbsent, dart.functionType(V, []));
1920 if (this.keys[core.$contains](key)) { 1916 if (this.keys[core.$contains](key)) {
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2957 } 2953 }
2958 [_clear]() { 2954 [_clear]() {
2959 this[_root] = null; 2955 this[_root] = null;
2960 this[_count] = 0; 2956 this[_count] = 0;
2961 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 2957 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
2962 } 2958 }
2963 } 2959 }
2964 return _SplayTree; 2960 return _SplayTree;
2965 }); 2961 });
2966 let _SplayTree = _SplayTree$(); 2962 let _SplayTree = _SplayTree$();
2967 let _TypeTest$ = dart.generic(function(T) {
2968 class _TypeTest extends core.Object {
2969 test(v) {
2970 return dart.is(v, T);
2971 }
2972 }
2973 return _TypeTest;
2974 });
2975 let _TypeTest = _TypeTest$();
2976 let _comparator = Symbol('_comparator'); 2963 let _comparator = Symbol('_comparator');
2977 let _validKey = Symbol('_validKey'); 2964 let _validKey = Symbol('_validKey');
2978 let SplayTreeMap$ = dart.generic(function(K, V) { 2965 let SplayTreeMap$ = dart.generic(function(K, V) {
2979 class SplayTreeMap extends _SplayTree$(K) { 2966 class SplayTreeMap extends _SplayTree$(K) {
2980 SplayTreeMap(compare, isValidKey) { 2967 SplayTreeMap(compare, isValidKey) {
2981 if (compare === void 0) 2968 if (compare === void 0)
2982 compare = null; 2969 compare = null;
2983 if (isValidKey === void 0) 2970 if (isValidKey === void 0)
2984 isValidKey = null; 2971 isValidKey = null;
2985 this[_comparator] = dart.as(compare == null ? dart.bind(core.Comparable, 'compare') : compare, core.Comparator$(K)); 2972 this[_comparator] = dart.as(compare == null ? dart.bind(core.Comparable, 'compare') : compare, core.Comparator$(K));
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3223 this[_splayCount] = tree[_splayCount]; 3210 this[_splayCount] = tree[_splayCount];
3224 if (dart.notNull(compare) < 0) { 3211 if (dart.notNull(compare) < 0) {
3225 this[_findLeftMostDescendent](tree[_root].right); 3212 this[_findLeftMostDescendent](tree[_root].right);
3226 } else { 3213 } else {
3227 this[_workList][core.$add](tree[_root]); 3214 this[_workList][core.$add](tree[_root]);
3228 } 3215 }
3229 } 3216 }
3230 get current() { 3217 get current() {
3231 if (this[_currentNode] == null) 3218 if (this[_currentNode] == null)
3232 return null; 3219 return null;
3233 return this[_getValue](this[_currentNode]); 3220 return this[_getValue](dart.as(this[_currentNode], _SplayTreeMapNode));
3234 } 3221 }
3235 [_findLeftMostDescendent](node) { 3222 [_findLeftMostDescendent](node) {
3236 while (node != null) { 3223 while (node != null) {
3237 this[_workList][core.$add](node); 3224 this[_workList][core.$add](node);
3238 node = node.left; 3225 node = node.left;
3239 } 3226 }
3240 } 3227 }
3241 [_rebuildWorkList](currentNode) { 3228 [_rebuildWorkList](currentNode) {
3242 dart.assert(!dart.notNull(this[_workList][core.$isEmpty])); 3229 dart.assert(!dart.notNull(this[_workList][core.$isEmpty]));
3243 this[_workList][core.$clear](); 3230 this[_workList][core.$clear]();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3281 return this[_tree][_count]; 3268 return this[_tree][_count];
3282 } 3269 }
3283 get [core.$isEmpty]() { 3270 get [core.$isEmpty]() {
3284 return this[_tree][_count] == 0; 3271 return this[_tree][_count] == 0;
3285 } 3272 }
3286 get [core.$iterator]() { 3273 get [core.$iterator]() {
3287 return new (_SplayTreeKeyIterator$(K))(this[_tree]); 3274 return new (_SplayTreeKeyIterator$(K))(this[_tree]);
3288 } 3275 }
3289 [core.$toSet]() { 3276 [core.$toSet]() {
3290 let setOrMap = this[_tree]; 3277 let setOrMap = this[_tree];
3291 let set = new (SplayTreeSet$(K))(dart.as(setOrMap[_comparator], __CastTy pe20), dart.as(setOrMap[_validKey], __CastType23)); 3278 let set = new (SplayTreeSet$(K))(dart.as(setOrMap[_comparator], __CastTy pe23), dart.as(setOrMap[_validKey], __CastType26));
3292 set[_count] = this[_tree][_count]; 3279 set[_count] = this[_tree][_count];
3293 set[_root] = set[_copyNode](this[_tree][_root]); 3280 set[_root] = set[_copyNode](this[_tree][_root]);
3294 return set; 3281 return set;
3295 } 3282 }
3296 } 3283 }
3297 _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength]; 3284 _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength];
3298 return _SplayTreeKeyIterable; 3285 return _SplayTreeKeyIterable;
3299 }); 3286 });
3300 let _SplayTreeKeyIterable = _SplayTreeKeyIterable$(); 3287 let _SplayTreeKeyIterable = _SplayTreeKeyIterable$();
3301 let _SplayTreeValueIterable$ = dart.generic(function(K, V) { 3288 let _SplayTreeValueIterable$ = dart.generic(function(K, V) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
3440 } 3427 }
3441 } 3428 }
3442 } 3429 }
3443 removeAll(elements) { 3430 removeAll(elements) {
3444 for (let element of elements) { 3431 for (let element of elements) {
3445 if (dart.dcall(this[_validKey], element)) 3432 if (dart.dcall(this[_validKey], element))
3446 this[_remove](dart.as(element, E)); 3433 this[_remove](dart.as(element, E));
3447 } 3434 }
3448 } 3435 }
3449 retainAll(elements) { 3436 retainAll(elements) {
3450 let retainSet = new (SplayTreeSet$(E))(dart.as(this[_comparator], __Cast Type25), this[_validKey]); 3437 let retainSet = new (SplayTreeSet$(E))(dart.as(this[_comparator], __Cast Type28), this[_validKey]);
3451 let modificationCount = this[_modificationCount]; 3438 let modificationCount = this[_modificationCount];
3452 for (let object of elements) { 3439 for (let object of elements) {
3453 if (modificationCount != this[_modificationCount]) { 3440 if (modificationCount != this[_modificationCount]) {
3454 throw new core.ConcurrentModificationError(this); 3441 throw new core.ConcurrentModificationError(this);
3455 } 3442 }
3456 if (dart.notNull(dart.dcall(this[_validKey], object)) && this[_splay]( dart.as(object, E)) == 0) 3443 if (dart.notNull(dart.dcall(this[_validKey], object)) && this[_splay]( dart.as(object, E)) == 0)
3457 retainSet.add(this[_root].key); 3444 retainSet.add(this[_root].key);
3458 } 3445 }
3459 if (retainSet[_count] != this[_count]) { 3446 if (retainSet[_count] != this[_count]) {
3460 this[_root] = retainSet[_root]; 3447 this[_root] = retainSet[_root];
3461 this[_count] = retainSet[_count]; 3448 this[_count] = retainSet[_count];
3462 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3449 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3463 } 3450 }
3464 } 3451 }
3465 lookup(object) { 3452 lookup(object) {
3466 if (!dart.notNull(dart.dcall(this[_validKey], object))) 3453 if (!dart.notNull(dart.dcall(this[_validKey], object)))
3467 return null; 3454 return null;
3468 let comp = this[_splay](dart.as(object, E)); 3455 let comp = this[_splay](dart.as(object, E));
3469 if (comp != 0) 3456 if (comp != 0)
3470 return null; 3457 return null;
3471 return this[_root].key; 3458 return this[_root].key;
3472 } 3459 }
3473 intersection(other) { 3460 intersection(other) {
3474 dart.as(other, core.Set$(E));
3475 let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.func tionType(core.int, [E, E])), this[_validKey]); 3461 let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.func tionType(core.int, [E, E])), this[_validKey]);
3476 for (let element of this) { 3462 for (let element of this) {
3477 if (other[core.$contains](element)) 3463 if (other[core.$contains](element))
3478 result.add(element); 3464 result.add(element);
3479 } 3465 }
3480 return result; 3466 return result;
3481 } 3467 }
3482 difference(other) { 3468 difference(other) {
3483 dart.as(other, core.Set$(E));
3484 let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.func tionType(core.int, [E, E])), this[_validKey]); 3469 let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.func tionType(core.int, [E, E])), this[_validKey]);
3485 for (let element of this) { 3470 for (let element of this) {
3486 if (!dart.notNull(other[core.$contains](element))) 3471 if (!dart.notNull(other[core.$contains](element)))
3487 result.add(element); 3472 result.add(element);
3488 } 3473 }
3489 return result; 3474 return result;
3490 } 3475 }
3491 union(other) { 3476 union(other) {
3492 dart.as(other, core.Set$(E)); 3477 dart.as(other, core.Set$(E));
3493 let _ = this[_clone](); 3478 let _ = this[_clone]();
(...skipping 22 matching lines...) Expand all
3516 return this[_clone](); 3501 return this[_clone]();
3517 } 3502 }
3518 toString() { 3503 toString() {
3519 return IterableBase.iterableToFullString(this, '{', '}'); 3504 return IterableBase.iterableToFullString(this, '{', '}');
3520 } 3505 }
3521 } 3506 }
3522 dart.defineNamedConstructor(SplayTreeSet, 'from'); 3507 dart.defineNamedConstructor(SplayTreeSet, 'from');
3523 return SplayTreeSet; 3508 return SplayTreeSet;
3524 }); 3509 });
3525 let SplayTreeSet = SplayTreeSet$(); 3510 let SplayTreeSet = SplayTreeSet$();
3526 let __CastType20$ = dart.generic(function(K) { 3511 let __CastType23$ = dart.generic(function(K) {
3527 let __CastType20 = dart.typedef('__CastType20', () => dart.functionType(core .int, [K, K])); 3512 let __CastType23 = dart.typedef('__CastType23', () => dart.functionType(core .int, [K, K]));
3528 return __CastType20; 3513 return __CastType23;
3529 }); 3514 });
3530 let __CastType20 = __CastType20$(); 3515 let __CastType23 = __CastType23$();
3531 let __CastType23 = dart.typedef('__CastType23', () => dart.functionType(core.b ool, [dart.dynamic])); 3516 let __CastType26 = dart.typedef('__CastType26', () => dart.functionType(core.b ool, [dart.dynamic]));
3532 let __CastType25$ = dart.generic(function(E) { 3517 let __CastType28$ = dart.generic(function(E) {
3533 let __CastType25 = dart.typedef('__CastType25', () => dart.functionType(core .int, [E, E])); 3518 let __CastType28 = dart.typedef('__CastType28', () => dart.functionType(core .int, [E, E]));
3534 return __CastType25; 3519 return __CastType28;
3535 }); 3520 });
3536 let __CastType25 = __CastType25$(); 3521 let __CastType28 = __CastType28$();
3537 let _strings = Symbol('_strings'); 3522 let _strings = Symbol('_strings');
3538 let _nums = Symbol('_nums'); 3523 let _nums = Symbol('_nums');
3539 let _rest = Symbol('_rest'); 3524 let _rest = Symbol('_rest');
3540 let _containsKey = Symbol('_containsKey'); 3525 let _containsKey = Symbol('_containsKey');
3541 let _getBucket = Symbol('_getBucket'); 3526 let _getBucket = Symbol('_getBucket');
3542 let _findBucketIndex = Symbol('_findBucketIndex'); 3527 let _findBucketIndex = Symbol('_findBucketIndex');
3543 let _computeKeys = Symbol('_computeKeys'); 3528 let _computeKeys = Symbol('_computeKeys');
3544 let _get = Symbol('_get'); 3529 let _get = Symbol('_get');
3545 let _addHashTableEntry = Symbol('_addHashTableEntry'); 3530 let _addHashTableEntry = Symbol('_addHashTableEntry');
3546 let _set = Symbol('_set'); 3531 let _set = Symbol('_set');
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
5179 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; 5164 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$;
5180 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; 5165 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable;
5181 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; 5166 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$;
5182 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; 5167 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator;
5183 exports.HashSetIterator$ = HashSetIterator$; 5168 exports.HashSetIterator$ = HashSetIterator$;
5184 exports.HashSetIterator = HashSetIterator; 5169 exports.HashSetIterator = HashSetIterator;
5185 exports.LinkedHashSetCell = LinkedHashSetCell; 5170 exports.LinkedHashSetCell = LinkedHashSetCell;
5186 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; 5171 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$;
5187 exports.LinkedHashSetIterator = LinkedHashSetIterator; 5172 exports.LinkedHashSetIterator = LinkedHashSetIterator;
5188 })(collection || (collection = {})); 5173 })(collection || (collection = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698