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

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

Issue 1121993004: Inference through conditional expressions (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebase 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
« 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 } 9 }
10 get [core.$length]() { 10 get [core.$length]() {
(...skipping 2982 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 let _comparator = Symbol('_comparator'); 2993 let _comparator = Symbol('_comparator');
2994 let _validKey = Symbol('_validKey'); 2994 let _validKey = Symbol('_validKey');
2995 let SplayTreeMap$ = dart.generic(function(K, V) { 2995 let SplayTreeMap$ = dart.generic(function(K, V) {
2996 class SplayTreeMap extends _SplayTree$(K) { 2996 class SplayTreeMap extends _SplayTree$(K) {
2997 SplayTreeMap(compare, isValidKey) { 2997 SplayTreeMap(compare, isValidKey) {
2998 if (compare === void 0) 2998 if (compare === void 0)
2999 compare = null; 2999 compare = null;
3000 if (isValidKey === void 0) 3000 if (isValidKey === void 0)
3001 isValidKey = null; 3001 isValidKey = null;
3002 this[_comparator] = dart.as(compare == null ? dart.bind(core.Comparable, 'compare') : compare, core.Comparator$(K)); 3002 this[_comparator] = dart.as(compare == null ? dart.bind(core.Comparable, 'compare') : compare, core.Comparator$(K));
3003 this[_validKey] = dart.as(isValidKey != null ? isValidKey : v => dart.is (v, K), _Predicate); 3003 this[_validKey] = isValidKey != null ? isValidKey : v => dart.is(v, K);
3004 super._SplayTree(); 3004 super._SplayTree();
3005 } 3005 }
3006 from(other, compare, isValidKey) { 3006 from(other, compare, isValidKey) {
3007 if (compare === void 0) 3007 if (compare === void 0)
3008 compare = null; 3008 compare = null;
3009 if (isValidKey === void 0) 3009 if (isValidKey === void 0)
3010 isValidKey = null; 3010 isValidKey = null;
3011 let result = new (SplayTreeMap$(K, V))(); 3011 let result = new (SplayTreeMap$(K, V))();
3012 other.forEach((k, v) => { 3012 other.forEach((k, v) => {
3013 result.set(k, dart.as(v, V)); 3013 result.set(k, dart.as(v, V));
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 }); 3376 });
3377 let _SplayTreeNodeIterator = _SplayTreeNodeIterator$(); 3377 let _SplayTreeNodeIterator = _SplayTreeNodeIterator$();
3378 let _clone = Symbol('_clone'); 3378 let _clone = Symbol('_clone');
3379 let SplayTreeSet$ = dart.generic(function(E) { 3379 let SplayTreeSet$ = dart.generic(function(E) {
3380 class SplayTreeSet extends dart.mixin(_SplayTree$(E), IterableMixin$(E), Set Mixin$(E)) { 3380 class SplayTreeSet extends dart.mixin(_SplayTree$(E), IterableMixin$(E), Set Mixin$(E)) {
3381 SplayTreeSet(compare, isValidKey) { 3381 SplayTreeSet(compare, isValidKey) {
3382 if (compare === void 0) 3382 if (compare === void 0)
3383 compare = null; 3383 compare = null;
3384 if (isValidKey === void 0) 3384 if (isValidKey === void 0)
3385 isValidKey = null; 3385 isValidKey = null;
3386 this[_comparator] = dart.as(compare == null ? dart.bind(core.Comparable, 'compare') : compare, core.Comparator); 3386 this[_comparator] = compare == null ? dart.bind(core.Comparable, 'compar e') : compare;
3387 this[_validKey] = dart.as(isValidKey != null ? isValidKey : v => dart.is (v, E), _Predicate); 3387 this[_validKey] = isValidKey != null ? isValidKey : v => dart.is(v, E);
3388 super._SplayTree(); 3388 super._SplayTree();
3389 } 3389 }
3390 from(elements, compare, isValidKey) { 3390 from(elements, compare, isValidKey) {
3391 if (compare === void 0) 3391 if (compare === void 0)
3392 compare = null; 3392 compare = null;
3393 if (isValidKey === void 0) 3393 if (isValidKey === void 0)
3394 isValidKey = null; 3394 isValidKey = null;
3395 let result = new (SplayTreeSet$(E))(compare, isValidKey); 3395 let result = new (SplayTreeSet$(E))(compare, isValidKey);
3396 for (let element of dart.as(elements, core.Iterable$(E))) { 3396 for (let element of dart.as(elements, core.Iterable$(E))) {
3397 result.add(element); 3397 result.add(element);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3612 dart.as(other, core.Map$(K, V)); 3612 dart.as(other, core.Map$(K, V));
3613 other.forEach(((key, value) => { 3613 other.forEach(((key, value) => {
3614 dart.as(key, K); 3614 dart.as(key, K);
3615 dart.as(value, V); 3615 dart.as(value, V);
3616 this.set(key, value); 3616 this.set(key, value);
3617 }).bind(this)); 3617 }).bind(this));
3618 } 3618 }
3619 get(key) { 3619 get(key) {
3620 if (_HashMap._isStringKey(key)) { 3620 if (_HashMap._isStringKey(key)) {
3621 let strings = this[_strings]; 3621 let strings = this[_strings];
3622 return dart.as(strings == null ? null : _HashMap._getTableEntry(string s, key), V); 3622 return strings == null ? null : dart.as(_HashMap._getTableEntry(string s, key), V);
3623 } else if (_HashMap._isNumericKey(key)) { 3623 } else if (_HashMap._isNumericKey(key)) {
3624 let nums = this[_nums]; 3624 let nums = this[_nums];
3625 return dart.as(nums == null ? null : _HashMap._getTableEntry(nums, key ), V); 3625 return nums == null ? null : dart.as(_HashMap._getTableEntry(nums, key ), V);
3626 } else { 3626 } else {
3627 return this[_get](key); 3627 return this[_get](key);
3628 } 3628 }
3629 } 3629 }
3630 [_get](key) { 3630 [_get](key) {
3631 let rest = this[_rest]; 3631 let rest = this[_rest];
3632 if (rest == null) 3632 if (rest == null)
3633 return null; 3633 return null;
3634 let bucket = this[_getBucket](rest, key); 3634 let bucket = this[_getBucket](rest, key);
3635 let index = this[_findBucketIndex](bucket, key); 3635 let index = this[_findBucketIndex](bucket, key);
3636 return dart.as(dart.notNull(index) < 0 ? null : bucket[dart.notNull(inde x) + 1], V); 3636 return dart.notNull(index) < 0 ? null : dart.as(bucket[dart.notNull(inde x) + 1], V);
3637 } 3637 }
3638 set(key, value) { 3638 set(key, value) {
3639 dart.as(key, K); 3639 dart.as(key, K);
3640 dart.as(value, V); 3640 dart.as(value, V);
3641 if (_HashMap._isStringKey(key)) { 3641 if (_HashMap._isStringKey(key)) {
3642 let strings = this[_strings]; 3642 let strings = this[_strings];
3643 if (strings == null) 3643 if (strings == null)
3644 this[_strings] = strings = _HashMap._newHashTable(); 3644 this[_strings] = strings = _HashMap._newHashTable();
3645 this[_addHashTableEntry](strings, key, value); 3645 this[_addHashTableEntry](strings, key, value);
3646 } else if (_HashMap._isNumericKey(key)) { 3646 } else if (_HashMap._isNumericKey(key)) {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
3860 return _IdentityHashMap; 3860 return _IdentityHashMap;
3861 }); 3861 });
3862 let _IdentityHashMap = _IdentityHashMap$(); 3862 let _IdentityHashMap = _IdentityHashMap$();
3863 let _equals = Symbol('_equals'); 3863 let _equals = Symbol('_equals');
3864 let _hashCode = Symbol('_hashCode'); 3864 let _hashCode = Symbol('_hashCode');
3865 let _CustomHashMap$ = dart.generic(function(K, V) { 3865 let _CustomHashMap$ = dart.generic(function(K, V) {
3866 class _CustomHashMap extends _HashMap$(K, V) { 3866 class _CustomHashMap extends _HashMap$(K, V) {
3867 _CustomHashMap(equals, hashCode, validKey) { 3867 _CustomHashMap(equals, hashCode, validKey) {
3868 this[_equals] = equals; 3868 this[_equals] = equals;
3869 this[_hashCode] = hashCode; 3869 this[_hashCode] = hashCode;
3870 this[_validKey] = dart.as(validKey != null ? validKey : v => dart.is(v, K), _Predicate); 3870 this[_validKey] = validKey != null ? validKey : v => dart.is(v, K);
3871 super._HashMap(); 3871 super._HashMap();
3872 } 3872 }
3873 get(key) { 3873 get(key) {
3874 if (!dart.notNull(dart.dcall(this[_validKey], key))) 3874 if (!dart.notNull(dart.dcall(this[_validKey], key)))
3875 return null; 3875 return null;
3876 return super[_get](key); 3876 return super[_get](key);
3877 } 3877 }
3878 set(key, value) { 3878 set(key, value) {
3879 dart.as(key, K); 3879 dart.as(key, K);
3880 dart.as(value, V); 3880 dart.as(value, V);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4040 dart.as(value, V); 4040 dart.as(value, V);
4041 this.set(key, value); 4041 this.set(key, value);
4042 }).bind(this)); 4042 }).bind(this));
4043 } 4043 }
4044 get(key) { 4044 get(key) {
4045 if (_LinkedHashMap._isStringKey(key)) { 4045 if (_LinkedHashMap._isStringKey(key)) {
4046 let strings = this[_strings]; 4046 let strings = this[_strings];
4047 if (strings == null) 4047 if (strings == null)
4048 return null; 4048 return null;
4049 let cell = dart.as(_LinkedHashMap._getTableEntry(strings, key), Linked HashMapCell); 4049 let cell = dart.as(_LinkedHashMap._getTableEntry(strings, key), Linked HashMapCell);
4050 return dart.as(cell == null ? null : cell[_value], V); 4050 return cell == null ? null : dart.as(cell[_value], V);
4051 } else if (_LinkedHashMap._isNumericKey(key)) { 4051 } else if (_LinkedHashMap._isNumericKey(key)) {
4052 let nums = this[_nums]; 4052 let nums = this[_nums];
4053 if (nums == null) 4053 if (nums == null)
4054 return null; 4054 return null;
4055 let cell = dart.as(_LinkedHashMap._getTableEntry(nums, key), LinkedHas hMapCell); 4055 let cell = dart.as(_LinkedHashMap._getTableEntry(nums, key), LinkedHas hMapCell);
4056 return dart.as(cell == null ? null : cell[_value], V); 4056 return cell == null ? null : dart.as(cell[_value], V);
4057 } else { 4057 } else {
4058 return this[_get](key); 4058 return this[_get](key);
4059 } 4059 }
4060 } 4060 }
4061 [_get](key) { 4061 [_get](key) {
4062 let rest = this[_rest]; 4062 let rest = this[_rest];
4063 if (rest == null) 4063 if (rest == null)
4064 return null; 4064 return null;
4065 let bucket = this[_getBucket](rest, key); 4065 let bucket = this[_getBucket](rest, key);
4066 let index = this[_findBucketIndex](bucket, key); 4066 let index = this[_findBucketIndex](bucket, key);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4283 } 4283 }
4284 } 4284 }
4285 return _LinkedIdentityHashMap; 4285 return _LinkedIdentityHashMap;
4286 }); 4286 });
4287 let _LinkedIdentityHashMap = _LinkedIdentityHashMap$(); 4287 let _LinkedIdentityHashMap = _LinkedIdentityHashMap$();
4288 let _LinkedCustomHashMap$ = dart.generic(function(K, V) { 4288 let _LinkedCustomHashMap$ = dart.generic(function(K, V) {
4289 class _LinkedCustomHashMap extends _LinkedHashMap$(K, V) { 4289 class _LinkedCustomHashMap extends _LinkedHashMap$(K, V) {
4290 _LinkedCustomHashMap(equals, hashCode, validKey) { 4290 _LinkedCustomHashMap(equals, hashCode, validKey) {
4291 this[_equals] = equals; 4291 this[_equals] = equals;
4292 this[_hashCode] = hashCode; 4292 this[_hashCode] = hashCode;
4293 this[_validKey] = dart.as(validKey != null ? validKey : v => dart.is(v, K), _Predicate); 4293 this[_validKey] = validKey != null ? validKey : v => dart.is(v, K);
4294 super._LinkedHashMap(); 4294 super._LinkedHashMap();
4295 } 4295 }
4296 get(key) { 4296 get(key) {
4297 if (!dart.notNull(dart.dcall(this[_validKey], key))) 4297 if (!dart.notNull(dart.dcall(this[_validKey], key)))
4298 return null; 4298 return null;
4299 return super[_get](key); 4299 return super[_get](key);
4300 } 4300 }
4301 set(key, value) { 4301 set(key, value) {
4302 dart.as(key, K); 4302 dart.as(key, K);
4303 dart.as(value, V); 4303 dart.as(value, V);
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
4667 return _IdentityHashSet; 4667 return _IdentityHashSet;
4668 }); 4668 });
4669 let _IdentityHashSet = _IdentityHashSet$(); 4669 let _IdentityHashSet = _IdentityHashSet$();
4670 let _equality = Symbol('_equality'); 4670 let _equality = Symbol('_equality');
4671 let _hasher = Symbol('_hasher'); 4671 let _hasher = Symbol('_hasher');
4672 let _CustomHashSet$ = dart.generic(function(E) { 4672 let _CustomHashSet$ = dart.generic(function(E) {
4673 class _CustomHashSet extends _HashSet$(E) { 4673 class _CustomHashSet extends _HashSet$(E) {
4674 _CustomHashSet(equality, hasher, validKey) { 4674 _CustomHashSet(equality, hasher, validKey) {
4675 this[_equality] = equality; 4675 this[_equality] = equality;
4676 this[_hasher] = hasher; 4676 this[_hasher] = hasher;
4677 this[_validKey] = dart.as(validKey != null ? validKey : x => dart.is(x, E), _Predicate); 4677 this[_validKey] = validKey != null ? validKey : x => dart.is(x, E);
4678 super._HashSet(); 4678 super._HashSet();
4679 } 4679 }
4680 [_newSet]() { 4680 [_newSet]() {
4681 return new (_CustomHashSet$(E))(this[_equality], this[_hasher], this[_va lidKey]); 4681 return new (_CustomHashSet$(E))(this[_equality], this[_hasher], this[_va lidKey]);
4682 } 4682 }
4683 [_findBucketIndex](bucket, element) { 4683 [_findBucketIndex](bucket, element) {
4684 if (bucket == null) 4684 if (bucket == null)
4685 return -1; 4685 return -1;
4686 let length = bucket.length; 4686 let length = bucket.length;
4687 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 4687 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
5049 } 5049 }
5050 } 5050 }
5051 return _LinkedIdentityHashSet; 5051 return _LinkedIdentityHashSet;
5052 }); 5052 });
5053 let _LinkedIdentityHashSet = _LinkedIdentityHashSet$(); 5053 let _LinkedIdentityHashSet = _LinkedIdentityHashSet$();
5054 let _LinkedCustomHashSet$ = dart.generic(function(E) { 5054 let _LinkedCustomHashSet$ = dart.generic(function(E) {
5055 class _LinkedCustomHashSet extends _LinkedHashSet$(E) { 5055 class _LinkedCustomHashSet extends _LinkedHashSet$(E) {
5056 _LinkedCustomHashSet(equality, hasher, validKey) { 5056 _LinkedCustomHashSet(equality, hasher, validKey) {
5057 this[_equality] = equality; 5057 this[_equality] = equality;
5058 this[_hasher] = hasher; 5058 this[_hasher] = hasher;
5059 this[_validKey] = dart.as(validKey != null ? validKey : x => dart.is(x, E), _Predicate); 5059 this[_validKey] = validKey != null ? validKey : x => dart.is(x, E);
5060 super._LinkedHashSet(); 5060 super._LinkedHashSet();
5061 } 5061 }
5062 [_newSet]() { 5062 [_newSet]() {
5063 return new (_LinkedCustomHashSet$(E))(this[_equality], this[_hasher], th is[_validKey]); 5063 return new (_LinkedCustomHashSet$(E))(this[_equality], this[_hasher], th is[_validKey]);
5064 } 5064 }
5065 [_findBucketIndex](bucket, element) { 5065 [_findBucketIndex](bucket, element) {
5066 if (bucket == null) 5066 if (bucket == null)
5067 return -1; 5067 return -1;
5068 let length = bucket.length; 5068 let length = bucket.length;
5069 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 5069 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$; 5208 exports.LinkedHashMapKeyIterable$ = LinkedHashMapKeyIterable$;
5209 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable; 5209 exports.LinkedHashMapKeyIterable = LinkedHashMapKeyIterable;
5210 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$; 5210 exports.LinkedHashMapKeyIterator$ = LinkedHashMapKeyIterator$;
5211 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator; 5211 exports.LinkedHashMapKeyIterator = LinkedHashMapKeyIterator;
5212 exports.HashSetIterator$ = HashSetIterator$; 5212 exports.HashSetIterator$ = HashSetIterator$;
5213 exports.HashSetIterator = HashSetIterator; 5213 exports.HashSetIterator = HashSetIterator;
5214 exports.LinkedHashSetCell = LinkedHashSetCell; 5214 exports.LinkedHashSetCell = LinkedHashSetCell;
5215 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$; 5215 exports.LinkedHashSetIterator$ = LinkedHashSetIterator$;
5216 exports.LinkedHashSetIterator = LinkedHashSetIterator; 5216 exports.LinkedHashSetIterator = LinkedHashSetIterator;
5217 })(collection || (collection = {})); 5217 })(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