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

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

Issue 1076883003: Initial support for runtime function types and type checking (Closed) Base URL: https://github.com/dart-lang/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 }
11 get [core.$length]() { 11 get [core.$length]() {
12 return this[_source][core.$length]; 12 return this[_source][core.$length];
13 } 13 }
14 [core.$get](index) { 14 [core.$get](index) {
15 return this[_source][core.$elementAt](index); 15 return this[_source][core.$elementAt](index);
16 } 16 }
17 } 17 }
18 return UnmodifiableListView; 18 return UnmodifiableListView;
19 }); 19 });
20 dart.defineLazyClassGeneric(exports, 'UnmodifiableListView', {get: Unmodifiabl eListView$}); 20 dart.defineLazyClassGeneric(exports, 'UnmodifiableListView', {get: Unmodifiabl eListView$});
21 // Function _defaultEquals: (dynamic, dynamic) → bool 21 // Function _defaultEquals: (dynamic, dynamic) → bool
22 function _defaultEquals(a, b) { 22 function _defaultEquals(a, b) {
23 return dart.equals(a, b); 23 return dart.equals(a, b);
24 } 24 }
25 // Function _defaultHashCode: (dynamic) → int 25 // Function _defaultHashCode: (dynamic) → int
26 function _defaultHashCode(a) { 26 function _defaultHashCode(a) {
27 return a.hashCode; 27 return a.hashCode;
28 } 28 }
29 let _Equality$ = dart.generic(function(K) { 29 let _Equality$ = dart.generic(function(K) {
30 class _Equality extends core.Function {} 30 let _Equality = dart.typedef('_Equality', () => dart.functionType(core.bool, [K, K]));
31 return _Equality; 31 return _Equality;
32 }); 32 });
33 let _Equality = _Equality$(); 33 let _Equality = _Equality$();
34 let _Hasher$ = dart.generic(function(K) { 34 let _Hasher$ = dart.generic(function(K) {
35 class _Hasher extends core.Function {} 35 let _Hasher = dart.typedef('_Hasher', () => dart.functionType(core.int, [K]) );
36 return _Hasher; 36 return _Hasher;
37 }); 37 });
38 let _Hasher = _Hasher$(); 38 let _Hasher = _Hasher$();
39 let _fillMapWithMappedIterable = Symbol('_fillMapWithMappedIterable'); 39 let _fillMapWithMappedIterable = Symbol('_fillMapWithMappedIterable');
40 let _fillMapWithIterables = Symbol('_fillMapWithIterables'); 40 let _fillMapWithIterables = Symbol('_fillMapWithIterables');
41 let HashMap$ = dart.generic(function(K, V) { 41 let HashMap$ = dart.generic(function(K, V) {
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.throw_("Unimplemented type (K) → int")); 52 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] ));
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.throw_("Unimplemented type ( K, K) → bool")); 58 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K]));
59 } 59 }
60 } 60 }
61 } else { 61 } else {
62 if (hashCode == null) { 62 if (hashCode == null) {
63 hashCode = dart.as(_defaultHashCode, dart.throw_("Unimplemented type (K) → int")); 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.throw_("Unimplemented type (K, K) → bool")); 66 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K] ));
67 } 67 }
68 } 68 }
69 return new (_CustomHashMap$(K, V))(equals, hashCode, isValidKey); 69 return new (_CustomHashMap$(K, V))(equals, hashCode, isValidKey);
70 } 70 }
71 identity() { 71 identity() {
72 return new (_IdentityHashMap$(K, V))(); 72 return new (_IdentityHashMap$(K, V))();
73 } 73 }
74 from(other) { 74 from(other) {
75 let result = new (HashMap$(K, V))(); 75 let result = new (HashMap$(K, V))();
76 other.forEach((k, v) => { 76 other.forEach((k, v) => {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 let result = growable ? ((_) => { 176 let result = growable ? ((_) => {
177 _[core.$length] = this.length; 177 _[core.$length] = this.length;
178 return _; 178 return _;
179 }).bind(this)(new (core.List$(E))()) : new (core.List$(E))(this.length); 179 }).bind(this)(new (core.List$(E))()) : new (core.List$(E))(this.length);
180 let i = 0; 180 let i = 0;
181 for (let element of this) 181 for (let element of this)
182 result[core.$set](((x$) => i = dart.notNull(x$) + 1, x$)(i), element); 182 result[core.$set](((x$) => i = dart.notNull(x$) + 1, x$)(i), element);
183 return result; 183 return result;
184 } 184 }
185 [core.$map](f) { 185 [core.$map](f) {
186 return new (_internal.EfficientLengthMappedIterable$(E, dynamic))(this, f); 186 return new (_internal.EfficientLengthMappedIterable$(E, dart.dynamic))(t his, f);
187 } 187 }
188 get [core.$single]() { 188 get [core.$single]() {
189 if (dart.notNull(this.length) > 1) 189 if (dart.notNull(this.length) > 1)
190 throw _internal.IterableElementError.tooMany(); 190 throw _internal.IterableElementError.tooMany();
191 let it = this.iterator; 191 let it = this.iterator;
192 if (!dart.notNull(it.moveNext())) 192 if (!dart.notNull(it.moveNext()))
193 throw _internal.IterableElementError.noElement(); 193 throw _internal.IterableElementError.noElement();
194 let result = dart.as(it.current, E); 194 let result = dart.as(it.current, E);
195 return result; 195 return result;
196 } 196 }
197 toString() { 197 toString() {
198 return IterableBase.iterableToFullString(this, '{', '}'); 198 return IterableBase.iterableToFullString(this, '{', '}');
199 } 199 }
200 [core.$where](f) { 200 [core.$where](f) {
201 return new (_internal.WhereIterable$(E))(this, f); 201 return new (_internal.WhereIterable$(E))(this, f);
202 } 202 }
203 [core.$expand](f) { 203 [core.$expand](f) {
204 return new (_internal.ExpandIterable$(E, dynamic))(this, f); 204 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
205 } 205 }
206 [core.$forEach](f) { 206 [core.$forEach](f) {
207 for (let element of this) 207 for (let element of this)
208 f(element); 208 f(element);
209 } 209 }
210 [core.$reduce](combine) { 210 [core.$reduce](combine) {
211 let iterator = this[core.$iterator]; 211 let iterator = this[core.$iterator];
212 if (!dart.notNull(iterator.moveNext())) { 212 if (!dart.notNull(iterator.moveNext())) {
213 throw _internal.IterableElementError.noElement(); 213 throw _internal.IterableElementError.noElement();
214 } 214 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 class HashSet extends core.Object { 388 class HashSet extends core.Object {
389 HashSet(opts) { 389 HashSet(opts) {
390 let equals = opts && 'equals' in opts ? opts.equals : null; 390 let equals = opts && 'equals' in opts ? opts.equals : null;
391 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null; 391 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
392 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null; 392 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
393 if (isValidKey == null) { 393 if (isValidKey == null) {
394 if (hashCode == null) { 394 if (hashCode == null) {
395 if (equals == null) { 395 if (equals == null) {
396 return new (_HashSet$(E))(); 396 return new (_HashSet$(E))();
397 } 397 }
398 hashCode = dart.as(_defaultHashCode, dart.throw_("Unimplemented type (E) → int")); 398 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] ));
399 } else { 399 } else {
400 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { 400 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) {
401 return new (_IdentityHashSet$(E))(); 401 return new (_IdentityHashSet$(E))();
402 } 402 }
403 if (equals == null) { 403 if (equals == null) {
404 equals = dart.as(_defaultEquals, dart.throw_("Unimplemented type ( E, E) → bool")); 404 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E]));
405 } 405 }
406 } 406 }
407 } else { 407 } else {
408 if (hashCode == null) { 408 if (hashCode == null) {
409 hashCode = dart.as(_defaultHashCode, dart.throw_("Unimplemented type (E) → int")); 409 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] ));
410 } 410 }
411 if (equals == null) { 411 if (equals == null) {
412 equals = dart.as(_defaultEquals, dart.throw_("Unimplemented type (E, E) → bool")); 412 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E] ));
413 } 413 }
414 } 414 }
415 return new (_CustomHashSet$(E))(equals, hashCode, isValidKey); 415 return new (_CustomHashSet$(E))(equals, hashCode, isValidKey);
416 } 416 }
417 identity() { 417 identity() {
418 return new (_IdentityHashSet$(E))(); 418 return new (_IdentityHashSet$(E))();
419 } 419 }
420 from(elements) { 420 from(elements) {
421 let result = new (HashSet$(E))(); 421 let result = new (HashSet$(E))();
422 for (let e of dart.as(elements, core.Iterable$(E))) 422 for (let e of dart.as(elements, core.Iterable$(E)))
423 result.add(e); 423 result.add(e);
424 return result; 424 return result;
425 } 425 }
426 } 426 }
427 HashSet[dart.implements] = () => [core.Set$(E)]; 427 HashSet[dart.implements] = () => [core.Set$(E)];
428 dart.defineNamedConstructor(HashSet, 'identity'); 428 dart.defineNamedConstructor(HashSet, 'identity');
429 dart.defineNamedConstructor(HashSet, 'from'); 429 dart.defineNamedConstructor(HashSet, 'from');
430 return HashSet; 430 return HashSet;
431 }); 431 });
432 let HashSet = HashSet$(); 432 let HashSet = HashSet$();
433 let IterableMixin$ = dart.generic(function(E) { 433 let IterableMixin$ = dart.generic(function(E) {
434 class IterableMixin extends core.Object { 434 class IterableMixin extends core.Object {
435 [core.$map](f) { 435 [core.$map](f) {
436 return new (_internal.MappedIterable$(E, dynamic))(this, f); 436 return new (_internal.MappedIterable$(E, dart.dynamic))(this, f);
437 } 437 }
438 [core.$where](f) { 438 [core.$where](f) {
439 return new (_internal.WhereIterable$(E))(this, f); 439 return new (_internal.WhereIterable$(E))(this, f);
440 } 440 }
441 [core.$expand](f) { 441 [core.$expand](f) {
442 return new (_internal.ExpandIterable$(E, dynamic))(this, f); 442 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
443 } 443 }
444 [core.$contains](element) { 444 [core.$contains](element) {
445 for (let e of this) { 445 for (let e of this) {
446 if (dart.equals(e, element)) 446 if (dart.equals(e, element))
447 return true; 447 return true;
448 } 448 }
449 return false; 449 return false;
450 } 450 }
451 [core.$forEach](f) { 451 [core.$forEach](f) {
452 for (let element of this) 452 for (let element of this)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 }); 627 });
628 let IterableMixin = IterableMixin$(); 628 let IterableMixin = IterableMixin$();
629 let _isToStringVisiting = Symbol('_isToStringVisiting'); 629 let _isToStringVisiting = Symbol('_isToStringVisiting');
630 let _toStringVisiting = Symbol('_toStringVisiting'); 630 let _toStringVisiting = Symbol('_toStringVisiting');
631 let _iterablePartsToStrings = Symbol('_iterablePartsToStrings'); 631 let _iterablePartsToStrings = Symbol('_iterablePartsToStrings');
632 let IterableBase$ = dart.generic(function(E) { 632 let IterableBase$ = dart.generic(function(E) {
633 class IterableBase extends core.Object { 633 class IterableBase extends core.Object {
634 IterableBase() { 634 IterableBase() {
635 } 635 }
636 [core.$map](f) { 636 [core.$map](f) {
637 return new (_internal.MappedIterable$(E, dynamic))(this, f); 637 return new (_internal.MappedIterable$(E, dart.dynamic))(this, f);
638 } 638 }
639 [core.$where](f) { 639 [core.$where](f) {
640 return new (_internal.WhereIterable$(E))(this, f); 640 return new (_internal.WhereIterable$(E))(this, f);
641 } 641 }
642 [core.$expand](f) { 642 [core.$expand](f) {
643 return new (_internal.ExpandIterable$(E, dynamic))(this, f); 643 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
644 } 644 }
645 [core.$contains](element) { 645 [core.$contains](element) {
646 for (let e of this) { 646 for (let e of this) {
647 if (dart.equals(e, element)) 647 if (dart.equals(e, element))
648 return true; 648 return true;
649 } 649 }
650 return false; 650 return false;
651 } 651 }
652 [core.$forEach](f) { 652 [core.$forEach](f) {
653 for (let element of this) 653 for (let element of this)
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 class LinkedHashMap extends core.Object { 1006 class LinkedHashMap extends core.Object {
1007 LinkedHashMap(opts) { 1007 LinkedHashMap(opts) {
1008 let equals = opts && 'equals' in opts ? opts.equals : null; 1008 let equals = opts && 'equals' in opts ? opts.equals : null;
1009 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null; 1009 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
1010 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null; 1010 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
1011 if (isValidKey == null) { 1011 if (isValidKey == null) {
1012 if (hashCode == null) { 1012 if (hashCode == null) {
1013 if (equals == null) { 1013 if (equals == null) {
1014 return new (_LinkedHashMap$(K, V))(); 1014 return new (_LinkedHashMap$(K, V))();
1015 } 1015 }
1016 hashCode = dart.as(_defaultHashCode, dart.throw_("Unimplemented type (K) → int")); 1016 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] ));
1017 } else { 1017 } else {
1018 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { 1018 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) {
1019 return new (_LinkedIdentityHashMap$(K, V))(); 1019 return new (_LinkedIdentityHashMap$(K, V))();
1020 } 1020 }
1021 if (equals == null) { 1021 if (equals == null) {
1022 equals = dart.as(_defaultEquals, dart.throw_("Unimplemented type ( K, K) → bool")); 1022 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K]));
1023 } 1023 }
1024 } 1024 }
1025 } else { 1025 } else {
1026 if (hashCode == null) { 1026 if (hashCode == null) {
1027 hashCode = dart.as(_defaultHashCode, dart.throw_("Unimplemented type (K) → int")); 1027 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K] ));
1028 } 1028 }
1029 if (equals == null) { 1029 if (equals == null) {
1030 equals = dart.as(_defaultEquals, dart.throw_("Unimplemented type (K, K) → bool")); 1030 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K] ));
1031 } 1031 }
1032 } 1032 }
1033 return new (_LinkedCustomHashMap$(K, V))(equals, hashCode, isValidKey); 1033 return new (_LinkedCustomHashMap$(K, V))(equals, hashCode, isValidKey);
1034 } 1034 }
1035 identity() { 1035 identity() {
1036 return new (_LinkedIdentityHashMap$(K, V))(); 1036 return new (_LinkedIdentityHashMap$(K, V))();
1037 } 1037 }
1038 from(other) { 1038 from(other) {
1039 let result = new (LinkedHashMap$(K, V))(); 1039 let result = new (LinkedHashMap$(K, V))();
1040 other.forEach((k, v) => { 1040 other.forEach((k, v) => {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 class LinkedHashSet extends core.Object { 1075 class LinkedHashSet extends core.Object {
1076 LinkedHashSet(opts) { 1076 LinkedHashSet(opts) {
1077 let equals = opts && 'equals' in opts ? opts.equals : null; 1077 let equals = opts && 'equals' in opts ? opts.equals : null;
1078 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null; 1078 let hashCode = opts && 'hashCode' in opts ? opts.hashCode : null;
1079 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null; 1079 let isValidKey = opts && 'isValidKey' in opts ? opts.isValidKey : null;
1080 if (isValidKey == null) { 1080 if (isValidKey == null) {
1081 if (hashCode == null) { 1081 if (hashCode == null) {
1082 if (equals == null) { 1082 if (equals == null) {
1083 return new (_LinkedHashSet$(E))(); 1083 return new (_LinkedHashSet$(E))();
1084 } 1084 }
1085 hashCode = dart.as(_defaultHashCode, dart.throw_("Unimplemented type (E) → int")); 1085 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] ));
1086 } else { 1086 } else {
1087 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { 1087 if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) {
1088 return new (_LinkedIdentityHashSet$(E))(); 1088 return new (_LinkedIdentityHashSet$(E))();
1089 } 1089 }
1090 if (equals == null) { 1090 if (equals == null) {
1091 equals = dart.as(_defaultEquals, dart.throw_("Unimplemented type ( E, E) → bool")); 1091 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E]));
1092 } 1092 }
1093 } 1093 }
1094 } else { 1094 } else {
1095 if (hashCode == null) { 1095 if (hashCode == null) {
1096 hashCode = dart.as(_defaultHashCode, dart.throw_("Unimplemented type (E) → int")); 1096 hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E] ));
1097 } 1097 }
1098 if (equals == null) { 1098 if (equals == null) {
1099 equals = dart.as(_defaultEquals, dart.throw_("Unimplemented type (E, E) → bool")); 1099 equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E] ));
1100 } 1100 }
1101 } 1101 }
1102 return new (_LinkedCustomHashSet$(E))(equals, hashCode, isValidKey); 1102 return new (_LinkedCustomHashSet$(E))(equals, hashCode, isValidKey);
1103 } 1103 }
1104 identity() { 1104 identity() {
1105 return new (_LinkedIdentityHashSet$(E))(); 1105 return new (_LinkedIdentityHashSet$(E))();
1106 } 1106 }
1107 from(elements) { 1107 from(elements) {
1108 let result = new (LinkedHashSet$(E))(); 1108 let result = new (LinkedHashSet$(E))();
1109 for (let element of elements) { 1109 for (let element of elements) {
(...skipping 25 matching lines...) Expand all
1135 super.IterableBase(); 1135 super.IterableBase();
1136 this[_next] = this[_previous] = this; 1136 this[_next] = this[_previous] = this;
1137 } 1137 }
1138 addFirst(entry) { 1138 addFirst(entry) {
1139 this[_insertAfter](this, entry); 1139 this[_insertAfter](this, entry);
1140 } 1140 }
1141 add(entry) { 1141 add(entry) {
1142 this[_insertAfter](this[_previous], entry); 1142 this[_insertAfter](this[_previous], entry);
1143 } 1143 }
1144 addAll(entries) { 1144 addAll(entries) {
1145 entries[core.$forEach](dart.as(((entry) => this[_insertAfter](this[_prev ious], dart.as(entry, E))).bind(this), dart.throw_("Unimplemented type (E) → voi d"))); 1145 entries[core.$forEach](dart.as(((entry) => this[_insertAfter](this[_prev ious], dart.as(entry, E))).bind(this), dart.functionType(dart.void, [E])));
1146 } 1146 }
1147 remove(entry) { 1147 remove(entry) {
1148 if (!dart.equals(entry[_list], this)) 1148 if (!dart.equals(entry[_list], this))
1149 return false; 1149 return false;
1150 this[_unlink](entry); 1150 this[_unlink](entry);
1151 return true; 1151 return true;
1152 } 1152 }
1153 get [core.$iterator]() { 1153 get [core.$iterator]() {
1154 return new (_LinkedListIterator$(E))(this); 1154 return new (_LinkedListIterator$(E))(this);
1155 } 1155 }
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 buffer.writeAll(this, separator); 1432 buffer.writeAll(this, separator);
1433 return buffer.toString(); 1433 return buffer.toString();
1434 } 1434 }
1435 [core.$where](test) { 1435 [core.$where](test) {
1436 return new (_internal.WhereIterable$(E))(this, test); 1436 return new (_internal.WhereIterable$(E))(this, test);
1437 } 1437 }
1438 [core.$map](f) { 1438 [core.$map](f) {
1439 return new _internal.MappedListIterable(this, f); 1439 return new _internal.MappedListIterable(this, f);
1440 } 1440 }
1441 [core.$expand](f) { 1441 [core.$expand](f) {
1442 return new (_internal.ExpandIterable$(E, dynamic))(this, f); 1442 return new (_internal.ExpandIterable$(E, dart.dynamic))(this, f);
1443 } 1443 }
1444 [core.$reduce](combine) { 1444 [core.$reduce](combine) {
1445 let length = this[core.$length]; 1445 let length = this[core.$length];
1446 if (length == 0) 1446 if (length == 0)
1447 throw _internal.IterableElementError.noElement(); 1447 throw _internal.IterableElementError.noElement();
1448 let value = this[core.$get](0); 1448 let value = this[core.$get](0);
1449 for (let i = 1; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 1449 for (let i = 1; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
1450 value = combine(value, this[core.$get](i)); 1450 value = combine(value, this[core.$get](i));
1451 if (length != this[core.$length]) { 1451 if (length != this[core.$length]) {
1452 throw new core.ConcurrentModificationError(this); 1452 throw new core.ConcurrentModificationError(this);
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 this[_current] = dart.as(this[_queue][_table][core.$get](this[_position] ), E); 2608 this[_current] = dart.as(this[_queue][_table][core.$get](this[_position] ), E);
2609 this[_position] = dart.notNull(this[_position]) + 1 & dart.notNull(this[ _queue][_table][core.$length]) - 1; 2609 this[_position] = dart.notNull(this[_position]) + 1 & dart.notNull(this[ _queue][_table][core.$length]) - 1;
2610 return true; 2610 return true;
2611 } 2611 }
2612 } 2612 }
2613 _ListQueueIterator[dart.implements] = () => [core.Iterator$(E)]; 2613 _ListQueueIterator[dart.implements] = () => [core.Iterator$(E)];
2614 return _ListQueueIterator; 2614 return _ListQueueIterator;
2615 }); 2615 });
2616 let _ListQueueIterator = _ListQueueIterator$(); 2616 let _ListQueueIterator = _ListQueueIterator$();
2617 let _Predicate$ = dart.generic(function(T) { 2617 let _Predicate$ = dart.generic(function(T) {
2618 class _Predicate extends core.Function {} 2618 let _Predicate = dart.typedef('_Predicate', () => dart.functionType(core.boo l, [T]));
2619 return _Predicate; 2619 return _Predicate;
2620 }); 2620 });
2621 let _Predicate = _Predicate$(); 2621 let _Predicate = _Predicate$();
2622 let _SplayTreeNode$ = dart.generic(function(K) { 2622 let _SplayTreeNode$ = dart.generic(function(K) {
2623 class _SplayTreeNode extends core.Object { 2623 class _SplayTreeNode extends core.Object {
2624 _SplayTreeNode(key) { 2624 _SplayTreeNode(key) {
2625 this.key = key; 2625 this.key = key;
2626 this.left = null; 2626 this.left = null;
2627 this.right = null; 2627 this.right = null;
2628 } 2628 }
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3097 return this[_tree][_count]; 3097 return this[_tree][_count];
3098 } 3098 }
3099 get [core.$isEmpty]() { 3099 get [core.$isEmpty]() {
3100 return this[_tree][_count] == 0; 3100 return this[_tree][_count] == 0;
3101 } 3101 }
3102 get [core.$iterator]() { 3102 get [core.$iterator]() {
3103 return new (_SplayTreeKeyIterator$(K))(this[_tree]); 3103 return new (_SplayTreeKeyIterator$(K))(this[_tree]);
3104 } 3104 }
3105 [core.$toSet]() { 3105 [core.$toSet]() {
3106 let setOrMap = this[_tree]; 3106 let setOrMap = this[_tree];
3107 let set = new (SplayTreeSet$(K))(dart.as(setOrMap[_comparator], dart.thr ow_("Unimplemented type (K, K) → int")), dart.as(setOrMap[_validKey], dart.throw _("Unimplemented type (dynamic) → bool"))); 3107 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])));
3108 set[_count] = this[_tree][_count]; 3108 set[_count] = this[_tree][_count];
3109 set[_root] = set[_copyNode](this[_tree][_root]); 3109 set[_root] = set[_copyNode](this[_tree][_root]);
3110 return set; 3110 return set;
3111 } 3111 }
3112 } 3112 }
3113 _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength]; 3113 _SplayTreeKeyIterable[dart.implements] = () => [_internal.EfficientLength];
3114 return _SplayTreeKeyIterable; 3114 return _SplayTreeKeyIterable;
3115 }); 3115 });
3116 let _SplayTreeKeyIterable = _SplayTreeKeyIterable$(); 3116 let _SplayTreeKeyIterable = _SplayTreeKeyIterable$();
3117 let _SplayTreeValueIterable$ = dart.generic(function(K, V) { 3117 let _SplayTreeValueIterable$ = dart.generic(function(K, V) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 } 3252 }
3253 } 3253 }
3254 } 3254 }
3255 removeAll(elements) { 3255 removeAll(elements) {
3256 for (let element of elements) { 3256 for (let element of elements) {
3257 if (dart.dinvokef(this[_validKey], element)) 3257 if (dart.dinvokef(this[_validKey], element))
3258 this[_remove](dart.as(element, E)); 3258 this[_remove](dart.as(element, E));
3259 } 3259 }
3260 } 3260 }
3261 retainAll(elements) { 3261 retainAll(elements) {
3262 let retainSet = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.t hrow_("Unimplemented type (E, E) → int")), this[_validKey]); 3262 let retainSet = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.f unctionType(core.int, [E, E])), this[_validKey]);
3263 let modificationCount = this[_modificationCount]; 3263 let modificationCount = this[_modificationCount];
3264 for (let object of elements) { 3264 for (let object of elements) {
3265 if (modificationCount != this[_modificationCount]) { 3265 if (modificationCount != this[_modificationCount]) {
3266 throw new core.ConcurrentModificationError(this); 3266 throw new core.ConcurrentModificationError(this);
3267 } 3267 }
3268 if (dart.notNull(dart.dinvokef(this[_validKey], object)) && this[_spla y](dart.as(object, E)) == 0) 3268 if (dart.notNull(dart.dinvokef(this[_validKey], object)) && this[_spla y](dart.as(object, E)) == 0)
3269 retainSet.add(this[_root].key); 3269 retainSet.add(this[_root].key);
3270 } 3270 }
3271 if (retainSet[_count] != this[_count]) { 3271 if (retainSet[_count] != this[_count]) {
3272 this[_root] = retainSet[_root]; 3272 this[_root] = retainSet[_root];
3273 this[_count] = retainSet[_count]; 3273 this[_count] = retainSet[_count];
3274 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1; 3274 this[_modificationCount] = dart.notNull(this[_modificationCount]) + 1;
3275 } 3275 }
3276 } 3276 }
3277 lookup(object) { 3277 lookup(object) {
3278 if (!dart.notNull(dart.dinvokef(this[_validKey], object))) 3278 if (!dart.notNull(dart.dinvokef(this[_validKey], object)))
3279 return null; 3279 return null;
3280 let comp = this[_splay](dart.as(object, E)); 3280 let comp = this[_splay](dart.as(object, E));
3281 if (comp != 0) 3281 if (comp != 0)
3282 return null; 3282 return null;
3283 return this[_root].key; 3283 return this[_root].key;
3284 } 3284 }
3285 intersection(other) { 3285 intersection(other) {
3286 let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.thro w_("Unimplemented type (E, E) → int")), this[_validKey]); 3286 let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.func tionType(core.int, [E, E])), this[_validKey]);
3287 for (let element of this) { 3287 for (let element of this) {
3288 if (other[core.$contains](element)) 3288 if (other[core.$contains](element))
3289 result.add(element); 3289 result.add(element);
3290 } 3290 }
3291 return result; 3291 return result;
3292 } 3292 }
3293 difference(other) { 3293 difference(other) {
3294 let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.thro w_("Unimplemented type (E, E) → int")), this[_validKey]); 3294 let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.func tionType(core.int, [E, E])), this[_validKey]);
3295 for (let element of this) { 3295 for (let element of this) {
3296 if (!dart.notNull(other[core.$contains](element))) 3296 if (!dart.notNull(other[core.$contains](element)))
3297 result.add(element); 3297 result.add(element);
3298 } 3298 }
3299 return result; 3299 return result;
3300 } 3300 }
3301 union(other) { 3301 union(other) {
3302 return ((_) => { 3302 return ((_) => {
3303 _.addAll(other); 3303 _.addAll(other);
3304 return _; 3304 return _;
3305 })(this[_clone]()); 3305 })(this[_clone]());
3306 } 3306 }
3307 [_clone]() { 3307 [_clone]() {
3308 let set = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.throw_( "Unimplemented type (E, E) → int")), this[_validKey]); 3308 let set = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.functio nType(core.int, [E, E])), this[_validKey]);
3309 set[_count] = this[_count]; 3309 set[_count] = this[_count];
3310 set[_root] = this[_copyNode](this[_root]); 3310 set[_root] = this[_copyNode](this[_root]);
3311 return set; 3311 return set;
3312 } 3312 }
3313 [_copyNode](node) { 3313 [_copyNode](node) {
3314 if (node == null) 3314 if (node == null)
3315 return null; 3315 return null;
3316 return ((_) => { 3316 return ((_) => {
3317 _.left = this[_copyNode](node.left); 3317 _.left = this[_copyNode](node.left);
3318 _.right = this[_copyNode](node.right); 3318 _.right = this[_copyNode](node.right);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3367 get isEmpty() { 3367 get isEmpty() {
3368 return this[_length] == 0; 3368 return this[_length] == 0;
3369 } 3369 }
3370 get isNotEmpty() { 3370 get isNotEmpty() {
3371 return !dart.notNull(this.isEmpty); 3371 return !dart.notNull(this.isEmpty);
3372 } 3372 }
3373 get keys() { 3373 get keys() {
3374 return new (HashMapKeyIterable$(K))(this); 3374 return new (HashMapKeyIterable$(K))(this);
3375 } 3375 }
3376 get values() { 3376 get values() {
3377 return new (_internal.MappedIterable$(K, V))(this.keys, dart.as(((each) => this.get(each)).bind(this), dart.throw_("Unimplemented type (K) → V"))); 3377 return new (_internal.MappedIterable$(K, V))(this.keys, dart.as(((each) => this.get(each)).bind(this), dart.functionType(V, [K])));
3378 } 3378 }
3379 containsKey(key) { 3379 containsKey(key) {
3380 if (_HashMap[_isStringKey](key)) { 3380 if (_HashMap[_isStringKey](key)) {
3381 let strings = this[_strings]; 3381 let strings = this[_strings];
3382 return strings == null ? false : _HashMap[_hasTableEntry](strings, key ); 3382 return strings == null ? false : _HashMap[_hasTableEntry](strings, key );
3383 } else if (_HashMap[_isNumericKey](key)) { 3383 } else if (_HashMap[_isNumericKey](key)) {
3384 let nums = this[_nums]; 3384 let nums = this[_nums];
3385 return nums == null ? false : _HashMap[_hasTableEntry](nums, key); 3385 return nums == null ? false : _HashMap[_hasTableEntry](nums, key);
3386 } else { 3386 } else {
3387 return this[_containsKey](key); 3387 return this[_containsKey](key);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
3768 get isEmpty() { 3768 get isEmpty() {
3769 return this[_length] == 0; 3769 return this[_length] == 0;
3770 } 3770 }
3771 get isNotEmpty() { 3771 get isNotEmpty() {
3772 return !dart.notNull(this.isEmpty); 3772 return !dart.notNull(this.isEmpty);
3773 } 3773 }
3774 get keys() { 3774 get keys() {
3775 return new (LinkedHashMapKeyIterable$(K))(this); 3775 return new (LinkedHashMapKeyIterable$(K))(this);
3776 } 3776 }
3777 get values() { 3777 get values() {
3778 return new (_internal.MappedIterable$(K, V))(this.keys, dart.as(((each) => this.get(each)).bind(this), dart.throw_("Unimplemented type (K) → V"))); 3778 return new (_internal.MappedIterable$(K, V))(this.keys, dart.as(((each) => this.get(each)).bind(this), dart.functionType(V, [K])));
3779 } 3779 }
3780 containsKey(key) { 3780 containsKey(key) {
3781 if (_LinkedHashMap[_isStringKey](key)) { 3781 if (_LinkedHashMap[_isStringKey](key)) {
3782 let strings = this[_strings]; 3782 let strings = this[_strings];
3783 if (strings == null) 3783 if (strings == null)
3784 return false; 3784 return false;
3785 let cell = dart.as(_LinkedHashMap[_getTableEntry](strings, key), Linke dHashMapCell); 3785 let cell = dart.as(_LinkedHashMap[_getTableEntry](strings, key), Linke dHashMapCell);
3786 return cell != null; 3786 return cell != null;
3787 } else if (_LinkedHashMap[_isNumericKey](key)) { 3787 } else if (_LinkedHashMap[_isNumericKey](key)) {
3788 let nums = this[_nums]; 3788 let nums = this[_nums];
3789 if (nums == null) 3789 if (nums == null)
3790 return false; 3790 return false;
3791 let cell = dart.as(_LinkedHashMap[_getTableEntry](nums, key), LinkedHa shMapCell); 3791 let cell = dart.as(_LinkedHashMap[_getTableEntry](nums, key), LinkedHa shMapCell);
3792 return cell != null; 3792 return cell != null;
3793 } else { 3793 } else {
3794 return this[_containsKey](key); 3794 return this[_containsKey](key);
3795 } 3795 }
3796 } 3796 }
3797 [_containsKey](key) { 3797 [_containsKey](key) {
3798 let rest = this[_rest]; 3798 let rest = this[_rest];
3799 if (rest == null) 3799 if (rest == null)
3800 return false; 3800 return false;
3801 let bucket = this[_getBucket](rest, key); 3801 let bucket = this[_getBucket](rest, key);
3802 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0; 3802 return dart.notNull(this[_findBucketIndex](bucket, key)) >= 0;
3803 } 3803 }
3804 containsValue(value) { 3804 containsValue(value) {
3805 return this.keys[core.$any](dart.as(((each) => dart.equals(this.get(each ), value)).bind(this), dart.throw_("Unimplemented type (K) → bool"))); 3805 return this.keys[core.$any](dart.as(((each) => dart.equals(this.get(each ), value)).bind(this), dart.functionType(core.bool, [K])));
3806 } 3806 }
3807 addAll(other) { 3807 addAll(other) {
3808 other.forEach(((key, value) => { 3808 other.forEach(((key, value) => {
3809 this.set(key, value); 3809 this.set(key, value);
3810 }).bind(this)); 3810 }).bind(this));
3811 } 3811 }
3812 get(key) { 3812 get(key) {
3813 if (_LinkedHashMap[_isStringKey](key)) { 3813 if (_LinkedHashMap[_isStringKey](key)) {
3814 let strings = this[_strings]; 3814 let strings = this[_strings];
3815 if (strings == null) 3815 if (strings == null)
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
4943 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; 4943 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$;
4944 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; 4944 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable;
4945 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; 4945 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$;
4946 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; 4946 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator;
4947 exports.HashSetIterator$ = HashSetIterator$; 4947 exports.HashSetIterator$ = HashSetIterator$;
4948 exports.HashSetIterator = HashSetIterator; 4948 exports.HashSetIterator = HashSetIterator;
4949 exports.LinkedHashSetCell = LinkedHashSetCell; 4949 exports.LinkedHashSetCell = LinkedHashSetCell;
4950 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; 4950 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$;
4951 exports.LinkedHashSetIterator = LinkedHashSetIterator; 4951 exports.LinkedHashSetIterator = LinkedHashSetIterator;
4952 })(collection || (collection = {})); 4952 })(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