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

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

Issue 1096583002: Reifier hookup (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Address comments Created 5 years, 8 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/convert.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 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 super.UnmodifiableListBase(); 9 super.UnmodifiableListBase();
10 } 10 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class HashMap extends core.Object { 42 class HashMap extends core.Object {
43 HashMap(opts) { 43 HashMap(opts) {
44 let equals = opts && 'equals' in opts ? opts.equals : null; 44 let equals = opts && 'equals' in opts ? opts.equals : null;
45 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null; 45 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
46 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null; 46 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
47 if (isValidKey == null) { 47 if (isValidKey == null) {
48 if (hashCode == null) { 48 if (hashCode == null) {
49 if (equals == null) { 49 if (equals == null) {
50 return new (_HashMap$(K, V))(); 50 return new (_HashMap$(K, V))();
51 } 51 }
52 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] )); 52 hashCode = dart.as(_defaultHashCode, __CastType0);
53 } else { 53 } else {
54 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { 54 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) {
55 return new (_IdentityHashMap$(K, V))(); 55 return new (_IdentityHashMap$(K, V))();
56 } 56 }
57 if (equals == null) { 57 if (equals == null) {
58 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K])); 58 equals = dart.as(_defaultEquals, __CastType2);
59 } 59 }
60 } 60 }
61 } else { 61 } else {
62 if (hashCode == null) { 62 if (hashCode == null) {
63 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] )); 63 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] ));
64 } 64 }
65 if (equals == null) { 65 if (equals == null) {
66 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K] )); 66 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K] ));
67 } 67 }
68 } 68 }
(...skipping 23 matching lines...) Expand all
92 } 92 }
93 } 93 }
94 HashMap[dart.implements] = () => [core.Map$(K, V)]; 94 HashMap[dart.implements] = () => [core.Map$(K, V)];
95 dart.defineNamedConstructor(HashMap, 'identity'); 95 dart.defineNamedConstructor(HashMap, 'identity');
96 dart.defineNamedConstructor(HashMap, 'from'); 96 dart.defineNamedConstructor(HashMap, 'from');
97 dart.defineNamedConstructor(HashMap, 'fromIterable'); 97 dart.defineNamedConstructor(HashMap, 'fromIterable');
98 dart.defineNamedConstructor(HashMap, 'fromIterables'); 98 dart.defineNamedConstructor(HashMap, 'fromIterables');
99 return HashMap; 99 return HashMap;
100 }); 100 });
101 let HashMap = HashMap$(); 101 let HashMap = HashMap$();
102 let __CastType0$ = dart.generic(function(K) {
103 let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.i nt, [K]));
104 return __CastType0;
105 });
106 let __CastType0 = __CastType0$();
107 let __CastType2$ = dart.generic(function(K) {
108 let __CastType2 = dart.typedef('__CastType2', () => dart.functionType(core.b ool, [K, K]));
109 return __CastType2;
110 });
111 let __CastType2 = __CastType2$();
102 let _newSet = Symbol('_newSet'); 112 let _newSet = Symbol('_newSet');
103 let SetMixin$ = dart.generic(function(E) { 113 let SetMixin$ = dart.generic(function(E) {
104 class SetMixin extends core.Object { 114 class SetMixin extends core.Object {
105 get [core.$isEmpty]() { 115 get [core.$isEmpty]() {
106 return this[core.$length] == 0; 116 return this[core.$length] == 0;
107 } 117 }
108 get [core.$isNotEmpty]() { 118 get [core.$isNotEmpty]() {
109 return this[core.$length] != 0; 119 return this[core.$length] != 0;
110 } 120 }
111 clear() { 121 clear() {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 class HashSet extends core.Object { 403 class HashSet extends core.Object {
394 HashSet(opts) { 404 HashSet(opts) {
395 let equals = opts && 'equals' in opts ? opts.equals : null; 405 let equals = opts && 'equals' in opts ? opts.equals : null;
396 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null; 406 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
397 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null; 407 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
398 if (isValidKey == null) { 408 if (isValidKey == null) {
399 if (hashCode == null) { 409 if (hashCode == null) {
400 if (equals == null) { 410 if (equals == null) {
401 return new (_HashSet$(E))(); 411 return new (_HashSet$(E))();
402 } 412 }
403 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] )); 413 hashCode = dart.as(_defaultHashCode, __CastType5);
404 } else { 414 } else {
405 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { 415 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) {
406 return new (_IdentityHashSet$(E))(); 416 return new (_IdentityHashSet$(E))();
407 } 417 }
408 if (equals == null) { 418 if (equals == null) {
409 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E])); 419 equals = dart.as(_defaultEquals, __CastType7);
410 } 420 }
411 } 421 }
412 } else { 422 } else {
413 if (hashCode == null) { 423 if (hashCode == null) {
414 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] )); 424 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] ));
415 } 425 }
416 if (equals == null) { 426 if (equals == null) {
417 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E] )); 427 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E] ));
418 } 428 }
419 } 429 }
420 return new (_CustomHashSet$(E))(equals, hashCode, isValidKey); 430 return new (_CustomHashSet$(E))(equals, hashCode, isValidKey);
421 } 431 }
422 identity() { 432 identity() {
423 return new (_IdentityHashSet$(E))(); 433 return new (_IdentityHashSet$(E))();
424 } 434 }
425 from(elements) { 435 from(elements) {
426 let result = new (HashSet$(E))(); 436 let result = new (HashSet$(E))();
427 for (let e of dart.as(elements, core.Iterable$(E))) 437 for (let e of dart.as(elements, core.Iterable$(E)))
428 result.add(e); 438 result.add(e);
429 return result; 439 return result;
430 } 440 }
431 } 441 }
432 HashSet[dart.implements] = () => [core.Set$(E)]; 442 HashSet[dart.implements] = () => [core.Set$(E)];
433 dart.defineNamedConstructor(HashSet, 'identity'); 443 dart.defineNamedConstructor(HashSet, 'identity');
434 dart.defineNamedConstructor(HashSet, 'from'); 444 dart.defineNamedConstructor(HashSet, 'from');
435 return HashSet; 445 return HashSet;
436 }); 446 });
437 let HashSet = HashSet$(); 447 let HashSet = HashSet$();
448 let __CastType5$ = dart.generic(function(E) {
449 let __CastType5 = dart.typedef('__CastType5', () => dart.functionType(core.i nt, [E]));
450 return __CastType5;
451 });
452 let __CastType5 = __CastType5$();
453 let __CastType7$ = dart.generic(function(E) {
454 let __CastType7 = dart.typedef('__CastType7', () => dart.functionType(core.b ool, [E, E]));
455 return __CastType7;
456 });
457 let __CastType7 = __CastType7$();
438 let IterableMixin$ = dart.generic(function(E) { 458 let IterableMixin$ = dart.generic(function(E) {
439 class IterableMixin extends core.Object { 459 class IterableMixin extends core.Object {
440 [core.$map](f) { 460 [core.$map](f) {
441 return new (_internal.MappedIterable$(E, dart.dynamic))(this, f); 461 return new (_internal.MappedIterable$(E, dart.dynamic))(this, f);
442 } 462 }
443 [core.$where](f) { 463 [core.$where](f) {
444 return new (_internal.WhereIterable$(E))(this, f); 464 return new (_internal.WhereIterable$(E))(this, f);
445 } 465 }
446 [core.$expand](f) { 466 [core.$expand](f) {
447 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f); 467 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 class LinkedHashMap extends core.Object { 1032 class LinkedHashMap extends core.Object {
1013 LinkedHashMap(opts) { 1033 LinkedHashMap(opts) {
1014 let equals = opts && 'equals' in opts ? opts.equals : null; 1034 let equals = opts && 'equals' in opts ? opts.equals : null;
1015 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null; 1035 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
1016 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null; 1036 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
1017 if (isValidKey == null) { 1037 if (isValidKey == null) {
1018 if (hashCode == null) { 1038 if (hashCode == null) {
1019 if (equals == null) { 1039 if (equals == null) {
1020 return new (_LinkedHashMap$(K, V))(); 1040 return new (_LinkedHashMap$(K, V))();
1021 } 1041 }
1022 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] )); 1042 hashCode = dart.as(_defaultHashCode, __CastType10);
1023 } else { 1043 } else {
1024 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { 1044 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) {
1025 return new (_LinkedIdentityHashMap$(K, V))(); 1045 return new (_LinkedIdentityHashMap$(K, V))();
1026 } 1046 }
1027 if (equals == null) { 1047 if (equals == null) {
1028 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K])); 1048 equals = dart.as(_defaultEquals, __CastType12);
1029 } 1049 }
1030 } 1050 }
1031 } else { 1051 } else {
1032 if (hashCode == null) { 1052 if (hashCode == null) {
1033 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] )); 1053 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] ));
1034 } 1054 }
1035 if (equals == null) { 1055 if (equals == null) {
1036 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K] )); 1056 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K] ));
1037 } 1057 }
1038 } 1058 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 LinkedHashMap[dart.implements] = () => [HashMap$(K, V)]; 1090 LinkedHashMap[dart.implements] = () => [HashMap$(K, V)];
1071 dart.defineNamedConstructor(LinkedHashMap, 'identity'); 1091 dart.defineNamedConstructor(LinkedHashMap, 'identity');
1072 dart.defineNamedConstructor(LinkedHashMap, 'from'); 1092 dart.defineNamedConstructor(LinkedHashMap, 'from');
1073 dart.defineNamedConstructor(LinkedHashMap, 'fromIterable'); 1093 dart.defineNamedConstructor(LinkedHashMap, 'fromIterable');
1074 dart.defineNamedConstructor(LinkedHashMap, 'fromIterables'); 1094 dart.defineNamedConstructor(LinkedHashMap, 'fromIterables');
1075 dart.defineNamedConstructor(LinkedHashMap, _literal); 1095 dart.defineNamedConstructor(LinkedHashMap, _literal);
1076 dart.defineNamedConstructor(LinkedHashMap, _empty); 1096 dart.defineNamedConstructor(LinkedHashMap, _empty);
1077 return LinkedHashMap; 1097 return LinkedHashMap;
1078 }); 1098 });
1079 let LinkedHashMap = LinkedHashMap$(); 1099 let LinkedHashMap = LinkedHashMap$();
1100 let __CastType10$ = dart.generic(function(K) {
1101 let __CastType10 = dart.typedef('__CastType10', () => dart.functionType(core .int, [K]));
1102 return __CastType10;
1103 });
1104 let __CastType10 = __CastType10$();
1105 let __CastType12$ = dart.generic(function(K) {
1106 let __CastType12 = dart.typedef('__CastType12', () => dart.functionType(core .bool, [K, K]));
1107 return __CastType12;
1108 });
1109 let __CastType12 = __CastType12$();
1080 let LinkedHashSet$ = dart.generic(function(E) { 1110 let LinkedHashSet$ = dart.generic(function(E) {
1081 class LinkedHashSet extends core.Object { 1111 class LinkedHashSet extends core.Object {
1082 LinkedHashSet(opts) { 1112 LinkedHashSet(opts) {
1083 let equals = opts && 'equals' in opts ? opts.equals : null; 1113 let equals = opts && 'equals' in opts ? opts.equals : null;
1084 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null; 1114 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
1085 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null; 1115 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
1086 if (isValidKey == null) { 1116 if (isValidKey == null) {
1087 if (hashCode == null) { 1117 if (hashCode == null) {
1088 if (equals == null) { 1118 if (equals == null) {
1089 return new (_LinkedHashSet$(E))(); 1119 return new (_LinkedHashSet$(E))();
1090 } 1120 }
1091 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] )); 1121 hashCode = dart.as(_defaultHashCode, __CastType15);
1092 } else { 1122 } else {
1093 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { 1123 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) {
1094 return new (_LinkedIdentityHashSet$(E))(); 1124 return new (_LinkedIdentityHashSet$(E))();
1095 } 1125 }
1096 if (equals == null) { 1126 if (equals == null) {
1097 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E])); 1127 equals = dart.as(_defaultEquals, __CastType17);
1098 } 1128 }
1099 } 1129 }
1100 } else { 1130 } else {
1101 if (hashCode == null) { 1131 if (hashCode == null) {
1102 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] )); 1132 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] ));
1103 } 1133 }
1104 if (equals == null) { 1134 if (equals == null) {
1105 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E] )); 1135 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E] ));
1106 } 1136 }
1107 } 1137 }
1108 return new (_LinkedCustomHashSet$(E))(equals, hashCode, isValidKey); 1138 return new (_LinkedCustomHashSet$(E))(equals, hashCode, isValidKey);
1109 } 1139 }
1110 identity() { 1140 identity() {
1111 return new (_LinkedIdentityHashSet$(E))(); 1141 return new (_LinkedIdentityHashSet$(E))();
1112 } 1142 }
1113 from(elements) { 1143 from(elements) {
1114 let result = new (LinkedHashSet$(E))(); 1144 let result = new (LinkedHashSet$(E))();
1115 for (let element of elements) { 1145 for (let element of elements) {
1116 result.add(element); 1146 result.add(element);
1117 } 1147 }
1118 return result; 1148 return result;
1119 } 1149 }
1120 } 1150 }
1121 LinkedHashSet[dart.implements] = () => [HashSet$(E)]; 1151 LinkedHashSet[dart.implements] = () => [HashSet$(E)];
1122 dart.defineNamedConstructor(LinkedHashSet, 'identity'); 1152 dart.defineNamedConstructor(LinkedHashSet, 'identity');
1123 dart.defineNamedConstructor(LinkedHashSet, 'from'); 1153 dart.defineNamedConstructor(LinkedHashSet, 'from');
1124 return LinkedHashSet; 1154 return LinkedHashSet;
1125 }); 1155 });
1126 let LinkedHashSet = LinkedHashSet$(); 1156 let LinkedHashSet = LinkedHashSet$();
1157 let __CastType15$ = dart.generic(function(E) {
1158 let __CastType15 = dart.typedef('__CastType15', () => dart.functionType(core .int, [E]));
1159 return __CastType15;
1160 });
1161 let __CastType15 = __CastType15$();
1162 let __CastType17$ = dart.generic(function(E) {
1163 let __CastType17 = dart.typedef('__CastType17', () => dart.functionType(core .bool, [E, E]));
1164 return __CastType17;
1165 });
1166 let __CastType17 = __CastType17$();
1127 let _modificationCount = Symbol('_modificationCount'); 1167 let _modificationCount = Symbol('_modificationCount');
1128 let _length = Symbol('_length'); 1168 let _length = Symbol('_length');
1129 let _next = Symbol('_next'); 1169 let _next = Symbol('_next');
1130 let _previous = Symbol('_previous'); 1170 let _previous = Symbol('_previous');
1131 let _insertAfter = Symbol('_insertAfter'); 1171 let _insertAfter = Symbol('_insertAfter');
1132 let _list = Symbol('_list'); 1172 let _list = Symbol('_list');
1133 let _unlink = Symbol('_unlink'); 1173 let _unlink = Symbol('_unlink');
1134 let LinkedList$ = dart.generic(function(E) { 1174 let LinkedList$ = dart.generic(function(E) {
1135 class LinkedList extends IterableBase$(E) { 1175 class LinkedList extends IterableBase$(E) {
1136 LinkedList() { 1176 LinkedList() {
1137 this[_modificationCount] = 0; 1177 this[_modificationCount] = 0;
1138 this[_length] = 0; 1178 this[_length] = 0;
1139 this[_next] = null; 1179 this[_next] = null;
1140 this[_previous] = null; 1180 this[_previous] = null;
1141 super.IterableBase(); 1181 super.IterableBase();
1142 this[_next] = this[_previous] = this; 1182 this[_next] = this[_previous] = this;
1143 } 1183 }
1144 addFirst(entry) { 1184 addFirst(entry) {
1145 this[_insertAfter](this, entry); 1185 this[_insertAfter](this, entry);
1146 } 1186 }
1147 add(entry) { 1187 add(entry) {
1148 this[_insertAfter](this[_previous], entry); 1188 this[_insertAfter](this[_previous], entry);
1149 } 1189 }
1150 addAll(entries) { 1190 addAll(entries) {
1151 entries[core.$forEach](dart.as((entry => this[_insertAfter](this[_previo us], dart.as(entry, E))).bind(this), dart.functionType(dart.void, [E]))); 1191 entries[core.$forEach]((entry => this[_insertAfter](this[_previous], dar t.as(entry, E))).bind(this));
1152 } 1192 }
1153 remove(entry) { 1193 remove(entry) {
1154 if (!dart.equals(entry[_list], this)) 1194 if (!dart.equals(entry[_list], this))
1155 return false; 1195 return false;
1156 this[_unlink](entry); 1196 this[_unlink](entry);
1157 return true; 1197 return true;
1158 } 1198 }
1159 get [core.$iterator]() { 1199 get [core.$iterator]() {
1160 return new (_LinkedListIterator$(E))(this); 1200 return new (_LinkedListIterator$(E))(this);
1161 } 1201 }
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 let _elementCount = Symbol('_elementCount'); 2204 let _elementCount = Symbol('_elementCount');
2165 let DoubleLinkedQueue$ = dart.generic(function(E) { 2205 let DoubleLinkedQueue$ = dart.generic(function(E) {
2166 class DoubleLinkedQueue extends IterableBase$(E) { 2206 class DoubleLinkedQueue extends IterableBase$(E) {
2167 DoubleLinkedQueue() { 2207 DoubleLinkedQueue() {
2168 this[_sentinel] = null; 2208 this[_sentinel] = null;
2169 this[_elementCount] = 0; 2209 this[_elementCount] = 0;
2170 super.IterableBase(); 2210 super.IterableBase();
2171 this[_sentinel] = new (_DoubleLinkedQueueEntrySentinel$(E))(); 2211 this[_sentinel] = new (_DoubleLinkedQueueEntrySentinel$(E))();
2172 } 2212 }
2173 from(elements) { 2213 from(elements) {
2174 let list = dart.as(new DoubleLinkedQueue(), Queue$(E)); 2214 let list = new (DoubleLinkedQueue$(E))();
2175 for (let e of dart.as(elements, core.Iterable$(E))) { 2215 for (let e of dart.as(elements, core.Iterable$(E))) {
2176 list.addLast(e); 2216 list.addLast(e);
2177 } 2217 }
2178 return dart.as(list, DoubleLinkedQueue$(E)); 2218 return dart.as(list, DoubleLinkedQueue$(E));
2179 } 2219 }
2180 get [core.$length]() { 2220 get [core.$length]() {
2181 return this[_elementCount]; 2221 return this[_elementCount];
2182 } 2222 }
2183 addLast(value) { 2223 addLast(value) {
2184 this[_sentinel].prepend(value); 2224 this[_sentinel].prepend(value);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 initialCapacity = ListQueue[_INITIAL_CAPACITY]; 2376 initialCapacity = ListQueue[_INITIAL_CAPACITY];
2337 } else if (!dart.notNull(ListQueue[_isPowerOf2](initialCapacity))) { 2377 } else if (!dart.notNull(ListQueue[_isPowerOf2](initialCapacity))) {
2338 initialCapacity = ListQueue[_nextPowerOf2](initialCapacity); 2378 initialCapacity = ListQueue[_nextPowerOf2](initialCapacity);
2339 } 2379 }
2340 dart.assert(ListQueue[_isPowerOf2](initialCapacity)); 2380 dart.assert(ListQueue[_isPowerOf2](initialCapacity));
2341 this[_table] = new (core.List$(E))(initialCapacity); 2381 this[_table] = new (core.List$(E))(initialCapacity);
2342 } 2382 }
2343 from(elements) { 2383 from(elements) {
2344 if (dart.is(elements, core.List)) { 2384 if (dart.is(elements, core.List)) {
2345 let length = elements[core.$length]; 2385 let length = elements[core.$length];
2346 let queue = dart.as(new ListQueue(dart.notNull(length) + 1), ListQueue $(E)); 2386 let queue = new (ListQueue$(E))(dart.notNull(length) + 1);
2347 dart.assert(dart.notNull(queue[_table][core.$length]) > dart.notNull(l ength)); 2387 dart.assert(dart.notNull(queue[_table][core.$length]) > dart.notNull(l ength));
2348 let sourceList = elements; 2388 let sourceList = elements;
2349 queue[_table][core.$setRange](0, length, dart.as(sourceList, core.Iter able$(E)), 0); 2389 queue[_table][core.$setRange](0, length, dart.as(sourceList, core.Iter able$(E)), 0);
2350 queue[_tail] = length; 2390 queue[_tail] = length;
2351 return queue; 2391 return queue;
2352 } else { 2392 } else {
2353 let capacity = ListQueue[_INITIAL_CAPACITY]; 2393 let capacity = ListQueue[_INITIAL_CAPACITY];
2354 if (dart.is(elements, _internal.EfficientLength)) { 2394 if (dart.is(elements, _internal.EfficientLength)) {
2355 capacity = elements[core.$length]; 2395 capacity = elements[core.$length];
2356 } 2396 }
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 } 2933 }
2894 set(key, value) { 2934 set(key, value) {
2895 if (key == null) 2935 if (key == null)
2896 throw new core.ArgumentError(key); 2936 throw new core.ArgumentError(key);
2897 let comp = this[_splay](key); 2937 let comp = this[_splay](key);
2898 if (comp == 0) { 2938 if (comp == 0) {
2899 let mapRoot = dart.as(this[_root], _SplayTreeMapNode); 2939 let mapRoot = dart.as(this[_root], _SplayTreeMapNode);
2900 mapRoot.value = value; 2940 mapRoot.value = value;
2901 return; 2941 return;
2902 } 2942 }
2903 this[_addNewRoot](dart.as(new _SplayTreeMapNode(key, value), _SplayTreeN ode$(K)), comp); 2943 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value), comp);
2904 } 2944 }
2905 putIfAbsent(key, ifAbsent) { 2945 putIfAbsent(key, ifAbsent) {
2906 if (key == null) 2946 if (key == null)
2907 throw new core.ArgumentError(key); 2947 throw new core.ArgumentError(key);
2908 let comp = this[_splay](key); 2948 let comp = this[_splay](key);
2909 if (comp == 0) { 2949 if (comp == 0) {
2910 let mapRoot = dart.as(this[_root], _SplayTreeMapNode); 2950 let mapRoot = dart.as(this[_root], _SplayTreeMapNode);
2911 return dart.as(mapRoot.value, V); 2951 return dart.as(mapRoot.value, V);
2912 } 2952 }
2913 let modificationCount = this[_modificationCount]; 2953 let modificationCount = this[_modificationCount];
2914 let splayCount = this[_splayCount]; 2954 let splayCount = this[_splayCount];
2915 let value = ifAbsent(); 2955 let value = ifAbsent();
2916 if (modificationCount != this[_modificationCount]) { 2956 if (modificationCount != this[_modificationCount]) {
2917 throw new core.ConcurrentModificationError(this); 2957 throw new core.ConcurrentModificationError(this);
2918 } 2958 }
2919 if (splayCount != this[_splayCount]) { 2959 if (splayCount != this[_splayCount]) {
2920 comp = this[_splay](key); 2960 comp = this[_splay](key);
2921 dart.assert(comp != 0); 2961 dart.assert(comp != 0);
2922 } 2962 }
2923 this[_addNewRoot](dart.as(new _SplayTreeMapNode(key, value), _SplayTreeN ode$(K)), comp); 2963 this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value), comp);
2924 return value; 2964 return value;
2925 } 2965 }
2926 addAll(other) { 2966 addAll(other) {
2927 other.forEach(((key, value) => { 2967 other.forEach(((key, value) => {
2928 this.set(key, value); 2968 this.set(key, value);
2929 }).bind(this)); 2969 }).bind(this));
2930 } 2970 }
2931 get isEmpty() { 2971 get isEmpty() {
2932 return this[_root] == null; 2972 return this[_root] == null;
2933 } 2973 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 return this[_tree][_count]; 3155 return this[_tree][_count];
3116 } 3156 }
3117 get [core.$isEmpty]() { 3157 get [core.$isEmpty]() {
3118 return this[_tree][_count] == 0; 3158 return this[_tree][_count] == 0;
3119 } 3159 }
3120 get [core.$iterator]() { 3160 get [core.$iterator]() {
3121 return new (_SplayTreeKeyIterator$(K))(this[_tree]); 3161 return new (_SplayTreeKeyIterator$(K))(this[_tree]);
3122 } 3162 }
3123 [core.$toSet]() { 3163 [core.$toSet]() {
3124 let setOrMap = this[_tree]; 3164 let setOrMap = this[_tree];
3125 let set = new (SplayTreeSet$(K))(dart.as(setOrMap[_comparator], dart.fun ctionType(core.int, [K, K])), dart.as(setOrMap[_validKey], dart.functionType(cor e.bool, [dart.dynamic]))); 3165 let set = new (SplayTreeSet$(K))(dart.as(setOrMap[_comparator], __CastTy pe20), dart.as(setOrMap[_validKey], __CastType23));
3126 set[_count] = this[_tree][_count]; 3166 set[_count] = this[_tree][_count];
3127 set[_root] = set[_copyNode](this[_tree][_root]); 3167 set[_root] = set[_copyNode](this[_tree][_root]);
3128 return set; 3168 return set;
3129 } 3169 }
3130 } 3170 }
3131 _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength]; 3171 _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength];
3132 return _SplayTreeKeyIterable; 3172 return _SplayTreeKeyIterable;
3133 }); 3173 });
3134 let _SplayTreeKeyIterable = _SplayTreeKeyIterable$(); 3174 let _SplayTreeKeyIterable = _SplayTreeKeyIterable$();
3135 let _SplayTreeValueIterable$ = dart.generic(function(K, V) { 3175 let _SplayTreeValueIterable$ = dart.generic(function(K, V) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 throw _internal.IterableElementError.tooMany(); 3287 throw _internal.IterableElementError.tooMany();
3248 return this[_root].key; 3288 return this[_root].key;
3249 } 3289 }
3250 [core.$contains](object) { 3290 [core.$contains](object) {
3251 return dart.notNull(dart.dcall(this[_validKey], object)) && this[_splay] (dart.as(object, E)) == 0; 3291 return dart.notNull(dart.dcall(this[_validKey], object)) && this[_splay] (dart.as(object, E)) == 0;
3252 } 3292 }
3253 add(element) { 3293 add(element) {
3254 let compare = this[_splay](element); 3294 let compare = this[_splay](element);
3255 if (compare == 0) 3295 if (compare == 0)
3256 return false; 3296 return false;
3257 this[_addNewRoot](dart.as(new _SplayTreeNode(element), _SplayTreeNode$(E )), compare); 3297 this[_addNewRoot](new (_SplayTreeNode$(E))(element), compare);
3258 return true; 3298 return true;
3259 } 3299 }
3260 remove(object) { 3300 remove(object) {
3261 if (!dart.notNull(dart.dcall(this[_validKey], object))) 3301 if (!dart.notNull(dart.dcall(this[_validKey], object)))
3262 return false; 3302 return false;
3263 return this[_remove](dart.as(object, E)) != null; 3303 return this[_remove](dart.as(object, E)) != null;
3264 } 3304 }
3265 addAll(elements) { 3305 addAll(elements) {
3266 for (let element of elements) { 3306 for (let element of elements) {
3267 let compare = this[_splay](element); 3307 let compare = this[_splay](element);
3268 if (compare != 0) { 3308 if (compare != 0) {
3269 this[_addNewRoot](dart.as(new _SplayTreeNode(element), _SplayTreeNod e$(E)), compare); 3309 this[_addNewRoot](new (_SplayTreeNode$(E))(element), compare);
3270 } 3310 }
3271 } 3311 }
3272 } 3312 }
3273 removeAll(elements) { 3313 removeAll(elements) {
3274 for (let element of elements) { 3314 for (let element of elements) {
3275 if (dart.dcall(this[_validKey], element)) 3315 if (dart.dcall(this[_validKey], element))
3276 this[_remove](dart.as(element, E)); 3316 this[_remove](dart.as(element, E));
3277 } 3317 }
3278 } 3318 }
3279 retainAll(elements) { 3319 retainAll(elements) {
3280 let retainSet = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.f unctionType(core.int, [E, E])), this[_validKey]); 3320 let retainSet = new (SplayTreeSet$(E))(dart.as(this[_comparator], __Cast Type25), this[_validKey]);
3281 let modificationCount = this[_modificationCount]; 3321 let modificationCount = this[_modificationCount];
3282 for (let object of elements) { 3322 for (let object of elements) {
3283 if (modificationCount != this[_modificationCount]) { 3323 if (modificationCount != this[_modificationCount]) {
3284 throw new core.ConcurrentModificationError(this); 3324 throw new core.ConcurrentModificationError(this);
3285 } 3325 }
3286 if (dart.notNull(dart.dcall(this[_validKey], object)) && this[_splay]( dart.as(object, E)) == 0) 3326 if (dart.notNull(dart.dcall(this[_validKey], object)) && this[_splay]( dart.as(object, E)) == 0)
3287 retainSet.add(this[_root].key); 3327 retainSet.add(this[_root].key);
3288 } 3328 }
3289 if (retainSet[_count] != this[_count]) { 3329 if (retainSet[_count] != this[_count]) {
3290 this[_root] = retainSet[_root]; 3330 this[_root] = retainSet[_root];
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3342 return this[_clone](); 3382 return this[_clone]();
3343 } 3383 }
3344 toString() { 3384 toString() {
3345 return IterableBase.iterableToFullString(this, '{', '}'); 3385 return IterableBase.iterableToFullString(this, '{', '}');
3346 } 3386 }
3347 } 3387 }
3348 dart.defineNamedConstructor(SplayTreeSet, 'from'); 3388 dart.defineNamedConstructor(SplayTreeSet, 'from');
3349 return SplayTreeSet; 3389 return SplayTreeSet;
3350 }); 3390 });
3351 let SplayTreeSet = SplayTreeSet$(); 3391 let SplayTreeSet = SplayTreeSet$();
3392 let __CastType20$ = dart.generic(function(K) {
3393 let __CastType20 = dart.typedef('__CastType20', () => dart.functionType(core .int, [K, K]));
3394 return __CastType20;
3395 });
3396 let __CastType20 = __CastType20$();
3397 let __CastType23 = dart.typedef('__CastType23', () => dart.functionType(core.b ool, [dart.dynamic]));
3398 let __CastType25$ = dart.generic(function(E) {
3399 let __CastType25 = dart.typedef('__CastType25', () => dart.functionType(core .int, [E, E]));
3400 return __CastType25;
3401 });
3402 let __CastType25 = __CastType25$();
3352 let _strings = Symbol('_strings'); 3403 let _strings = Symbol('_strings');
3353 let _nums = Symbol('_nums'); 3404 let _nums = Symbol('_nums');
3354 let _rest = Symbol('_rest'); 3405 let _rest = Symbol('_rest');
3355 let _isStringKey = Symbol('_isStringKey'); 3406 let _isStringKey = Symbol('_isStringKey');
3356 let _hasTableEntry = Symbol('_hasTableEntry'); 3407 let _hasTableEntry = Symbol('_hasTableEntry');
3357 let _isNumericKey = Symbol('_isNumericKey'); 3408 let _isNumericKey = Symbol('_isNumericKey');
3358 let _containsKey = Symbol('_containsKey'); 3409 let _containsKey = Symbol('_containsKey');
3359 let _getBucket = Symbol('_getBucket'); 3410 let _getBucket = Symbol('_getBucket');
3360 let _findBucketIndex = Symbol('_findBucketIndex'); 3411 let _findBucketIndex = Symbol('_findBucketIndex');
3361 let _computeKeys = Symbol('_computeKeys'); 3412 let _computeKeys = Symbol('_computeKeys');
(...skipping 21 matching lines...) Expand all
3383 get isEmpty() { 3434 get isEmpty() {
3384 return this[_length] == 0; 3435 return this[_length] == 0;
3385 } 3436 }
3386 get isNotEmpty() { 3437 get isNotEmpty() {
3387 return !dart.notNull(this.isEmpty); 3438 return !dart.notNull(this.isEmpty);
3388 } 3439 }
3389 get keys() { 3440 get keys() {
3390 return new (HashMapKeyIterable$(K))(this); 3441 return new (HashMapKeyIterable$(K))(this);
3391 } 3442 }
3392 get values() { 3443 get values() {
3393 return new (_internal.MappedIterable$(K, V))(this.keys, dart.as((each => this.get(each)).bind(this), dart.functionType(V, [K]))); 3444 return new (_internal.MappedIterable$(K, V))(this.keys, (each => this.ge t(each)).bind(this));
3394 } 3445 }
3395 containsKey(key) { 3446 containsKey(key) {
3396 if (_HashMap[_isStringKey](key)) { 3447 if (_HashMap[_isStringKey](key)) {
3397 let strings = this[_strings]; 3448 let strings = this[_strings];
3398 return strings == null ? false : _HashMap[_hasTableEntry](strings, key ); 3449 return strings == null ? false : _HashMap[_hasTableEntry](strings, key );
3399 } else if (_HashMap[_isNumericKey](key)) { 3450 } else if (_HashMap[_isNumericKey](key)) {
3400 let nums = this[_nums]; 3451 let nums = this[_nums];
3401 return nums == null ? false : _HashMap[_hasTableEntry](nums, key); 3452 return nums == null ? false : _HashMap[_hasTableEntry](nums, key);
3402 } else { 3453 } else {
3403 return this[_containsKey](key); 3454 return this[_containsKey](key);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
3784 get isEmpty() { 3835 get isEmpty() {
3785 return this[_length] == 0; 3836 return this[_length] == 0;
3786 } 3837 }
3787 get isNotEmpty() { 3838 get isNotEmpty() {
3788 return !dart.notNull(this.isEmpty); 3839 return !dart.notNull(this.isEmpty);
3789 } 3840 }
3790 get keys() { 3841 get keys() {
3791 return new (LinkedHashMapKeyIterable$(K))(this); 3842 return new (LinkedHashMapKeyIterable$(K))(this);
3792 } 3843 }
3793 get values() { 3844 get values() {
3794 return new (_internal.MappedIterable$(K, V))(this.keys, dart.as((each => this.get(each)).bind(this), dart.functionType(V, [K]))); 3845 return new (_internal.MappedIterable$(K, V))(this.keys, (each => this.ge t(each)).bind(this));
3795 } 3846 }
3796 containsKey(key) { 3847 containsKey(key) {
3797 if (_LinkedHashMap[_isStringKey](key)) { 3848 if (_LinkedHashMap[_isStringKey](key)) {
3798 let strings = this[_strings]; 3849 let strings = this[_strings];
3799 if (strings == null) 3850 if (strings == null)
3800 return false; 3851 return false;
3801 let cell = dart.as(_LinkedHashMap[_getTableEntry](strings, key), Linke dHashMapCell); 3852 let cell = dart.as(_LinkedHashMap[_getTableEntry](strings, key), Linke dHashMapCell);
3802 return cell != null; 3853 return cell != null;
3803 } else if (_LinkedHashMap[_isNumericKey](key)) { 3854 } else if (_LinkedHashMap[_isNumericKey](key)) {
3804 let nums = this[_nums]; 3855 let nums = this[_nums];
3805 if (nums == null) 3856 if (nums == null)
3806 return false; 3857 return false;
3807 let cell = dart.as(_LinkedHashMap[_getTableEntry](nums, key), LinkedHa shMapCell); 3858 let cell = dart.as(_LinkedHashMap[_getTableEntry](nums, key), LinkedHa shMapCell);
3808 return cell != null; 3859 return cell != null;
3809 } else { 3860 } else {
3810 return this[_containsKey](key); 3861 return this[_containsKey](key);
3811 } 3862 }
3812 } 3863 }
3813 [_containsKey](key) { 3864 [_containsKey](key) {
3814 let rest = this[_rest]; 3865 let rest = this[_rest];
3815 if (rest == null) 3866 if (rest == null)
3816 return false; 3867 return false;
3817 let bucket = this[_getBucket](rest, key); 3868 let bucket = this[_getBucket](rest, key);
3818 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; 3869 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0;
3819 } 3870 }
3820 containsValue(value) { 3871 containsValue(value) {
3821 return this.keys[core.$any](dart.as((each => dart.equals(this.get(each), value)).bind(this), dart.functionType(core.bool, [K]))); 3872 return this.keys[core.$any]((each => dart.equals(this.get(each), value)) .bind(this));
3822 } 3873 }
3823 addAll(other) { 3874 addAll(other) {
3824 other.forEach(((key, value) => { 3875 other.forEach(((key, value) => {
3825 this.set(key, value); 3876 this.set(key, value);
3826 }).bind(this)); 3877 }).bind(this));
3827 } 3878 }
3828 get(key) { 3879 get(key) {
3829 if (_LinkedHashMap[_isStringKey](key)) { 3880 if (_LinkedHashMap[_isStringKey](key)) {
3830 let strings = this[_strings]; 3881 let strings = this[_strings];
3831 if (strings == null) 3882 if (strings == null)
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
4521 this[_modifications] = 0; 4572 this[_modifications] = 0;
4522 super._HashSetBase(); 4573 super._HashSetBase();
4523 } 4574 }
4524 [_newSet]() { 4575 [_newSet]() {
4525 return new (_LinkedHashSet$(E))(); 4576 return new (_LinkedHashSet$(E))();
4526 } 4577 }
4527 [_unsupported](operation) { 4578 [_unsupported](operation) {
4528 throw `LinkedHashSet: unsupported ${operation}`; 4579 throw `LinkedHashSet: unsupported ${operation}`;
4529 } 4580 }
4530 get [core.$iterator]() { 4581 get [core.$iterator]() {
4531 return dart.as(new LinkedHashSetIterator(this, this[_modifications]), co re.Iterator$(E)); 4582 return new (LinkedHashSetIterator$(E))(this, this[_modifications]);
4532 } 4583 }
4533 get [core.$length]() { 4584 get [core.$length]() {
4534 return this[_length]; 4585 return this[_length];
4535 } 4586 }
4536 get [core.$isEmpty]() { 4587 get [core.$isEmpty]() {
4537 return this[_length] == 0; 4588 return this[_length] == 0;
4538 } 4589 }
4539 get [core.$isNotEmpty]() { 4590 get [core.$isNotEmpty]() {
4540 return !dart.notNull(this[core.$isEmpty]); 4591 return !dart.notNull(this[core.$isEmpty]);
4541 } 4592 }
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
4959 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; 5010 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$;
4960 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; 5011 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable;
4961 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; 5012 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$;
4962 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; 5013 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator;
4963 exports.HashSetIterator$ = HashSetIterator$; 5014 exports.HashSetIterator$ = HashSetIterator$;
4964 exports.HashSetIterator = HashSetIterator; 5015 exports.HashSetIterator = HashSetIterator;
4965 exports.LinkedHashSetCell = LinkedHashSetCell; 5016 exports.LinkedHashSetCell = LinkedHashSetCell;
4966 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; 5017 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$;
4967 exports.LinkedHashSetIterator = LinkedHashSetIterator; 5018 exports.LinkedHashSetIterator = LinkedHashSetIterator;
4968 })(collection || (collection = {})); 5019 })(collection || (collection = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/async.js ('k') | lib/runtime/dart/convert.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698