From bf567bb94b46e9baca2d4c5d07243a41e351cfc6 Mon Sep 17 00:00:00 2001 From: Leaf Petersen Date: Tue, 5 May 2015 16:47:19 -0700 Subject: [PATCH] Typing fixes to eliminate casts/dcalls Tightens up some typing issues (mostly in the collections) to eliminate some casts and dynamic calls. Also adds inference through parenthesized expressions. BUG= R=vsm@google.com Review URL: https://codereview.chromium.org/1122313002 --- pkg/dev_compiler/lib/runtime/dart/async.js | 73 ++++---- .../lib/runtime/dart/collection.js | 167 +++++++----------- pkg/dev_compiler/lib/runtime/dart/convert.js | 2 +- pkg/dev_compiler/lib/runtime/dart/core.js | 4 +- pkg/dev_compiler/lib/src/checker/rules.dart | 8 + .../test/checker/checker_test.dart | 2 + .../dart_codegen/expect/async/stream.dart | 54 +++--- .../expect/async/stream_controller.dart | 10 +- .../expect/async/stream_impl.dart | 26 +-- .../expect/async/stream_pipe.dart | 2 +- .../expect/async/stream_transformers.dart | 22 +-- .../test/dart_codegen/expect/async/timer.dart | 4 +- .../test/dart_codegen/expect/async/zone.dart | 36 ++-- .../expect/collection/hash_map.dart | 4 +- .../expect/collection/iterable.dart | 26 +-- .../dart_codegen/expect/collection/set.dart | 12 +- .../expect/collection/splay_tree.dart | 107 +++++------ .../lib/collection/collection.dart | 18 +- .../lib/collection/hash_map.dart | 6 +- .../lib/collection/hash_set.dart | 2 +- .../lib/collection/iterable.dart | 14 +- .../lib/collection/linked_hash_map.dart | 2 +- .../lib/collection/linked_hash_set.dart | 2 +- .../generated_sdk/lib/collection/set.dart | 6 +- .../lib/collection/splay_tree.dart | 20 ++- .../test/generated_sdk/lib/core/list.dart | 2 +- .../input_sdk/lib/collection/hash_map.dart | 4 +- .../input_sdk/lib/collection/iterable.dart | 14 +- .../tool/input_sdk/lib/collection/set.dart | 6 +- .../input_sdk/lib/collection/splay_tree.dart | 20 ++- .../input_sdk/patch/collection_patch.dart | 26 +-- .../tool/input_sdk/patch/core_patch.dart | 2 +- 32 files changed, 326 insertions(+), 377 deletions(-) diff --git a/pkg/dev_compiler/lib/runtime/dart/async.js b/pkg/dev_compiler/lib/runtime/dart/async.js index 1acb24065745..8679778fa19c 100644 --- a/pkg/dev_compiler/lib/runtime/dart/async.js +++ b/pkg/dev_compiler/lib/runtime/dart/async.js @@ -82,7 +82,7 @@ var async; if (computation === void 0) computation = null; if (computation == null) - computation = dart.as(i => null, __CastType12); + computation = i => null; let timer = null; let computationCount = 0; let controller = null; @@ -144,7 +144,7 @@ var async; dart.as(onListen, dart.functionType(dart.void, [StreamSubscription$(T)])); let onCancel = opts && 'onCancel' in opts ? opts.onCancel : null; dart.as(onCancel, dart.functionType(dart.void, [StreamSubscription$(T)])); - return new (_AsBroadcastStream$(T))(this, dart.as(onListen, __CastType14), dart.as(onCancel, dart.functionType(dart.void, [StreamSubscription]))); + return new (_AsBroadcastStream$(T))(this, dart.as(onListen, __CastType12), dart.as(onCancel, dart.functionType(dart.void, [StreamSubscription]))); } where(test) { dart.as(test, dart.functionType(core.bool, [T])); @@ -287,7 +287,7 @@ var async; _runUserCode(() => combine(value, element), newValue => { dart.as(newValue, T); value = newValue; - }, dart.as(_cancelAndErrorClosure(subscription, result), __CastType16)); + }, dart.as(_cancelAndErrorClosure(subscription, result), __CastType14)); } else { value = element; seenFirst = true; @@ -758,7 +758,7 @@ var async; dart.as(event, T); timer.cancel(); controller.add(event); - timer = zone.createTimer(timeLimit, dart.as(timeout, __CastType19)); + timer = zone.createTimer(timeLimit, dart.as(timeout, __CastType17)); } // Function onError: (dynamic, StackTrace) → void function onError(error, stackTrace) { @@ -781,7 +781,7 @@ var async; controller.addError(new TimeoutException("No stream event", timeLimit), null); }; } else { - onTimeout = dart.as(zone.registerUnaryCallback(onTimeout), __CastType20); + onTimeout = dart.as(zone.registerUnaryCallback(onTimeout), __CastType18); let wrapper = new _ControllerEventSinkWrapper(null); timeout = () => { wrapper[_sink] = controller; @@ -961,7 +961,7 @@ var async; onData(handleData) { dart.as(handleData, dart.functionType(dart.void, [T])); if (handleData == null) - handleData = dart.as(_nullDataHandler, __CastType22); + handleData = dart.as(_nullDataHandler, __CastType20); this[_onData] = dart.as(this[_zone].registerUnaryCallback(handleData), _DataHandler$(T)); } onError(handleError) { @@ -1151,9 +1151,9 @@ var async; return; this[_state] = dart.notNull(this[_state]) | dart.notNull(_BufferingStreamSubscription._STATE_IN_CALLBACK); if (dart.is(this[_onError], ZoneBinaryCallback)) { - this[_zone].runBinaryGuarded(dart.as(this[_onError], __CastType24), error, stackTrace); + this[_zone].runBinaryGuarded(dart.as(this[_onError], __CastType22), error, stackTrace); } else { - this[_zone].runUnaryGuarded(dart.as(this[_onError], __CastType27), error); + this[_zone].runUnaryGuarded(dart.as(this[_onError], __CastType25), error); } this[_state] = dart.notNull(this[_state]) & ~dart.notNull(_BufferingStreamSubscription._STATE_IN_CALLBACK); } @@ -2791,15 +2791,10 @@ var async; return _ControllerEventSinkWrapper; }); let _ControllerEventSinkWrapper = _ControllerEventSinkWrapper$(); - let __CastType12$ = dart.generic(function(T) { - let __CastType12 = dart.typedef('__CastType12', () => dart.functionType(T, [core.int])); - return __CastType12; - }); - let __CastType12 = __CastType12$(); - let __CastType14 = dart.typedef('__CastType14', () => dart.functionType(dart.void, [StreamSubscription])); - let __CastType16 = dart.typedef('__CastType16', () => dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])); - let __CastType19 = dart.typedef('__CastType19', () => dart.functionType(dart.void, [])); - let __CastType20 = dart.typedef('__CastType20', () => dart.functionType(dart.void, [EventSink])); + let __CastType12 = dart.typedef('__CastType12', () => dart.functionType(dart.void, [StreamSubscription])); + let __CastType14 = dart.typedef('__CastType14', () => dart.functionType(dart.dynamic, [dart.dynamic, core.StackTrace])); + let __CastType17 = dart.typedef('__CastType17', () => dart.functionType(dart.void, [])); + let __CastType18 = dart.typedef('__CastType18', () => dart.functionType(dart.void, [EventSink])); let StreamController$ = dart.generic(function(T) { class StreamController extends core.Object { StreamController(opts) { @@ -3798,13 +3793,13 @@ var async; return _StreamIteratorImpl; }); let _StreamIteratorImpl = _StreamIteratorImpl$(); - let __CastType22$ = dart.generic(function(T) { - let __CastType22 = dart.typedef('__CastType22', () => dart.functionType(dart.void, [T])); - return __CastType22; + let __CastType20$ = dart.generic(function(T) { + let __CastType20 = dart.typedef('__CastType20', () => dart.functionType(dart.void, [T])); + return __CastType20; }); - let __CastType22 = __CastType22$(); - let __CastType24 = dart.typedef('__CastType24', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic])); - let __CastType27 = dart.typedef('__CastType27', () => dart.functionType(dart.dynamic, [dart.dynamic])); + let __CastType20 = __CastType20$(); + let __CastType22 = dart.typedef('__CastType22', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic])); + let __CastType25 = dart.typedef('__CastType25', () => dart.functionType(dart.dynamic, [dart.dynamic])); // Function _runUserCode: (() → dynamic, (dynamic) → dynamic, (dynamic, StackTrace) → dynamic) → dynamic function _runUserCode(userCode, onSuccess, onError) { try { @@ -4446,9 +4441,9 @@ var async; super._StreamSinkTransformer(dart.as(outputSink => { dart.as(outputSink, EventSink$(T)); if (handleData == null) - handleData = dart.as(_StreamHandlerTransformer._defaultHandleData, __CastType29); + handleData = dart.as(_StreamHandlerTransformer._defaultHandleData, __CastType27); if (handleError == null) - handleError = dart.as(_StreamHandlerTransformer._defaultHandleError, __CastType32); + handleError = dart.as(_StreamHandlerTransformer._defaultHandleError, __CastType30); if (handleDone == null) handleDone = _StreamHandlerTransformer._defaultHandleDone; return new (_HandlerEventSink$(S, T))(handleData, handleError, handleDone, outputSink); @@ -4515,16 +4510,16 @@ var async; return _BoundSubscriptionStream; }); let _BoundSubscriptionStream = _BoundSubscriptionStream$(); - let __CastType29$ = dart.generic(function(S, T) { - let __CastType29 = dart.typedef('__CastType29', () => dart.functionType(dart.void, [S, EventSink$(T)])); - return __CastType29; + let __CastType27$ = dart.generic(function(S, T) { + let __CastType27 = dart.typedef('__CastType27', () => dart.functionType(dart.void, [S, EventSink$(T)])); + return __CastType27; }); - let __CastType29 = __CastType29$(); - let __CastType32$ = dart.generic(function(T) { - let __CastType32 = dart.typedef('__CastType32', () => dart.functionType(dart.void, [core.Object, core.StackTrace, EventSink$(T)])); - return __CastType32; + let __CastType27 = __CastType27$(); + let __CastType30$ = dart.generic(function(T) { + let __CastType30 = dart.typedef('__CastType30', () => dart.functionType(dart.void, [core.Object, core.StackTrace, EventSink$(T)])); + return __CastType30; }); - let __CastType32 = __CastType32$(); + let __CastType30 = __CastType30$(); class Timer extends core.Object { Timer(duration, callback) { if (dart.equals(Zone.current, Zone.ROOT)) { @@ -4536,7 +4531,7 @@ var async; if (dart.equals(Zone.current, Zone.ROOT)) { return Zone.current.createPeriodicTimer(duration, callback); } - return Zone.current.createPeriodicTimer(duration, dart.as(Zone.current.bindUnaryCallback(callback, {runGuarded: true}), __CastType36)); + return Zone.current.createPeriodicTimer(duration, dart.as(Zone.current.bindUnaryCallback(callback, {runGuarded: true}), __CastType34)); } static run(callback) { new Timer(core.Duration.ZERO, callback); @@ -4555,7 +4550,7 @@ var async; } } dart.defineNamedConstructor(Timer, 'periodic'); - let __CastType36 = dart.typedef('__CastType36', () => dart.functionType(dart.void, [Timer])); + let __CastType34 = dart.typedef('__CastType34', () => dart.functionType(dart.void, [Timer])); let ZoneCallback = dart.typedef('ZoneCallback', () => dart.functionType(dart.dynamic, [])); let ZoneUnaryCallback = dart.typedef('ZoneUnaryCallback', () => dart.functionType(dart.dynamic, [dart.dynamic])); let ZoneBinaryCallback = dart.typedef('ZoneBinaryCallback', () => dart.functionType(dart.dynamic, [dart.dynamic, dart.dynamic])); @@ -5024,7 +5019,7 @@ var async; // Function _rootCreatePeriodicTimer: (Zone, ZoneDelegate, Zone, Duration, (Timer) → void) → Timer function _rootCreatePeriodicTimer(self, parent, zone, duration, callback) { if (!dart.notNull(core.identical(_ROOT_ZONE, zone))) { - callback = dart.as(zone.bindUnaryCallback(callback), __CastType38); + callback = dart.as(zone.bindUnaryCallback(callback), __CastType36); } return Timer._createPeriodicTimer(duration, callback); } @@ -5286,7 +5281,7 @@ var async; if (dart.is(onError, ZoneBinaryCallback)) { return self.parent.runBinary(onError, error, stackTrace); } - return self.parent.runUnary(dart.as(onError, __CastType40), error); + return self.parent.runUnary(dart.as(onError, __CastType38), error); } catch (e) { let s = dart.stackTrace(e); if (core.identical(e, error)) { @@ -5310,8 +5305,8 @@ var async; return zone.run(body); } } - let __CastType38 = dart.typedef('__CastType38', () => dart.functionType(dart.void, [Timer])); - let __CastType40 = dart.typedef('__CastType40', () => dart.functionType(dart.dynamic, [dart.dynamic])); + let __CastType36 = dart.typedef('__CastType36', () => dart.functionType(dart.void, [Timer])); + let __CastType38 = dart.typedef('__CastType38', () => dart.functionType(dart.dynamic, [dart.dynamic])); dart.copyProperties(exports, { get _hasDocument() { return typeof document == 'object'; diff --git a/pkg/dev_compiler/lib/runtime/dart/collection.js b/pkg/dev_compiler/lib/runtime/dart/collection.js index ec36746c9f81..afd7171ec5f1 100644 --- a/pkg/dev_compiler/lib/runtime/dart/collection.js +++ b/pkg/dev_compiler/lib/runtime/dart/collection.js @@ -17,11 +17,11 @@ var collection; return UnmodifiableListView; }); dart.defineLazyClassGeneric(exports, 'UnmodifiableListView', {get: UnmodifiableListView$}); - // Function _defaultEquals: (dynamic, dynamic) → bool + // Function _defaultEquals: (Object, Object) → bool function _defaultEquals(a, b) { return dart.equals(a, b); } - // Function _defaultHashCode: (dynamic) → int + // Function _defaultHashCode: (Object) → int function _defaultHashCode(a) { return dart.hashCode(a); } @@ -46,21 +46,21 @@ var collection; if (equals == null) { return new (_HashMap$(K, V))(); } - hashCode = dart.as(_defaultHashCode, __CastType0); + hashCode = _defaultHashCode; } else { if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { return new (_IdentityHashMap$(K, V))(); } if (equals == null) { - equals = dart.as(_defaultEquals, __CastType2); + equals = _defaultEquals; } } } else { if (hashCode == null) { - hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K])); + hashCode = _defaultHashCode; } if (equals == null) { - equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K])); + equals = _defaultEquals; } } return new (_CustomHashMap$(K, V))(equals, hashCode, isValidKey); @@ -96,16 +96,6 @@ var collection; return HashMap; }); let HashMap = HashMap$(); - let __CastType0$ = dart.generic(function(K) { - let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.int, [K])); - return __CastType0; - }); - let __CastType0 = __CastType0$(); - let __CastType2$ = dart.generic(function(K) { - let __CastType2 = dart.typedef('__CastType2', () => dart.functionType(core.bool, [K, K])); - return __CastType2; - }); - let __CastType2 = __CastType2$(); let _newSet = Symbol('_newSet'); let SetMixin$ = dart.generic(function(E) { class SetMixin extends core.Object { @@ -210,7 +200,7 @@ var collection; let it = this[core.$iterator]; if (!dart.notNull(it.moveNext())) throw _internal.IterableElementError.noElement(); - let result = dart.as(it.current, E); + let result = it.current; return result; } toString() { @@ -303,7 +293,7 @@ var collection; if (!dart.notNull(it.moveNext())) { throw _internal.IterableElementError.noElement(); } - return dart.as(it.current, E); + return it.current; } get [core.$last]() { let it = this[core.$iterator]; @@ -312,7 +302,7 @@ var collection; } let result = null; do { - result = dart.as(it.current, E); + result = it.current; } while (it.moveNext()); return result; } @@ -429,21 +419,21 @@ var collection; if (equals == null) { return new (_HashSet$(E))(); } - hashCode = dart.as(_defaultHashCode, __CastType5); + hashCode = _defaultHashCode; } else { if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { return new (_IdentityHashSet$(E))(); } if (equals == null) { - equals = dart.as(_defaultEquals, __CastType7); + equals = _defaultEquals; } } } else { if (hashCode == null) { - hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E])); + hashCode = _defaultHashCode; } if (equals == null) { - equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E])); + equals = _defaultEquals; } } return new (_CustomHashSet$(E))(equals, hashCode, isValidKey); @@ -467,16 +457,6 @@ var collection; return HashSet; }); let HashSet = HashSet$(); - let __CastType5$ = dart.generic(function(E) { - let __CastType5 = dart.typedef('__CastType5', () => dart.functionType(core.int, [E])); - return __CastType5; - }); - let __CastType5 = __CastType5$(); - let __CastType7$ = dart.generic(function(E) { - let __CastType7 = dart.typedef('__CastType7', () => dart.functionType(core.bool, [E, E])); - return __CastType7; - }); - let __CastType7 = __CastType7$(); let IterableMixin$ = dart.generic(function(E) { class IterableMixin extends core.Object { [core.$map](f) { @@ -599,7 +579,7 @@ var collection; if (!dart.notNull(it.moveNext())) { throw _internal.IterableElementError.noElement(); } - return dart.as(it.current, E); + return it.current; } get [core.$last]() { let it = this[core.$iterator]; @@ -608,7 +588,7 @@ var collection; } let result = null; do { - result = dart.as(it.current, E); + result = it.current; } while (it.moveNext()); return result; } @@ -616,7 +596,7 @@ var collection; let it = this[core.$iterator]; if (!dart.notNull(it.moveNext())) throw _internal.IterableElementError.noElement(); - let result = dart.as(it.current, E); + let result = it.current; if (it.moveNext()) throw _internal.IterableElementError.tooMany(); return result; @@ -815,7 +795,7 @@ var collection; if (!dart.notNull(it.moveNext())) { throw _internal.IterableElementError.noElement(); } - return dart.as(it.current, E); + return it.current; } get [core.$last]() { let it = this[core.$iterator]; @@ -824,7 +804,7 @@ var collection; } let result = null; do { - result = dart.as(it.current, E); + result = it.current; } while (it.moveNext()); return result; } @@ -832,7 +812,7 @@ var collection; let it = this[core.$iterator]; if (!dart.notNull(it.moveNext())) throw _internal.IterableElementError.noElement(); - let result = dart.as(it.current, E); + let result = it.current; if (it.moveNext()) throw _internal.IterableElementError.tooMany(); return result; @@ -1089,21 +1069,21 @@ var collection; if (equals == null) { return new (_LinkedHashMap$(K, V))(); } - hashCode = dart.as(_defaultHashCode, __CastType10); + hashCode = _defaultHashCode; } else { if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { return new (_LinkedIdentityHashMap$(K, V))(); } if (equals == null) { - equals = dart.as(_defaultEquals, __CastType12); + equals = _defaultEquals; } } } else { if (hashCode == null) { - hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [K])); + hashCode = _defaultHashCode; } if (equals == null) { - equals = dart.as(_defaultEquals, dart.functionType(core.bool, [K, K])); + equals = _defaultEquals; } } return new (_LinkedCustomHashMap$(K, V))(equals, hashCode, isValidKey); @@ -1147,16 +1127,6 @@ var collection; return LinkedHashMap; }); let LinkedHashMap = LinkedHashMap$(); - let __CastType10$ = dart.generic(function(K) { - let __CastType10 = dart.typedef('__CastType10', () => dart.functionType(core.int, [K])); - return __CastType10; - }); - let __CastType10 = __CastType10$(); - let __CastType12$ = dart.generic(function(K) { - let __CastType12 = dart.typedef('__CastType12', () => dart.functionType(core.bool, [K, K])); - return __CastType12; - }); - let __CastType12 = __CastType12$(); let LinkedHashSet$ = dart.generic(function(E) { class LinkedHashSet extends core.Object { LinkedHashSet(opts) { @@ -1168,21 +1138,21 @@ var collection; if (equals == null) { return new (_LinkedHashSet$(E))(); } - hashCode = dart.as(_defaultHashCode, __CastType15); + hashCode = _defaultHashCode; } else { if (dart.notNull(core.identical(core.identityHashCode, hashCode)) && dart.notNull(core.identical(core.identical, equals))) { return new (_LinkedIdentityHashSet$(E))(); } if (equals == null) { - equals = dart.as(_defaultEquals, __CastType17); + equals = _defaultEquals; } } } else { if (hashCode == null) { - hashCode = dart.as(_defaultHashCode, dart.functionType(core.int, [E])); + hashCode = _defaultHashCode; } if (equals == null) { - equals = dart.as(_defaultEquals, dart.functionType(core.bool, [E, E])); + equals = _defaultEquals; } } return new (_LinkedCustomHashSet$(E))(equals, hashCode, isValidKey); @@ -1207,16 +1177,6 @@ var collection; return LinkedHashSet; }); let LinkedHashSet = LinkedHashSet$(); - let __CastType15$ = dart.generic(function(E) { - let __CastType15 = dart.typedef('__CastType15', () => dart.functionType(core.int, [E])); - return __CastType15; - }); - let __CastType15 = __CastType15$(); - let __CastType17$ = dart.generic(function(E) { - let __CastType17 = dart.typedef('__CastType17', () => dart.functionType(core.bool, [E, E])); - return __CastType17; - }); - let __CastType17 = __CastType17$(); let _modificationCount = Symbol('_modificationCount'); let _length = Symbol('_length'); let _next = Symbol('_next'); @@ -3031,7 +2991,7 @@ var collection; get(key) { if (key == null) throw new core.ArgumentError(key); - if (!dart.notNull(dart.dcall(this[_validKey], key))) + if (!dart.notNull(this[_validKey](key))) return null; if (this[_root] != null) { let comp = this[_splay](dart.as(key, K)); @@ -3043,7 +3003,7 @@ var collection; return null; } remove(key) { - if (!dart.notNull(dart.dcall(this[_validKey], key))) + if (!dart.notNull(this[_validKey](key))) return null; let mapRoot = dart.as(this[_remove](dart.as(key, K)), _SplayTreeMapNode); if (mapRoot != null) @@ -3115,7 +3075,7 @@ var collection; this[_clear](); } containsKey(key) { - return dart.notNull(dart.dcall(this[_validKey], key)) && this[_splay](dart.as(key, K)) == 0; + return dart.notNull(this[_validKey](key)) && this[_splay](dart.as(key, K)) == 0; } containsValue(value) { let found = false; @@ -3291,7 +3251,7 @@ var collection; } [core.$toSet]() { let setOrMap = this[_tree]; - let set = new (SplayTreeSet$(K))(dart.as(setOrMap[_comparator], __CastType20), dart.as(setOrMap[_validKey], __CastType23)); + let set = new (SplayTreeSet$(K))(dart.as(setOrMap[_comparator], __CastType0), dart.as(setOrMap[_validKey], __CastType3)); set[_count] = this[_tree][_count]; set[_root] = set[_copyNode](this[_tree][_root]); return set; @@ -3369,7 +3329,7 @@ var collection; compare = null; if (isValidKey === void 0) isValidKey = null; - this[_comparator] = compare == null ? dart.bind(core.Comparable, 'compare') : compare; + this[_comparator] = dart.as(compare == null ? dart.bind(core.Comparable, 'compare') : compare, core.Comparator$(E)); this[_validKey] = isValidKey != null ? isValidKey : v => dart.is(v, E); super._SplayTree(); } @@ -3387,7 +3347,7 @@ var collection; [_compare](e1, e2) { dart.as(e1, E); dart.as(e2, E); - return dart.dcall(this[_comparator], e1, e2); + return this[_comparator](e1, e2); } get [core.$iterator]() { return new (_SplayTreeKeyIterator$(E))(this); @@ -3419,7 +3379,7 @@ var collection; return this[_root].key; } [core.$contains](object) { - return dart.notNull(dart.dcall(this[_validKey], object)) && this[_splay](dart.as(object, E)) == 0; + return dart.notNull(this[_validKey](object)) && this[_splay](dart.as(object, E)) == 0; } add(element) { dart.as(element, E); @@ -3430,7 +3390,7 @@ var collection; return true; } remove(object) { - if (!dart.notNull(dart.dcall(this[_validKey], object))) + if (!dart.notNull(this[_validKey](object))) return false; return this[_remove](dart.as(object, E)) != null; } @@ -3445,18 +3405,18 @@ var collection; } removeAll(elements) { for (let element of elements) { - if (dart.dcall(this[_validKey], element)) + if (this[_validKey](element)) this[_remove](dart.as(element, E)); } } retainAll(elements) { - let retainSet = new (SplayTreeSet$(E))(dart.as(this[_comparator], __CastType25), this[_validKey]); + let retainSet = new (SplayTreeSet$(E))(this[_comparator], this[_validKey]); let modificationCount = this[_modificationCount]; for (let object of elements) { if (modificationCount != this[_modificationCount]) { throw new core.ConcurrentModificationError(this); } - if (dart.notNull(dart.dcall(this[_validKey], object)) && this[_splay](dart.as(object, E)) == 0) + if (dart.notNull(this[_validKey](object)) && this[_splay](dart.as(object, E)) == 0) retainSet.add(this[_root].key); } if (retainSet[_count] != this[_count]) { @@ -3466,7 +3426,7 @@ var collection; } } lookup(object) { - if (!dart.notNull(dart.dcall(this[_validKey], object))) + if (!dart.notNull(this[_validKey](object))) return null; let comp = this[_splay](dart.as(object, E)); if (comp != 0) @@ -3474,7 +3434,7 @@ var collection; return this[_root].key; } intersection(other) { - let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.functionType(core.int, [E, E])), this[_validKey]); + let result = new (SplayTreeSet$(E))(this[_comparator], this[_validKey]); for (let element of this) { if (other[core.$contains](element)) result.add(element); @@ -3482,7 +3442,7 @@ var collection; return result; } difference(other) { - let result = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.functionType(core.int, [E, E])), this[_validKey]); + let result = new (SplayTreeSet$(E))(this[_comparator], this[_validKey]); for (let element of this) { if (!dart.notNull(other[core.$contains](element))) result.add(element); @@ -3496,7 +3456,7 @@ var collection; return _; } [_clone]() { - let set = new (SplayTreeSet$(E))(dart.as(this[_comparator], dart.functionType(core.int, [E, E])), this[_validKey]); + let set = new (SplayTreeSet$(E))(this[_comparator], this[_validKey]); set[_count] = this[_count]; set[_root] = this[_copyNode](this[_root]); return set; @@ -3524,17 +3484,12 @@ var collection; return SplayTreeSet; }); let SplayTreeSet = SplayTreeSet$(); - let __CastType20$ = dart.generic(function(K) { - let __CastType20 = dart.typedef('__CastType20', () => dart.functionType(core.int, [K, K])); - return __CastType20; - }); - let __CastType20 = __CastType20$(); - let __CastType23 = dart.typedef('__CastType23', () => dart.functionType(core.bool, [dart.dynamic])); - let __CastType25$ = dart.generic(function(E) { - let __CastType25 = dart.typedef('__CastType25', () => dart.functionType(core.int, [E, E])); - return __CastType25; + let __CastType0$ = dart.generic(function(K) { + let __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.int, [K, K])); + return __CastType0; }); - let __CastType25 = __CastType25$(); + let __CastType0 = __CastType0$(); + let __CastType3 = dart.typedef('__CastType3', () => dart.functionType(core.bool, [core.Object])); let _strings = Symbol('_strings'); let _nums = Symbol('_nums'); let _rest = Symbol('_rest'); @@ -3855,7 +3810,7 @@ var collection; super._HashMap(); } get(key) { - if (!dart.notNull(dart.dcall(this[_validKey], key))) + if (!dart.notNull(this[_validKey](key))) return null; return super[_get](key); } @@ -3865,12 +3820,12 @@ var collection; super[_set](key, value); } containsKey(key) { - if (!dart.notNull(dart.dcall(this[_validKey], key))) + if (!dart.notNull(this[_validKey](key))) return false; return super[_containsKey](key); } remove(key) { - if (!dart.notNull(dart.dcall(this[_validKey], key))) + if (!dart.notNull(this[_validKey](key))) return null; return super[_remove](key); } @@ -4278,7 +4233,7 @@ var collection; super._LinkedHashMap(); } get(key) { - if (!dart.notNull(dart.dcall(this[_validKey], key))) + if (!dart.notNull(this[_validKey](key))) return null; return super[_get](key); } @@ -4288,12 +4243,12 @@ var collection; super[_set](key, value); } containsKey(key) { - if (!dart.notNull(dart.dcall(this[_validKey], key))) + if (!dart.notNull(this[_validKey](key))) return false; return super[_containsKey](key); } remove(key) { - if (!dart.notNull(dart.dcall(this[_validKey], key))) + if (!dart.notNull(this[_validKey](key))) return null; return super[_remove](key); } @@ -4682,17 +4637,17 @@ var collection; return super[_add](object); } [core.$contains](object) { - if (!dart.notNull(dart.dcall(this[_validKey], object))) + if (!dart.notNull(this[_validKey](object))) return false; return super[_contains](object); } lookup(object) { - if (!dart.notNull(dart.dcall(this[_validKey], object))) + if (!dart.notNull(this[_validKey](object))) return null; return super[_lookup](object); } remove(object) { - if (!dart.notNull(dart.dcall(this[_validKey], object))) + if (!dart.notNull(this[_validKey](object))) return false; return super[_remove](object); } @@ -5065,30 +5020,30 @@ var collection; return super[_add](element); } [core.$contains](object) { - if (!dart.notNull(dart.dcall(this[_validKey], object))) + if (!dart.notNull(this[_validKey](object))) return false; return super[_contains](object); } lookup(object) { - if (!dart.notNull(dart.dcall(this[_validKey], object))) + if (!dart.notNull(this[_validKey](object))) return null; return super[_lookup](object); } remove(object) { - if (!dart.notNull(dart.dcall(this[_validKey], object))) + if (!dart.notNull(this[_validKey](object))) return false; return super[_remove](object); } containsAll(elements) { for (let element of elements) { - if (!dart.notNull(dart.dcall(this[_validKey], element)) || !dart.notNull(this[core.$contains](element))) + if (!dart.notNull(this[_validKey](element)) || !dart.notNull(this[core.$contains](element))) return false; } return true; } removeAll(elements) { for (let element of elements) { - if (dart.dcall(this[_validKey], element)) { + if (this[_validKey](element)) { super[_remove](element); } } diff --git a/pkg/dev_compiler/lib/runtime/dart/convert.js b/pkg/dev_compiler/lib/runtime/dart/convert.js index a5ba6200032f..fdccd3354fc4 100644 --- a/pkg/dev_compiler/lib/runtime/dart/convert.js +++ b/pkg/dev_compiler/lib/runtime/dart/convert.js @@ -91,7 +91,7 @@ var convert; } bind(source) { dart.as(source, async.Stream$(S)); - return new async.Stream$(T).eventTransformed(source, (sink => new _ConverterStreamEventSink(this, sink)).bind(this)); + return new (async.Stream$(T)).eventTransformed(source, (sink => new _ConverterStreamEventSink(this, sink)).bind(this)); } } Converter[dart.implements] = () => [async.StreamTransformer$(S, T)]; diff --git a/pkg/dev_compiler/lib/runtime/dart/core.js b/pkg/dev_compiler/lib/runtime/dart/core.js index 476038365eaf..41ad8dad975f 100644 --- a/pkg/dev_compiler/lib/runtime/dart/core.js +++ b/pkg/dev_compiler/lib/runtime/dart/core.js @@ -1284,7 +1284,7 @@ var core; result[$set](i, fill); } } - return dart.as(result, List$(E)); + return result; } from(elements, opts) { let growable = opts && 'growable' in opts ? opts.growable : true; @@ -2504,7 +2504,7 @@ var core; get pathSegments() { if (this[_pathSegments] == null) { let pathToSplit = !dart.notNull(this.path.isEmpty) && this.path.codeUnitAt(0) == Uri._SLASH ? this.path.substring(1) : this.path; - this[_pathSegments] = new (collection.UnmodifiableListView$(String))(pathToSplit == "" ? dart.const(dart.setType([], List$(String))) : new List$(String).from(pathToSplit.split("/")[$map](dart.bind(Uri, 'decodeComponent')), {growable: false})); + this[_pathSegments] = new (collection.UnmodifiableListView$(String))(pathToSplit == "" ? dart.const(dart.setType([], List$(String))) : new (List$(String)).from(pathToSplit.split("/")[$map](dart.bind(Uri, 'decodeComponent')), {growable: false})); } return this[_pathSegments]; } diff --git a/pkg/dev_compiler/lib/src/checker/rules.dart b/pkg/dev_compiler/lib/src/checker/rules.dart index b406b9f6e930..f77f77ef4802 100644 --- a/pkg/dev_compiler/lib/src/checker/rules.dart +++ b/pkg/dev_compiler/lib/src/checker/rules.dart @@ -613,6 +613,9 @@ class DownwardsInference { if (e is ConditionalExpression) { return _inferConditionalExpression(e, t, errors); } + if (e is ParenthesizedExpression) { + return _inferParenthesizedExpression(e, t, errors); + } if (e is Conversion) return _inferExpression(e.node, t, errors); if (rules.isSubTypeOf(rules.getStaticType(e), t)) return true; if (cast && rules.getStaticType(e).isDynamic) { @@ -717,6 +720,11 @@ class DownwardsInference { _inferExpression(e.elseExpression, t, errors); } + bool _inferParenthesizedExpression( + ParenthesizedExpression e, DartType t, errors) { + return _inferExpression(e.expression, t, errors); + } + bool _inferInstanceCreationExpression( InstanceCreationExpression e, DartType t, errors) { var arguments = e.argumentList.arguments; diff --git a/pkg/dev_compiler/test/checker/checker_test.dart b/pkg/dev_compiler/test/checker/checker_test.dart index b1ef88833374..11e724f52998 100644 --- a/pkg/dev_compiler/test/checker/checker_test.dart +++ b/pkg/dev_compiler/test/checker/checker_test.dart @@ -37,6 +37,8 @@ void main() { bool isValidKey(potentialKey)]) { : _comparator = /*warning:DownCastComposite*/(compare == null) ? Comparable.compare : compare, _validKey = /*info:InferredType should be pass*/(isValidKey != null) ? isValidKey : ((v) => true); + _Predicate _v = /*warning:DownCastComposite*/(isValidKey != null) ? isValidKey : ((v) => true); + _v = /*info:InferredType should be pass*/(isValidKey != null) ? _v : ((v) => true); } } void main() { diff --git a/pkg/dev_compiler/test/dart_codegen/expect/async/stream.dart b/pkg/dev_compiler/test/dart_codegen/expect/async/stream.dart index d86394dae8cc..5c25b5d8a704 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/async/stream.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/async/stream.dart @@ -21,9 +21,7 @@ part of dart.async; return new _GeneratedStreamImpl(() => new _IterablePendingEvents(data)); } factory Stream.periodic(Duration period, [T computation(int computationCount)]) { - if (computation == null) computation = ((__x24) => DEVC$RT.cast(__x24, __CastType22, DEVC$RT.type((__CastType20 _) { - } - ), "CompositeCast", """line 127, column 44 of dart:async/stream.dart: """, __x24 is __CastType20, false))(((i) => null)); + if (computation == null) computation = ((i) => null); Timer timer; int computationCount = 0; StreamController controller; @@ -66,7 +64,7 @@ part of dart.async; return controller.stream; } factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink sink)) { - return new _BoundSinkStream(source, DEVC$RT.cast(mapSink, DEVC$RT.type((__CastType25 _) { + return new _BoundSinkStream(source, DEVC$RT.cast(mapSink, DEVC$RT.type((__CastType20 _) { } ), DEVC$RT.type((_SinkMapper _) { } @@ -76,11 +74,11 @@ part of dart.async; Stream asBroadcastStream({ void onListen(StreamSubscription subscription), void onCancel(StreamSubscription subscription)} ) { - return new _AsBroadcastStream(this, DEVC$RT.cast(onListen, DEVC$RT.type((__CastType29 _) { + return new _AsBroadcastStream(this, DEVC$RT.cast(onListen, DEVC$RT.type((__CastType24 _) { } - ), __CastType27, "CompositeCast", """line 249, column 44 of dart:async/stream.dart: """, onListen is __CastType27, false), DEVC$RT.cast(onCancel, DEVC$RT.type((__CastType29 _) { + ), __CastType22, "CompositeCast", """line 249, column 44 of dart:async/stream.dart: """, onListen is __CastType22, false), DEVC$RT.cast(onCancel, DEVC$RT.type((__CastType24 _) { } - ), __CastType27, "CompositeCast", """line 249, column 54 of dart:async/stream.dart: """, onCancel is __CastType27, false)); + ), __CastType22, "CompositeCast", """line 249, column 54 of dart:async/stream.dart: """, onCancel is __CastType22, false)); } StreamSubscription listen(void onData(T event), { Function onError, void onDone(), bool cancelOnError} @@ -200,7 +198,7 @@ part of dart.async; _runUserCode(() => combine(value, element), (T newValue) { value = newValue; } - , ((__x34) => DEVC$RT.cast(__x34, dynamic, __CastType31, "CompositeCast", """line 502, column 24 of dart:async/stream.dart: """, __x34 is __CastType31, false))(_cancelAndErrorClosure(subscription, result))); + , ((__x29) => DEVC$RT.cast(__x29, dynamic, __CastType26, "CompositeCast", """line 502, column 24 of dart:async/stream.dart: """, __x29 is __CastType26, false))(_cancelAndErrorClosure(subscription, result))); } else { value = element; @@ -231,7 +229,7 @@ part of dart.async; _runUserCode(() => combine(value, element), (newValue) { value = newValue; } - , ((__x35) => DEVC$RT.cast(__x35, dynamic, __CastType31, "CompositeCast", """line 535, column 11 of dart:async/stream.dart: """, __x35 is __CastType31, false))(_cancelAndErrorClosure(subscription, result))); + , ((__x30) => DEVC$RT.cast(__x30, dynamic, __CastType26, "CompositeCast", """line 535, column 11 of dart:async/stream.dart: """, __x30 is __CastType26, false))(_cancelAndErrorClosure(subscription, result))); } , onError: (e, st) { result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast", """line 539, column 34 of dart:async/stream.dart: """, st is StackTrace, true)); @@ -277,7 +275,7 @@ part of dart.async; _cancelAndValue(subscription, future, true); } } - , ((__x36) => DEVC$RT.cast(__x36, dynamic, __CastType31, "CompositeCast", """line 603, column 13 of dart:async/stream.dart: """, __x36 is __CastType31, false))(_cancelAndErrorClosure(subscription, future))); + , ((__x31) => DEVC$RT.cast(__x31, dynamic, __CastType26, "CompositeCast", """line 603, column 13 of dart:async/stream.dart: """, __x31 is __CastType26, false))(_cancelAndErrorClosure(subscription, future))); } , onError: future._completeError, onDone: () { future._complete(false); @@ -291,7 +289,7 @@ part of dart.async; subscription = this.listen((T element) { _runUserCode(() => action(element), (_) { } - , ((__x37) => DEVC$RT.cast(__x37, dynamic, __CastType31, "CompositeCast", """line 629, column 13 of dart:async/stream.dart: """, __x37 is __CastType31, false))(_cancelAndErrorClosure(subscription, future))); + , ((__x32) => DEVC$RT.cast(__x32, dynamic, __CastType26, "CompositeCast", """line 629, column 13 of dart:async/stream.dart: """, __x32 is __CastType26, false))(_cancelAndErrorClosure(subscription, future))); } , onError: future._completeError, onDone: () { future._complete(null); @@ -308,7 +306,7 @@ part of dart.async; _cancelAndValue(subscription, future, false); } } - , ((__x38) => DEVC$RT.cast(__x38, dynamic, __CastType31, "CompositeCast", """line 658, column 13 of dart:async/stream.dart: """, __x38 is __CastType31, false))(_cancelAndErrorClosure(subscription, future))); + , ((__x33) => DEVC$RT.cast(__x33, dynamic, __CastType26, "CompositeCast", """line 658, column 13 of dart:async/stream.dart: """, __x33 is __CastType26, false))(_cancelAndErrorClosure(subscription, future))); } , onError: future._completeError, onDone: () { future._complete(true); @@ -325,7 +323,7 @@ part of dart.async; _cancelAndValue(subscription, future, true); } } - , ((__x39) => DEVC$RT.cast(__x39, dynamic, __CastType31, "CompositeCast", """line 695, column 13 of dart:async/stream.dart: """, __x39 is __CastType31, false))(_cancelAndErrorClosure(subscription, future))); + , ((__x34) => DEVC$RT.cast(__x34, dynamic, __CastType26, "CompositeCast", """line 695, column 13 of dart:async/stream.dart: """, __x34 is __CastType26, false))(_cancelAndErrorClosure(subscription, future))); } , onError: future._completeError, onDone: () { future._complete(false); @@ -479,7 +477,7 @@ part of dart.async; _cancelAndValue(subscription, future, value); } } - , ((__x40) => DEVC$RT.cast(__x40, dynamic, __CastType31, "CompositeCast", """line 1037, column 11 of dart:async/stream.dart: """, __x40 is __CastType31, false))(_cancelAndErrorClosure(subscription, future))); + , ((__x35) => DEVC$RT.cast(__x35, dynamic, __CastType26, "CompositeCast", """line 1037, column 11 of dart:async/stream.dart: """, __x35 is __CastType26, false))(_cancelAndErrorClosure(subscription, future))); } , onError: future._completeError, onDone: () { if (defaultValue != null) { @@ -509,7 +507,7 @@ part of dart.async; result = value; } } - , ((__x41) => DEVC$RT.cast(__x41, dynamic, __CastType31, "CompositeCast", """line 1078, column 11 of dart:async/stream.dart: """, __x41 is __CastType31, false))(_cancelAndErrorClosure(subscription, future))); + , ((__x36) => DEVC$RT.cast(__x36, dynamic, __CastType26, "CompositeCast", """line 1078, column 11 of dart:async/stream.dart: """, __x36 is __CastType26, false))(_cancelAndErrorClosure(subscription, future))); } , onError: future._completeError, onDone: () { if (foundResult) { @@ -548,7 +546,7 @@ part of dart.async; result = value; } } - , ((__x42) => DEVC$RT.cast(__x42, dynamic, __CastType31, "CompositeCast", """line 1130, column 11 of dart:async/stream.dart: """, __x42 is __CastType31, false))(_cancelAndErrorClosure(subscription, future))); + , ((__x37) => DEVC$RT.cast(__x37, dynamic, __CastType26, "CompositeCast", """line 1130, column 11 of dart:async/stream.dart: """, __x37 is __CastType26, false))(_cancelAndErrorClosure(subscription, future))); } , onError: future._completeError, onDone: () { if (foundResult) { @@ -592,13 +590,13 @@ part of dart.async; void onData(T event) { timer.cancel(); controller.add(event); - timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastType43, "CompositeCast", """line 1220, column 43 of dart:async/stream.dart: """, timeout is __CastType43, false)); + timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastType38, "CompositeCast", """line 1220, column 43 of dart:async/stream.dart: """, timeout is __CastType38, false)); } void onError(error, StackTrace stackTrace) { timer.cancel(); assert (controller is _StreamController || controller is _BroadcastStreamController); var eventSink = controller; eventSink._addError(error, stackTrace); - timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastType43, "CompositeCast", """line 1228, column 43 of dart:async/stream.dart: """, timeout is __CastType43, false)); + timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastType38, "CompositeCast", """line 1228, column 43 of dart:async/stream.dart: """, timeout is __CastType38, false)); } void onDone() { timer.cancel(); @@ -613,7 +611,7 @@ part of dart.async; ; } else { - onTimeout = ((__x46) => DEVC$RT.cast(__x46, ZoneUnaryCallback, __CastType44, "CompositeCast", """line 1246, column 21 of dart:async/stream.dart: """, __x46 is __CastType44, false))(zone.registerUnaryCallback(onTimeout)); + onTimeout = ((__x41) => DEVC$RT.cast(__x41, ZoneUnaryCallback, __CastType39, "CompositeCast", """line 1246, column 21 of dart:async/stream.dart: """, __x41 is __CastType39, false))(zone.registerUnaryCallback(onTimeout)); _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(null); timeout = () { wrapper._sink = controller; @@ -623,7 +621,7 @@ part of dart.async; ; } subscription = this.listen(onData, onError: onError, onDone: onDone); - timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastType43, "CompositeCast", """line 1257, column 43 of dart:async/stream.dart: """, timeout is __CastType43, false)); + timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastType38, "CompositeCast", """line 1257, column 43 of dart:async/stream.dart: """, timeout is __CastType38, false)); } Future onCancel() { timer.cancel(); @@ -637,7 +635,7 @@ part of dart.async; } , () { subscription.resume(); - timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastType43, "CompositeCast", """line 1276, column 53 of dart:async/stream.dart: """, timeout is __CastType43, false)); + timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastType38, "CompositeCast", """line 1276, column 53 of dart:async/stream.dart: """, timeout is __CastType38, false)); } , onCancel); return controller.stream; @@ -697,11 +695,9 @@ _sink.addError(error, stackTrace); _sink.close(); } } - typedef T __CastType20(int __u21); - typedef dynamic __CastType22(dynamic __u23); - typedef EventSink __CastType25(EventSink __u26); - typedef void __CastType27(StreamSubscription __u28); - typedef void __CastType29(StreamSubscription __u30); - typedef dynamic __CastType31(dynamic __u32, StackTrace __u33); - typedef void __CastType43(); - typedef void __CastType44(EventSink __u45); + typedef EventSink __CastType20(EventSink __u21); + typedef void __CastType22(StreamSubscription __u23); + typedef void __CastType24(StreamSubscription __u25); + typedef dynamic __CastType26(dynamic __u27, StackTrace __u28); + typedef void __CastType38(); + typedef void __CastType39(EventSink __u40); diff --git a/pkg/dev_compiler/test/dart_codegen/expect/async/stream_controller.dart b/pkg/dev_compiler/test/dart_codegen/expect/async/stream_controller.dart index 364c23c08cf3..79786ce662ba 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/async/stream_controller.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/async/stream_controller.dart @@ -4,11 +4,11 @@ part of dart.async; void onListen(), void onPause(), void onResume(), onCancel(), bool sync : false} ) { if (onListen == null && onPause == null && onResume == null && onCancel == null) { - return ((__x47) => DEVC$RT.cast(__x47, DEVC$RT.type((_StreamController _) { + return ((__x42) => DEVC$RT.cast(__x42, DEVC$RT.type((_StreamController _) { } ), DEVC$RT.type((StreamController _) { } - ), "CompositeCast", """line 83, column 14 of dart:async/stream_controller.dart: """, __x47 is StreamController, false))(sync ? new _NoCallbackSyncStreamController() : new _NoCallbackAsyncStreamController()); + ), "CompositeCast", """line 83, column 14 of dart:async/stream_controller.dart: """, __x42 is StreamController, false))(sync ? new _NoCallbackSyncStreamController() : new _NoCallbackAsyncStreamController()); } return sync ? new _SyncStreamController(onListen, onPause, onResume, onCancel) : new _AsyncStreamController(onListen, onPause, onResume, onCancel); } @@ -208,9 +208,9 @@ _StreamControllerAddStreamState addState = DEVC$RT.cast(_varData, dynamic, DEVC$ if (_onCancel != null) { if (result == null) { try { - result = ((__x48) => DEVC$RT.cast(__x48, dynamic, DEVC$RT.type((Future _) { + result = ((__x43) => DEVC$RT.cast(__x43, dynamic, DEVC$RT.type((Future _) { } - ), "DynamicCast", """line 542, column 20 of dart:async/stream_controller.dart: """, __x48 is Future, true))(_onCancel()); + ), "DynamicCast", """line 542, column 20 of dart:async/stream_controller.dart: """, __x43 is Future, true))(_onCancel()); } catch (e, s) { result = new _Future().._asyncCompleteError(e, s); @@ -346,7 +346,7 @@ bool cancelOnError : true} } class _AddStreamState {final _Future addStreamFuture; final StreamSubscription addSubscription; - _AddStreamState(_EventSink controller, Stream source, bool cancelOnError) : addStreamFuture = new _Future(), addSubscription = source.listen(controller._add, onError: cancelOnError ? ((__x49) => DEVC$RT.cast(__x49, dynamic, Function, "DynamicCast", """line 747, column 48 of dart:async/stream_controller.dart: """, __x49 is Function, true))(makeErrorHandler(controller)) : controller._addError, onDone: controller._close, cancelOnError: cancelOnError); + _AddStreamState(_EventSink controller, Stream source, bool cancelOnError) : addStreamFuture = new _Future(), addSubscription = source.listen(controller._add, onError: cancelOnError ? ((__x44) => DEVC$RT.cast(__x44, dynamic, Function, "DynamicCast", """line 747, column 48 of dart:async/stream_controller.dart: """, __x44 is Function, true))(makeErrorHandler(controller)) : controller._addError, onDone: controller._close, cancelOnError: cancelOnError); static makeErrorHandler(_EventSink controller) => (e, StackTrace s) { controller._addError(e, s); controller._close(); diff --git a/pkg/dev_compiler/test/dart_codegen/expect/async/stream_impl.dart b/pkg/dev_compiler/test/dart_codegen/expect/async/stream_impl.dart index 36c71df2c85e..59d889aad510 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/async/stream_impl.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/async/stream_impl.dart @@ -41,12 +41,12 @@ assert (_isCanceled); _PendingEvents events = _pending; return events; } void onData(void handleData(T event)) { -if (handleData == null) handleData = DEVC$RT.cast(_nullDataHandler, __CastType52, DEVC$RT.type((__CastType50 _) { +if (handleData == null) handleData = DEVC$RT.cast(_nullDataHandler, __CastType47, DEVC$RT.type((__CastType45 _) { } -), "CompositeCast", """line 153, column 42 of dart:async/stream_impl.dart: """, _nullDataHandler is __CastType50, false); - _onData = ((__x54) => DEVC$RT.cast(__x54, ZoneUnaryCallback, DEVC$RT.type((_DataHandler _) { +), "CompositeCast", """line 153, column 42 of dart:async/stream_impl.dart: """, _nullDataHandler is __CastType45, false); + _onData = ((__x49) => DEVC$RT.cast(__x49, ZoneUnaryCallback, DEVC$RT.type((_DataHandler _) { } -), "CompositeCast", """line 154, column 15 of dart:async/stream_impl.dart: """, __x54 is _DataHandler, false))(_zone.registerUnaryCallback(handleData)); +), "CompositeCast", """line 154, column 15 of dart:async/stream_impl.dart: """, __x49 is _DataHandler, false))(_zone.registerUnaryCallback(handleData)); } void onError(Function handleError) { if (handleError == null) handleError = _nullErrorHandler; @@ -177,10 +177,10 @@ assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput void sendError() { if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK; if (_onError is ZoneBinaryCallback) { - _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __CastType55, "ImplicitCast", """line 358, column 32 of dart:async/stream_impl.dart: """, _onError is __CastType55, true), error, stackTrace); + _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __CastType50, "ImplicitCast", """line 358, column 32 of dart:async/stream_impl.dart: """, _onError is __CastType50, true), error, stackTrace); } else { - _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __CastType58, "ImplicitCast", """line 360, column 31 of dart:async/stream_impl.dart: """, _onError is __CastType58, true), error); + _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __CastType53, "ImplicitCast", """line 360, column 31 of dart:async/stream_impl.dart: """, _onError is __CastType53, true), error); } _state &= ~_STATE_IN_CALLBACK; } @@ -274,11 +274,11 @@ return new _BufferingStreamSubscription(onData, onError, onDone, cancelOnErro StreamSubscription _createSubscription(void onData(T data), Function onError, void onDone(), bool cancelOnError) { if (_isUsed) throw new StateError("Stream has already been listened to."); _isUsed = true; - return ((__x60) => DEVC$RT.cast(__x60, DEVC$RT.type((_BufferingStreamSubscription _) { + return ((__x55) => DEVC$RT.cast(__x55, DEVC$RT.type((_BufferingStreamSubscription _) { } ), DEVC$RT.type((StreamSubscription _) { } -), "CompositeCast", """line 515, column 12 of dart:async/stream_impl.dart: """, __x60 is StreamSubscription, false))(new _BufferingStreamSubscription(onData, onError, onDone, cancelOnError).._setPendingEvents(_pending())); +), "CompositeCast", """line 515, column 12 of dart:async/stream_impl.dart: """, __x55 is StreamSubscription, false))(new _BufferingStreamSubscription(onData, onError, onDone, cancelOnError).._setPendingEvents(_pending())); } } class _IterablePendingEvents extends _PendingEvents {Iterator _iterator; @@ -464,7 +464,7 @@ _state &= ~_SCHEDULED; final Zone _zone; _AsBroadcastStreamController _controller; StreamSubscription _subscription; - _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscription), void onCancelHandler(StreamSubscription subscription)) : _onListenHandler = ((__x61) => DEVC$RT.cast(__x61, ZoneUnaryCallback, _broadcastCallback, "CompositeCast", """line 813, column 28 of dart:async/stream_impl.dart: """, __x61 is _broadcastCallback, false))(Zone.current.registerUnaryCallback(onListenHandler)), _onCancelHandler = ((__x62) => DEVC$RT.cast(__x62, ZoneUnaryCallback, _broadcastCallback, "CompositeCast", """line 814, column 28 of dart:async/stream_impl.dart: """, __x62 is _broadcastCallback, false))(Zone.current.registerUnaryCallback(onCancelHandler)), _zone = Zone.current { + _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscription), void onCancelHandler(StreamSubscription subscription)) : _onListenHandler = ((__x56) => DEVC$RT.cast(__x56, ZoneUnaryCallback, _broadcastCallback, "CompositeCast", """line 813, column 28 of dart:async/stream_impl.dart: """, __x56 is _broadcastCallback, false))(Zone.current.registerUnaryCallback(onListenHandler)), _onCancelHandler = ((__x57) => DEVC$RT.cast(__x57, ZoneUnaryCallback, _broadcastCallback, "CompositeCast", """line 814, column 28 of dart:async/stream_impl.dart: """, __x57 is _broadcastCallback, false))(Zone.current.registerUnaryCallback(onCancelHandler)), _zone = Zone.current { _controller = new _AsBroadcastStreamController(_onListen, _onCancel); } bool get isBroadcast => true; @@ -644,7 +644,7 @@ _Future hasNext = DEVC$RT.cast(_futureOrPrefetch, dynamic, DEVC$RT.type((_ _state = _STATE_EXTRA_DONE; } } - typedef void __CastType50(T __u51); - typedef void __CastType52(dynamic __u53); - typedef dynamic __CastType55(dynamic __u56, dynamic __u57); - typedef dynamic __CastType58(dynamic __u59); + typedef void __CastType45(T __u46); + typedef void __CastType47(dynamic __u48); + typedef dynamic __CastType50(dynamic __u51, dynamic __u52); + typedef dynamic __CastType53(dynamic __u54); diff --git a/pkg/dev_compiler/test/dart_codegen/expect/async/stream_pipe.dart b/pkg/dev_compiler/test/dart_codegen/expect/async/stream_pipe.dart index 8bc784664c5f..081ecf9423ef 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/async/stream_pipe.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/async/stream_pipe.dart @@ -130,7 +130,7 @@ sink._add(inputEvent); void _handleData(S inputEvent, _EventSink sink) { T outputEvent; try { -outputEvent = ((__x63) => DEVC$RT.cast(__x63, dynamic, T, "CompositeCast", """line 235, column 21 of dart:async/stream_pipe.dart: """, __x63 is T, false))(_transform(inputEvent)); +outputEvent = ((__x58) => DEVC$RT.cast(__x58, dynamic, T, "CompositeCast", """line 235, column 21 of dart:async/stream_pipe.dart: """, __x58 is T, false))(_transform(inputEvent)); } catch (e, s) { _addErrorWithReplacement(sink, e, s); diff --git a/pkg/dev_compiler/test/dart_codegen/expect/async/stream_transformers.dart b/pkg/dev_compiler/test/dart_codegen/expect/async/stream_transformers.dart index 89dd0b43ffaa..d1fddb575974 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/async/stream_transformers.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/async/stream_transformers.dart @@ -117,17 +117,17 @@ cancelOnError = identical(true, cancelOnError); } class _StreamHandlerTransformer extends _StreamSinkTransformer {_StreamHandlerTransformer({ void handleData(S data, EventSink sink), void handleError(Object error, StackTrace stackTrace, EventSink sink), void handleDone(EventSink sink)} -) : super(((__x66) => DEVC$RT.cast(__x66, DEVC$RT.type((__CastType64 _) { +) : super(((__x61) => DEVC$RT.cast(__x61, DEVC$RT.type((__CastType59 _) { } ), DEVC$RT.type((_SinkMapper _) { } -), "InferableClosure", """line 233, column 15 of dart:async/stream_transformers.dart: """, __x66 is _SinkMapper, false))((EventSink outputSink) { -if (handleData == null) handleData = DEVC$RT.cast(_defaultHandleData, __CastType70, DEVC$RT.type((__CastType67 _) { +), "InferableClosure", """line 233, column 15 of dart:async/stream_transformers.dart: """, __x61 is _SinkMapper, false))((EventSink outputSink) { +if (handleData == null) handleData = DEVC$RT.cast(_defaultHandleData, __CastType65, DEVC$RT.type((__CastType62 _) { } -), "CompositeCast", """line 234, column 48 of dart:async/stream_transformers.dart: """, _defaultHandleData is __CastType67, false); - if (handleError == null) handleError = DEVC$RT.cast(_defaultHandleError, __CastType77, DEVC$RT.type((__CastType73 _) { +), "CompositeCast", """line 234, column 48 of dart:async/stream_transformers.dart: """, _defaultHandleData is __CastType62, false); + if (handleError == null) handleError = DEVC$RT.cast(_defaultHandleError, __CastType72, DEVC$RT.type((__CastType68 _) { } -), "CompositeCast", """line 235, column 50 of dart:async/stream_transformers.dart: """, _defaultHandleError is __CastType73, false); +), "CompositeCast", """line 235, column 50 of dart:async/stream_transformers.dart: """, _defaultHandleError is __CastType68, false); if (handleDone == null) handleDone = _defaultHandleDone; return new _HandlerEventSink(handleData, handleError, handleDone, outputSink); } @@ -164,8 +164,8 @@ cancelOnError = identical(true, cancelOnError); return result; } } - typedef dynamic __CastType64(EventSink __u65); - typedef void __CastType67(S __u68, EventSink __u69); - typedef void __CastType70(dynamic __u71, EventSink __u72); - typedef void __CastType73(Object __u74, StackTrace __u75, EventSink __u76); - typedef void __CastType77(dynamic __u78, StackTrace __u79, EventSink __u80); + typedef dynamic __CastType59(EventSink __u60); + typedef void __CastType62(S __u63, EventSink __u64); + typedef void __CastType65(dynamic __u66, EventSink __u67); + typedef void __CastType68(Object __u69, StackTrace __u70, EventSink __u71); + typedef void __CastType72(dynamic __u73, StackTrace __u74, EventSink __u75); diff --git a/pkg/dev_compiler/test/dart_codegen/expect/async/timer.dart b/pkg/dev_compiler/test/dart_codegen/expect/async/timer.dart index a2edab3d569b..8912b46da191 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/async/timer.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/async/timer.dart @@ -9,7 +9,7 @@ part of dart.async; if (Zone.current == Zone.ROOT) { return Zone.current.createPeriodicTimer(duration, callback); } - return Zone.current.createPeriodicTimer(duration, ((__x83) => DEVC$RT.cast(__x83, ZoneUnaryCallback, __CastType81, "CompositeCast", """line 80, column 19 of dart:async/timer.dart: """, __x83 is __CastType81, false))(Zone.current.bindUnaryCallback(callback, runGuarded: true))); + return Zone.current.createPeriodicTimer(duration, ((__x78) => DEVC$RT.cast(__x78, ZoneUnaryCallback, __CastType76, "CompositeCast", """line 80, column 19 of dart:async/timer.dart: """, __x78 is __CastType76, false))(Zone.current.bindUnaryCallback(callback, runGuarded: true))); } static void run(void callback()) { new Timer(Duration.ZERO, callback); @@ -19,4 +19,4 @@ part of dart.async; external static Timer _createTimer(Duration duration, void callback()); external static Timer _createPeriodicTimer(Duration duration, void callback(Timer timer)); } - typedef void __CastType81(Timer __u82); + typedef void __CastType76(Timer __u77); diff --git a/pkg/dev_compiler/test/dart_codegen/expect/async/zone.dart b/pkg/dev_compiler/test/dart_codegen/expect/async/zone.dart index 852da4cf12e7..ef80f673e404 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/async/zone.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/async/zone.dart @@ -150,23 +150,23 @@ _ZoneFunction implementation = _delegationTarget._runBinary; ZoneCallback registerCallback(Zone zone, f()) { _ZoneFunction implementation = _delegationTarget._registerCallback; _Zone implZone = implementation.zone; - return ((__x84) => DEVC$RT.cast(__x84, dynamic, ZoneCallback, "DynamicCast", """line 522, column 12 of dart:async/zone.dart: """, __x84 is ZoneCallback, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, f)); + return ((__x79) => DEVC$RT.cast(__x79, dynamic, ZoneCallback, "DynamicCast", """line 522, column 12 of dart:async/zone.dart: """, __x79 is ZoneCallback, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, f)); } ZoneUnaryCallback registerUnaryCallback(Zone zone, f(arg)) { _ZoneFunction implementation = _delegationTarget._registerUnaryCallback; _Zone implZone = implementation.zone; - return ((__x85) => DEVC$RT.cast(__x85, dynamic, ZoneUnaryCallback, "DynamicCast", """line 529, column 12 of dart:async/zone.dart: """, __x85 is ZoneUnaryCallback, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, f)); + return ((__x80) => DEVC$RT.cast(__x80, dynamic, ZoneUnaryCallback, "DynamicCast", """line 529, column 12 of dart:async/zone.dart: """, __x80 is ZoneUnaryCallback, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, f)); } ZoneBinaryCallback registerBinaryCallback(Zone zone, f(arg1, arg2)) { _ZoneFunction implementation = _delegationTarget._registerBinaryCallback; _Zone implZone = implementation.zone; - return ((__x86) => DEVC$RT.cast(__x86, dynamic, ZoneBinaryCallback, "DynamicCast", """line 536, column 12 of dart:async/zone.dart: """, __x86 is ZoneBinaryCallback, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, f)); + return ((__x81) => DEVC$RT.cast(__x81, dynamic, ZoneBinaryCallback, "DynamicCast", """line 536, column 12 of dart:async/zone.dart: """, __x81 is ZoneBinaryCallback, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, f)); } AsyncError errorCallback(Zone zone, Object error, StackTrace stackTrace) { _ZoneFunction implementation = _delegationTarget._errorCallback; _Zone implZone = implementation.zone; if (identical(implZone, _ROOT_ZONE)) return null; - return ((__x87) => DEVC$RT.cast(__x87, dynamic, AsyncError, "DynamicCast", """line 544, column 12 of dart:async/zone.dart: """, __x87 is AsyncError, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, error, stackTrace)); + return ((__x82) => DEVC$RT.cast(__x82, dynamic, AsyncError, "DynamicCast", """line 544, column 12 of dart:async/zone.dart: """, __x82 is AsyncError, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, error, stackTrace)); } void scheduleMicrotask(Zone zone, f()) { _ZoneFunction implementation = _delegationTarget._scheduleMicrotask; @@ -176,12 +176,12 @@ _ZoneFunction implementation = _delegationTarget._scheduleMicrotask; Timer createTimer(Zone zone, Duration duration, void f()) { _ZoneFunction implementation = _delegationTarget._createTimer; _Zone implZone = implementation.zone; - return ((__x88) => DEVC$RT.cast(__x88, dynamic, Timer, "DynamicCast", """line 558, column 12 of dart:async/zone.dart: """, __x88 is Timer, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, duration, f)); + return ((__x83) => DEVC$RT.cast(__x83, dynamic, Timer, "DynamicCast", """line 558, column 12 of dart:async/zone.dart: """, __x83 is Timer, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, duration, f)); } Timer createPeriodicTimer(Zone zone, Duration period, void f(Timer timer)) { _ZoneFunction implementation = _delegationTarget._createPeriodicTimer; _Zone implZone = implementation.zone; - return ((__x89) => DEVC$RT.cast(__x89, dynamic, Timer, "DynamicCast", """line 565, column 12 of dart:async/zone.dart: """, __x89 is Timer, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, period, f)); + return ((__x84) => DEVC$RT.cast(__x84, dynamic, Timer, "DynamicCast", """line 565, column 12 of dart:async/zone.dart: """, __x84 is Timer, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, period, f)); } void print(Zone zone, String line) { _ZoneFunction implementation = _delegationTarget._print; @@ -191,7 +191,7 @@ _ZoneFunction implementation = _delegationTarget._print; Zone fork(Zone zone, ZoneSpecification specification, Map zoneValues) { _ZoneFunction implementation = _delegationTarget._fork; _Zone implZone = implementation.zone; - return ((__x90) => DEVC$RT.cast(__x90, dynamic, Zone, "DynamicCast", """line 580, column 12 of dart:async/zone.dart: """, __x90 is Zone, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, specification, zoneValues)); + return ((__x85) => DEVC$RT.cast(__x85, dynamic, Zone, "DynamicCast", """line 580, column 12 of dart:async/zone.dart: """, __x85 is Zone, true))((implementation.function)(implZone, _parentDelegate(implZone), zone, specification, zoneValues)); } } abstract class _Zone implements Zone {const _Zone(); @@ -331,7 +331,7 @@ ZoneSpecification specification, Map zoneValues} ) { _ZoneFunction implementation = this._fork; assert (implementation != null); ZoneDelegate parentDelegate = _parentDelegate(implementation.zone); - return ((__x91) => DEVC$RT.cast(__x91, dynamic, Zone, "DynamicCast", """line 787, column 12 of dart:async/zone.dart: """, __x91 is Zone, true))((implementation.function)(implementation.zone, parentDelegate, this, specification, zoneValues)); + return ((__x86) => DEVC$RT.cast(__x86, dynamic, Zone, "DynamicCast", """line 787, column 12 of dart:async/zone.dart: """, __x86 is Zone, true))((implementation.function)(implementation.zone, parentDelegate, this, specification, zoneValues)); } dynamic run(f()) { _ZoneFunction implementation = this._run; @@ -351,24 +351,24 @@ _ZoneFunction implementation = this._runBinary; ZoneCallback registerCallback(f()) { _ZoneFunction implementation = this._registerCallback; assert (implementation != null); ZoneDelegate parentDelegate = _parentDelegate(implementation.zone); - return ((__x92) => DEVC$RT.cast(__x92, dynamic, ZoneCallback, "DynamicCast", """line 820, column 12 of dart:async/zone.dart: """, __x92 is ZoneCallback, true))((implementation.function)(implementation.zone, parentDelegate, this, f)); + return ((__x87) => DEVC$RT.cast(__x87, dynamic, ZoneCallback, "DynamicCast", """line 820, column 12 of dart:async/zone.dart: """, __x87 is ZoneCallback, true))((implementation.function)(implementation.zone, parentDelegate, this, f)); } ZoneUnaryCallback registerUnaryCallback(f(arg)) { _ZoneFunction implementation = this._registerUnaryCallback; assert (implementation != null); ZoneDelegate parentDelegate = _parentDelegate(implementation.zone); - return ((__x93) => DEVC$RT.cast(__x93, dynamic, ZoneUnaryCallback, "DynamicCast", """line 828, column 12 of dart:async/zone.dart: """, __x93 is ZoneUnaryCallback, true))((implementation.function)(implementation.zone, parentDelegate, this, f)); + return ((__x88) => DEVC$RT.cast(__x88, dynamic, ZoneUnaryCallback, "DynamicCast", """line 828, column 12 of dart:async/zone.dart: """, __x88 is ZoneUnaryCallback, true))((implementation.function)(implementation.zone, parentDelegate, this, f)); } ZoneBinaryCallback registerBinaryCallback(f(arg1, arg2)) { _ZoneFunction implementation = this._registerBinaryCallback; assert (implementation != null); ZoneDelegate parentDelegate = _parentDelegate(implementation.zone); - return ((__x94) => DEVC$RT.cast(__x94, dynamic, ZoneBinaryCallback, "DynamicCast", """line 836, column 12 of dart:async/zone.dart: """, __x94 is ZoneBinaryCallback, true))((implementation.function)(implementation.zone, parentDelegate, this, f)); + return ((__x89) => DEVC$RT.cast(__x89, dynamic, ZoneBinaryCallback, "DynamicCast", """line 836, column 12 of dart:async/zone.dart: """, __x89 is ZoneBinaryCallback, true))((implementation.function)(implementation.zone, parentDelegate, this, f)); } AsyncError errorCallback(Object error, StackTrace stackTrace) { final _ZoneFunction implementation = this._errorCallback; assert (implementation != null); final Zone implementationZone = implementation.zone; if (identical(implementationZone, _ROOT_ZONE)) return null; final ZoneDelegate parentDelegate = _parentDelegate(DEVC$RT.cast(implementationZone, Zone, _Zone, "ImplicitCast", """line 845, column 57 of dart:async/zone.dart: """, implementationZone is _Zone, true)); - return ((__x95) => DEVC$RT.cast(__x95, dynamic, AsyncError, "DynamicCast", """line 846, column 12 of dart:async/zone.dart: """, __x95 is AsyncError, true))((implementation.function)(implementationZone, parentDelegate, this, error, stackTrace)); + return ((__x90) => DEVC$RT.cast(__x90, dynamic, AsyncError, "DynamicCast", """line 846, column 12 of dart:async/zone.dart: """, __x90 is AsyncError, true))((implementation.function)(implementationZone, parentDelegate, this, error, stackTrace)); } void scheduleMicrotask(void f()) { _ZoneFunction implementation = this._scheduleMicrotask; @@ -378,12 +378,12 @@ _ZoneFunction implementation = this._scheduleMicrotask; Timer createTimer(Duration duration, void f()) { _ZoneFunction implementation = this._createTimer; assert (implementation != null); ZoneDelegate parentDelegate = _parentDelegate(implementation.zone); - return ((__x96) => DEVC$RT.cast(__x96, dynamic, Timer, "DynamicCast", """line 862, column 12 of dart:async/zone.dart: """, __x96 is Timer, true))((implementation.function)(implementation.zone, parentDelegate, this, duration, f)); + return ((__x91) => DEVC$RT.cast(__x91, dynamic, Timer, "DynamicCast", """line 862, column 12 of dart:async/zone.dart: """, __x91 is Timer, true))((implementation.function)(implementation.zone, parentDelegate, this, duration, f)); } Timer createPeriodicTimer(Duration duration, void f(Timer timer)) { _ZoneFunction implementation = this._createPeriodicTimer; assert (implementation != null); ZoneDelegate parentDelegate = _parentDelegate(implementation.zone); - return ((__x97) => DEVC$RT.cast(__x97, dynamic, Timer, "DynamicCast", """line 870, column 12 of dart:async/zone.dart: """, __x97 is Timer, true))((implementation.function)(implementation.zone, parentDelegate, this, duration, f)); + return ((__x92) => DEVC$RT.cast(__x92, dynamic, Timer, "DynamicCast", """line 870, column 12 of dart:async/zone.dart: """, __x92 is Timer, true))((implementation.function)(implementation.zone, parentDelegate, this, duration, f)); } void print(String line) { _ZoneFunction implementation = this._print; @@ -452,7 +452,7 @@ callback = zone.bindCallback(callback); } Timer _rootCreatePeriodicTimer(Zone self, ZoneDelegate parent, Zone zone, Duration duration, void callback(Timer timer)) { if (!identical(_ROOT_ZONE, zone)) { -callback = ((__x100) => DEVC$RT.cast(__x100, ZoneUnaryCallback, __CastType98, "CompositeCast", """line 962, column 16 of dart:async/zone.dart: """, __x100 is __CastType98, false))(zone.bindUnaryCallback(callback)); +callback = ((__x95) => DEVC$RT.cast(__x95, ZoneUnaryCallback, __CastType93, "CompositeCast", """line 962, column 16 of dart:async/zone.dart: """, __x95 is __CastType93, false))(zone.bindUnaryCallback(callback)); } return Timer._createPeriodicTimer(duration, callback); } @@ -633,7 +633,7 @@ try { if (onError is ZoneBinaryCallback) { return self.parent.runBinary(onError, error, stackTrace); } - return self.parent.runUnary(DEVC$RT.cast(onError, Function, __CastType101, "ImplicitCast", """line 1228, column 37 of dart:async/zone.dart: """, onError is __CastType101, true), error); + return self.parent.runUnary(DEVC$RT.cast(onError, Function, __CastType96, "ImplicitCast", """line 1228, column 37 of dart:async/zone.dart: """, onError is __CastType96, true), error); } catch (e, s) { if (identical(e, error)) { @@ -660,5 +660,5 @@ return zone.runGuarded(body); return zone.run(body); } } - typedef void __CastType98(Timer __u99); - typedef dynamic __CastType101(dynamic __u102); + typedef void __CastType93(Timer __u94); + typedef dynamic __CastType96(dynamic __u97); diff --git a/pkg/dev_compiler/test/dart_codegen/expect/collection/hash_map.dart b/pkg/dev_compiler/test/dart_codegen/expect/collection/hash_map.dart index 53ecbbbaece6..5232e4759161 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/collection/hash_map.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/collection/hash_map.dart @@ -1,6 +1,6 @@ part of dart.collection; - bool _defaultEquals(a, b) => a == b; - int _defaultHashCode(a) => a.hashCode; + bool _defaultEquals(Object a, Object b) => a == b; + int _defaultHashCode(Object a) => a.hashCode; typedef bool _Equality(K a, K b); typedef int _Hasher(K object); abstract class HashMap implements Map {external factory HashMap({ diff --git a/pkg/dev_compiler/test/dart_codegen/expect/collection/iterable.dart b/pkg/dev_compiler/test/dart_codegen/expect/collection/iterable.dart index 7b575a107fcb..41daebb1451e 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/collection/iterable.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/collection/iterable.dart @@ -84,27 +84,27 @@ part of dart.collection; return new SkipWhileIterable(this, test); } E get first { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } - return DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 127, column 12 of dart:collection/iterable.dart: """, it.current is E, false); + return it.current; } E get last { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } E result; do { - result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 137, column 16 of dart:collection/iterable.dart: """, it.current is E, false); + result = it.current; } while (it.moveNext()); return result; } E get single { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); - E result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 145, column 16 of dart:collection/iterable.dart: """, it.current is E, false); + E result = it.current; if (it.moveNext()) throw IterableElementError.tooMany(); return result; } @@ -224,7 +224,7 @@ bool growable : true} Set toSet() => new Set.from(this); int get length { assert (this is! EfficientLength); int count = 0; - Iterator it = iterator; + Iterator it = iterator; while (it.moveNext()) { count++; } @@ -245,27 +245,27 @@ return new SkipIterable(this, n); return new SkipWhileIterable(this, test); } E get first { -Iterator it = iterator; +Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } - return DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 323, column 12 of dart:collection/iterable.dart: """, it.current is E, false); + return it.current; } E get last { -Iterator it = iterator; +Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } E result; do { - result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 333, column 16 of dart:collection/iterable.dart: """, it.current is E, false); + result = it.current; } while (it.moveNext()); return result; } E get single { -Iterator it = iterator; +Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); - E result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 341, column 16 of dart:collection/iterable.dart: """, it.current is E, false); + E result = it.current; if (it.moveNext()) throw IterableElementError.tooMany(); return result; } diff --git a/pkg/dev_compiler/test/dart_codegen/expect/collection/set.dart b/pkg/dev_compiler/test/dart_codegen/expect/collection/set.dart index fce67582bc0c..36a6eeb54f71 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/collection/set.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/collection/set.dart @@ -72,9 +72,9 @@ part of dart.collection; Iterable map(f(E element)) => new EfficientLengthMappedIterable(this, f); E get single { if (length > 1) throw IterableElementError.tooMany(); - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); - E result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 130, column 16 of dart:collection/set.dart: """, it.current is E, false); + E result = it.current; return result; } String toString() => IterableBase.iterableToFullString(this, '{', '}'); @@ -142,20 +142,20 @@ part of dart.collection; return new SkipWhileIterable(this, test); } E get first { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } - return DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 220, column 12 of dart:collection/set.dart: """, it.current is E, false); + return it.current; } E get last { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } E result; do { - result = DEVC$RT.cast(it.current, dynamic, E, "CompositeCast", """line 230, column 16 of dart:collection/set.dart: """, it.current is E, false); + result = it.current; } while (it.moveNext()); return result; } diff --git a/pkg/dev_compiler/test/dart_codegen/expect/collection/splay_tree.dart b/pkg/dev_compiler/test/dart_codegen/expect/collection/splay_tree.dart index 967d63db6131..3a416b2c3d80 100644 --- a/pkg/dev_compiler/test/dart_codegen/expect/collection/splay_tree.dart +++ b/pkg/dev_compiler/test/dart_codegen/expect/collection/splay_tree.dart @@ -144,26 +144,26 @@ _root = null; } } class SplayTreeMap extends _SplayTree implements Map {Comparator _comparator; - _Predicate _validKey; - SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) : _comparator = ((__x12) => DEVC$RT.cast(__x12, dynamic, DEVC$RT.type((Comparator _) { + _Predicate _validKey; + SplayTreeMap([int compare(K key1, K key2), bool isValidKey(Object potentialKey)]) : _comparator = ((__x12) => DEVC$RT.cast(__x12, dynamic, DEVC$RT.type((Comparator _) { } -), "CompositeCast", """line 264, column 23 of dart:collection/splay_tree.dart: """, __x12 is Comparator, false))((compare == null) ? Comparable.compare : compare), _validKey = (isValidKey != null) ? isValidKey : ((v) => v is K); - factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), bool isValidKey(potentialKey)]) { +), "CompositeCast", """line 265, column 23 of dart:collection/splay_tree.dart: """, __x12 is Comparator, false))((compare == null) ? Comparable.compare : compare), _validKey = (isValidKey != null) ? isValidKey : ((v) => v is K); + factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), bool isValidKey(Object potentialKey)]) { SplayTreeMap result = new SplayTreeMap(); other.forEach((k, v) { -result[k] = DEVC$RT.cast(v, dynamic, V, "CompositeCast", """line 274, column 40 of dart:collection/splay_tree.dart: """, v is V, false); +result[k] = DEVC$RT.cast(v, dynamic, V, "CompositeCast", """line 275, column 40 of dart:collection/splay_tree.dart: """, v is V, false); } ); return result; } factory SplayTreeMap.fromIterable(Iterable iterable, { -K key(element), V value(element), int compare(K key1, K key2), bool isValidKey(potentialKey)} +K key(element), V value(element), int compare(K key1, K key2), bool isValidKey(Object potentialKey)} ) { SplayTreeMap map = new SplayTreeMap(compare, isValidKey); Maps._fillMapWithMappedIterable(map, iterable, key, value); return map; } - factory SplayTreeMap.fromIterables(Iterable keys, Iterable values, [int compare(K key1, K key2), bool isValidKey(potentialKey)]) { + factory SplayTreeMap.fromIterables(Iterable keys, Iterable values, [int compare(K key1, K key2), bool isValidKey(Object potentialKey)]) { SplayTreeMap map = new SplayTreeMap(compare, isValidKey); Maps._fillMapWithIterables(map, keys, values); return map; @@ -174,14 +174,14 @@ SplayTreeMap map = new SplayTreeMap(compare, isValidKey); if (key == null) throw new ArgumentError(key); if (!_validKey(key)) return null; if (_root != null) { -int comp = _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 327, column 25 of dart:collection/splay_tree.dart: """, key is K, false)); +int comp = _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 328, column 25 of dart:collection/splay_tree.dart: """, key is K, false)); if (comp == 0) { _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode _) { } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "AssignmentCast", """line 329, column 37 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode, true); - return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 330, column 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); +), "AssignmentCast", """line 330, column 37 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode, true); + return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 331, column 16 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); } } return null; @@ -192,8 +192,8 @@ if (!_validKey(key)) return null; } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "AssignmentCast", """line 338, column 33 of dart:collection/splay_tree.dart: """, __x13 is _SplayTreeMapNode, true))(_remove(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 338, column 41 of dart:collection/splay_tree.dart: """, key is K, false))); - if (mapRoot != null) return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 339, column 33 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); +), "AssignmentCast", """line 339, column 33 of dart:collection/splay_tree.dart: """, __x13 is _SplayTreeMapNode, true))(_remove(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 339, column 41 of dart:collection/splay_tree.dart: """, key is K, false))); + if (mapRoot != null) return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 340, column 33 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); return null; } void operator []=(K key, V value) { @@ -204,7 +204,7 @@ _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "AssignmentCast", """line 349, column 35 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode, true); +), "AssignmentCast", """line 350, column 35 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode, true); mapRoot.value = value; return;} _addNewRoot(new _SplayTreeMapNode(key, value), comp); @@ -217,8 +217,8 @@ _SplayTreeMapNode mapRoot = DEVC$RT.cast(_root, DEVC$RT.type((_SplayTreeNode } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "AssignmentCast", """line 361, column 35 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode, true); - return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 362, column 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); +), "AssignmentCast", """line 362, column 35 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode, true); + return DEVC$RT.cast(mapRoot.value, dynamic, V, "CompositeCast", """line 363, column 14 of dart:collection/splay_tree.dart: """, mapRoot.value is V, false); } int modificationCount = _modificationCount; int splayCount = _splayCount; @@ -249,7 +249,7 @@ _SplayTreeMapNode node = DEVC$RT.cast(nodes.current, DEVC$RT.type((_SplayT } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "CompositeCast", """line 393, column 38 of dart:collection/splay_tree.dart: """, nodes.current is _SplayTreeMapNode, false); +), "CompositeCast", """line 394, column 38 of dart:collection/splay_tree.dart: """, nodes.current is _SplayTreeMapNode, false); f(node.key, node.value); } } @@ -260,7 +260,7 @@ return _count; _clear(); } bool containsKey(Object key) { -return _validKey(key) && _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 407, column 37 of dart:collection/splay_tree.dart: """, key is K, false)) == 0; +return _validKey(key) && _splay(DEVC$RT.cast(key, Object, K, "CompositeCast", """line 408, column 37 of dart:collection/splay_tree.dart: """, key is K, false)) == 0; } bool containsValue(Object value) { bool found = false; @@ -275,12 +275,12 @@ if (node.value == value) return true; } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "ImplicitCast", """line 419, column 41 of dart:collection/splay_tree.dart: """, node.right is _SplayTreeMapNode, true))) return true; +), "ImplicitCast", """line 420, column 41 of dart:collection/splay_tree.dart: """, node.right is _SplayTreeMapNode, true))) return true; node = DEVC$RT.cast(node.left, DEVC$RT.type((_SplayTreeNode _) { } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "ImplicitCast", """line 420, column 16 of dart:collection/splay_tree.dart: """, node.left is _SplayTreeMapNode, true); +), "ImplicitCast", """line 421, column 16 of dart:collection/splay_tree.dart: """, node.left is _SplayTreeMapNode, true); } return false; } @@ -288,7 +288,7 @@ if (node.value == value) return true; } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "ImplicitCast", """line 424, column 18 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode, true)); +), "ImplicitCast", """line 425, column 18 of dart:collection/splay_tree.dart: """, _root is _SplayTreeMapNode, true)); } Iterable get keys => new _SplayTreeKeyIterable(this); Iterable get values => new _SplayTreeValueIterable(this); @@ -297,11 +297,11 @@ return Maps.mapToString(this); } K firstKey() { if (_root == null) return null; - return DEVC$RT.cast(_first.key, dynamic, K, "CompositeCast", """line 440, column 12 of dart:collection/splay_tree.dart: """, _first.key is K, false); + return DEVC$RT.cast(_first.key, dynamic, K, "CompositeCast", """line 441, column 12 of dart:collection/splay_tree.dart: """, _first.key is K, false); } K lastKey() { if (_root == null) return null; - return DEVC$RT.cast(_last.key, dynamic, K, "CompositeCast", """line 448, column 12 of dart:collection/splay_tree.dart: """, _last.key is K, false); + return DEVC$RT.cast(_last.key, dynamic, K, "CompositeCast", """line 449, column 12 of dart:collection/splay_tree.dart: """, _last.key is K, false); } K lastKeyBefore(K key) { if (key == null) throw new ArgumentError(key); @@ -352,7 +352,7 @@ if (_currentNode == null) return null; } ), DEVC$RT.type((_SplayTreeMapNode _) { } -), "ImplicitCast", """line 544, column 22 of dart:collection/splay_tree.dart: """, _currentNode is _SplayTreeMapNode, true)); +), "ImplicitCast", """line 545, column 22 of dart:collection/splay_tree.dart: """, _currentNode is _SplayTreeMapNode, true)); } void _findLeftMostDescendent(_SplayTreeNode node) { while (node != null) { @@ -396,7 +396,7 @@ _rebuildWorkList(_currentNode); var setOrMap = _tree; SplayTreeSet set = new SplayTreeSet(DEVC$RT.cast(setOrMap._comparator, dynamic, DEVC$RT.type((__CastType14 _) { } -), "CompositeCast", """line 609, column 29 of dart:collection/splay_tree.dart: """, setOrMap._comparator is __CastType14, false), DEVC$RT.cast(setOrMap._validKey, dynamic, __CastType17, "CompositeCast", """line 609, column 51 of dart:collection/splay_tree.dart: """, setOrMap._validKey is __CastType17, false)); +), "CompositeCast", """line 610, column 29 of dart:collection/splay_tree.dart: """, setOrMap._comparator is __CastType14, false), DEVC$RT.cast(setOrMap._validKey, dynamic, __CastType17, "CompositeCast", """line 610, column 51 of dart:collection/splay_tree.dart: """, setOrMap._validKey is __CastType17, false)); set._count = _tree._count; set._root = set._copyNode(_tree._root); return set; @@ -409,10 +409,10 @@ var setOrMap = _tree; Iterator get iterator => new _SplayTreeValueIterator(_map); } class _SplayTreeKeyIterator extends _SplayTreeIterator {_SplayTreeKeyIterator(_SplayTree map) : super(map); - K _getValue(_SplayTreeNode node) => DEVC$RT.cast(node.key, dynamic, K, "CompositeCast", """line 627, column 39 of dart:collection/splay_tree.dart: """, node.key is K, false); + K _getValue(_SplayTreeNode node) => DEVC$RT.cast(node.key, dynamic, K, "CompositeCast", """line 628, column 39 of dart:collection/splay_tree.dart: """, node.key is K, false); } class _SplayTreeValueIterator extends _SplayTreeIterator {_SplayTreeValueIterator(SplayTreeMap map) : super(map); - V _getValue(_SplayTreeMapNode node) => DEVC$RT.cast(node.value, dynamic, V, "CompositeCast", """line 632, column 42 of dart:collection/splay_tree.dart: """, node.value is V, false); + V _getValue(_SplayTreeMapNode node) => DEVC$RT.cast(node.value, dynamic, V, "CompositeCast", """line 633, column 42 of dart:collection/splay_tree.dart: """, node.value is V, false); } class _SplayTreeNodeIterator extends _SplayTreeIterator<_SplayTreeNode> {_SplayTreeNodeIterator(_SplayTree tree) : super(tree); _SplayTreeNodeIterator.startAt(_SplayTree tree, var startKey) : super.startAt(tree, startKey); @@ -420,18 +420,20 @@ var setOrMap = _tree; } ), DEVC$RT.type((_SplayTreeNode _) { } -), "CompositeCast", """line 640, column 55 of dart:collection/splay_tree.dart: """, node is _SplayTreeNode, false); +), "CompositeCast", """line 641, column 55 of dart:collection/splay_tree.dart: """, node is _SplayTreeNode, false); } - class SplayTreeSet extends _SplayTree with IterableMixin, SetMixin {Comparator _comparator; - _Predicate _validKey; - SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) : _comparator = (compare == null) ? Comparable.compare : compare, _validKey = (isValidKey != null) ? isValidKey : ((v) => v is E); - factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool isValidKey(potentialKey)]) { + class SplayTreeSet extends _SplayTree with IterableMixin, SetMixin {Comparator _comparator; + _Predicate _validKey; + SplayTreeSet([int compare(E key1, E key2), bool isValidKey(Object potentialKey)]) : _comparator = ((__x19) => DEVC$RT.cast(__x19, dynamic, DEVC$RT.type((Comparator _) { +} +), "CompositeCast", """line 691, column 23 of dart:collection/splay_tree.dart: """, __x19 is Comparator, false))((compare == null) ? Comparable.compare : compare), _validKey = (isValidKey != null) ? isValidKey : ((v) => v is E); + factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), bool isValidKey(Object potentialKey)]) { SplayTreeSet result = new SplayTreeSet(compare, isValidKey); for (final E element in DEVC$RT.cast(elements, DEVC$RT.type((Iterable _) { } ), DEVC$RT.type((Iterable _) { } -), "CompositeCast", """line 703, column 29 of dart:collection/splay_tree.dart: """, elements is Iterable, false)) { +), "CompositeCast", """line 705, column 29 of dart:collection/splay_tree.dart: """, elements is Iterable, false)) { result.add(element); } return result; @@ -443,11 +445,11 @@ result.add(element); bool get isNotEmpty => _root != null; E get first { if (_count == 0) throw IterableElementError.noElement(); - return DEVC$RT.cast(_first.key, dynamic, E, "CompositeCast", """line 721, column 12 of dart:collection/splay_tree.dart: """, _first.key is E, false); + return DEVC$RT.cast(_first.key, dynamic, E, "CompositeCast", """line 723, column 12 of dart:collection/splay_tree.dart: """, _first.key is E, false); } E get last { if (_count == 0) throw IterableElementError.noElement(); - return DEVC$RT.cast(_last.key, dynamic, E, "CompositeCast", """line 726, column 12 of dart:collection/splay_tree.dart: """, _last.key is E, false); + return DEVC$RT.cast(_last.key, dynamic, E, "CompositeCast", """line 728, column 12 of dart:collection/splay_tree.dart: """, _last.key is E, false); } E get single { if (_count == 0) throw IterableElementError.noElement(); @@ -455,7 +457,7 @@ if (_count == 0) throw IterableElementError.noElement(); return _root.key; } bool contains(Object object) { -return _validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 737, column 40 of dart:collection/splay_tree.dart: """, object is E, false)) == 0; +return _validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 739, column 40 of dart:collection/splay_tree.dart: """, object is E, false)) == 0; } bool add(E element) { int compare = _splay(element); @@ -465,7 +467,7 @@ int compare = _splay(element); } bool remove(Object object) { if (!_validKey(object)) return false; - return _remove(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 749, column 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null; + return _remove(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 751, column 20 of dart:collection/splay_tree.dart: """, object is E, false)) != null; } void addAll(Iterable elements) { for (E element in elements) { @@ -477,21 +479,17 @@ _addNewRoot(new _SplayTreeNode(element), compare); } void removeAll(Iterable elements) { for (Object element in elements) { -if (_validKey(element)) _remove(DEVC$RT.cast(element, Object, E, "CompositeCast", """line 763, column 39 of dart:collection/splay_tree.dart: """, element is E, false)); +if (_validKey(element)) _remove(DEVC$RT.cast(element, Object, E, "CompositeCast", """line 765, column 39 of dart:collection/splay_tree.dart: """, element is E, false)); } } void retainAll(Iterable elements) { -SplayTreeSet retainSet = new SplayTreeSet(DEVC$RT.cast(_comparator, DEVC$RT.type((Comparator _) { -} -), DEVC$RT.type((__CastType19 _) { -} -), "CompositeCast", """line 769, column 53 of dart:collection/splay_tree.dart: """, _comparator is __CastType19, false), _validKey); +SplayTreeSet retainSet = new SplayTreeSet(_comparator, _validKey); int modificationCount = _modificationCount; for (Object object in elements) { if (modificationCount != _modificationCount) { throw new ConcurrentModificationError(this); } - if (_validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 777, column 39 of dart:collection/splay_tree.dart: """, object is E, false)) == 0) retainSet.add(_root.key); + if (_validKey(object) && _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 779, column 39 of dart:collection/splay_tree.dart: """, object is E, false)) == 0) retainSet.add(_root.key); } if (retainSet._count != _count) { _root = retainSet._root; @@ -501,27 +499,19 @@ _root = retainSet._root; } E lookup(Object object) { if (!_validKey(object)) return null; - int comp = _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 789, column 23 of dart:collection/splay_tree.dart: """, object is E, false)); + int comp = _splay(DEVC$RT.cast(object, Object, E, "CompositeCast", """line 791, column 23 of dart:collection/splay_tree.dart: """, object is E, false)); if (comp != 0) return null; return _root.key; } Set intersection(Set other) { -Set result = new SplayTreeSet(DEVC$RT.cast(_comparator, DEVC$RT.type((Comparator _) { -} -), DEVC$RT.type((__CastType19 _) { -} -), "CompositeCast", """line 795, column 41 of dart:collection/splay_tree.dart: """, _comparator is __CastType19, false), _validKey); +Set result = new SplayTreeSet(_comparator, _validKey); for (E element in this) { if (other.contains(element)) result.add(element); } return result; } Set difference(Set other) { -Set result = new SplayTreeSet(DEVC$RT.cast(_comparator, DEVC$RT.type((Comparator _) { -} -), DEVC$RT.type((__CastType19 _) { -} -), "CompositeCast", """line 803, column 41 of dart:collection/splay_tree.dart: """, _comparator is __CastType19, false), _validKey); +Set result = new SplayTreeSet(_comparator, _validKey); for (E element in this) { if (!other.contains(element)) result.add(element); } @@ -531,11 +521,7 @@ if (!other.contains(element)) result.add(element); return _clone()..addAll(other); } SplayTreeSet _clone() { -var set = new SplayTreeSet(DEVC$RT.cast(_comparator, DEVC$RT.type((Comparator _) { -} -), DEVC$RT.type((__CastType19 _) { -} -), "CompositeCast", """line 815, column 35 of dart:collection/splay_tree.dart: """, _comparator is __CastType19, false), _validKey); +var set = new SplayTreeSet(_comparator, _validKey); set._count = _count; set._root = _copyNode(_root); return set; @@ -551,5 +537,4 @@ _clear(); String toString() => IterableBase.iterableToFullString(this, '{', '}'); } typedef int __CastType14(K __u15, K __u16); - typedef bool __CastType17(dynamic __u18); - typedef int __CastType19(E __u20, E __u21); + typedef bool __CastType17(Object __u18); diff --git a/pkg/dev_compiler/test/generated_sdk/lib/collection/collection.dart b/pkg/dev_compiler/test/generated_sdk/lib/collection/collection.dart index 4c6ab59bc0e7..8eca257c4110 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/collection/collection.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/collection/collection.dart @@ -366,8 +366,9 @@ class _IdentityHashMap extends _HashMap { class _CustomHashMap extends _HashMap { final _Equality _equals; final _Hasher _hashCode; - final _Predicate _validKey; - _CustomHashMap(this._equals, this._hashCode, bool validKey(potentialKey)) + final _Predicate _validKey; + _CustomHashMap(this._equals, this._hashCode, + bool validKey(Object potentialKey)) : _validKey = (validKey != null) ? validKey : ((v) => v is K); V operator[](Object key) { @@ -788,9 +789,9 @@ class _LinkedIdentityHashMap extends _LinkedHashMap { class _LinkedCustomHashMap extends _LinkedHashMap { final _Equality _equals; final _Hasher _hashCode; - final _Predicate _validKey; + final _Predicate _validKey; _LinkedCustomHashMap(this._equals, this._hashCode, - bool validKey(potentialKey)) + bool validKey(Object potentialKey)) : _validKey = (validKey != null) ? validKey : ((v) => v is K); V operator[](Object key) { @@ -1187,8 +1188,9 @@ class _IdentityHashSet extends _HashSet { class _CustomHashSet extends _HashSet { _Equality _equality; _Hasher _hasher; - _Predicate _validKey; - _CustomHashSet(this._equality, this._hasher, bool validKey(potentialKey)) + _Predicate _validKey; + _CustomHashSet(this._equality, this._hasher, + bool validKey(Object potentialKey)) : _validKey = (validKey != null) ? validKey : ((x) => x is E); Set _newSet() => new _CustomHashSet(_equality, _hasher, _validKey); @@ -1588,9 +1590,9 @@ class _LinkedIdentityHashSet extends _LinkedHashSet { class _LinkedCustomHashSet extends _LinkedHashSet { _Equality _equality; _Hasher _hasher; - _Predicate _validKey; + _Predicate _validKey; _LinkedCustomHashSet(this._equality, this._hasher, - bool validKey(potentialKey)) + bool validKey(Object potentialKey)) : _validKey = (validKey != null) ? validKey : ((x) => x is E); Set _newSet() => diff --git a/pkg/dev_compiler/test/generated_sdk/lib/collection/hash_map.dart b/pkg/dev_compiler/test/generated_sdk/lib/collection/hash_map.dart index 5ee7926124ca..0f98975e17c9 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/collection/hash_map.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/collection/hash_map.dart @@ -5,9 +5,9 @@ part of dart.collection; /** Default function for equality comparison in customized HashMaps */ -bool _defaultEquals(a, b) => a == b; +bool _defaultEquals(Object a, Object b) => a == b; /** Default function for hash-code computation in customized HashMaps */ -int _defaultHashCode(a) => a.hashCode; +int _defaultHashCode(Object a) => a.hashCode; /** Type of custom equality function */ typedef bool _Equality(K a, K b); @@ -68,7 +68,7 @@ abstract class HashMap implements Map { */ factory HashMap({ bool equals(K key1, K key2), int hashCode(K key), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { if (isValidKey == null) { if (hashCode == null) { if (equals == null) { diff --git a/pkg/dev_compiler/test/generated_sdk/lib/collection/hash_set.dart b/pkg/dev_compiler/test/generated_sdk/lib/collection/hash_set.dart index 2a84cad4975b..641890f4159c 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/collection/hash_set.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/collection/hash_set.dart @@ -73,7 +73,7 @@ abstract class HashSet implements Set { */ factory HashSet({ bool equals(E e1, E e2), int hashCode(E e), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { if (isValidKey == null) { if (hashCode == null) { if (equals == null) { diff --git a/pkg/dev_compiler/test/generated_sdk/lib/collection/iterable.dart b/pkg/dev_compiler/test/generated_sdk/lib/collection/iterable.dart index 154d19c2ddee..8020e7e68fa8 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/collection/iterable.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/collection/iterable.dart @@ -120,7 +120,7 @@ abstract class IterableMixin implements Iterable { } E get first { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -128,7 +128,7 @@ abstract class IterableMixin implements Iterable { } E get last { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -140,7 +140,7 @@ abstract class IterableMixin implements Iterable { } E get single { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); E result = it.current; if (it.moveNext()) throw IterableElementError.tooMany(); @@ -288,7 +288,7 @@ abstract class IterableBase implements Iterable { int get length { assert(this is! EfficientLength); int count = 0; - Iterator it = iterator; + Iterator it = iterator; while (it.moveNext()) { count++; } @@ -316,7 +316,7 @@ abstract class IterableBase implements Iterable { } E get first { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -324,7 +324,7 @@ abstract class IterableBase implements Iterable { } E get last { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -336,7 +336,7 @@ abstract class IterableBase implements Iterable { } E get single { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); E result = it.current; if (it.moveNext()) throw IterableElementError.tooMany(); diff --git a/pkg/dev_compiler/test/generated_sdk/lib/collection/linked_hash_map.dart b/pkg/dev_compiler/test/generated_sdk/lib/collection/linked_hash_map.dart index 35d011043dfa..098767eccf80 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/collection/linked_hash_map.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/collection/linked_hash_map.dart @@ -55,7 +55,7 @@ abstract class LinkedHashMap implements HashMap { */ factory LinkedHashMap({ bool equals(K key1, K key2), int hashCode(K key), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { if (isValidKey == null) { if (hashCode == null) { if (equals == null) { diff --git a/pkg/dev_compiler/test/generated_sdk/lib/collection/linked_hash_set.dart b/pkg/dev_compiler/test/generated_sdk/lib/collection/linked_hash_set.dart index f475b0d8bd42..14ba17e6094e 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/collection/linked_hash_set.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/collection/linked_hash_set.dart @@ -54,7 +54,7 @@ abstract class LinkedHashSet implements HashSet { */ factory LinkedHashSet({ bool equals(E e1, E e2), int hashCode(E e), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { if (isValidKey == null) { if (hashCode == null) { if (equals == null) { diff --git a/pkg/dev_compiler/test/generated_sdk/lib/collection/set.dart b/pkg/dev_compiler/test/generated_sdk/lib/collection/set.dart index 4eb330606ede..717089e0b9e7 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/collection/set.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/collection/set.dart @@ -125,7 +125,7 @@ abstract class SetMixin implements Set { E get single { if (length > 1) throw IterableElementError.tooMany(); - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); E result = it.current; return result; @@ -213,7 +213,7 @@ abstract class SetMixin implements Set { } E get first { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -221,7 +221,7 @@ abstract class SetMixin implements Set { } E get last { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } diff --git a/pkg/dev_compiler/test/generated_sdk/lib/collection/splay_tree.dart b/pkg/dev_compiler/test/generated_sdk/lib/collection/splay_tree.dart index 3bc43eac89a1..112698b98b7e 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/collection/splay_tree.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/collection/splay_tree.dart @@ -258,9 +258,10 @@ abstract class _SplayTree { */ class SplayTreeMap extends _SplayTree implements Map { Comparator _comparator; - _Predicate _validKey; + _Predicate _validKey; - SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) + SplayTreeMap([int compare(K key1, K key2), + bool isValidKey(Object potentialKey)]) : _comparator = (compare == null) ? Comparable.compare : compare, _validKey = (isValidKey != null) ? isValidKey : ((v) => v is K); @@ -269,7 +270,7 @@ class SplayTreeMap extends _SplayTree implements Map { */ factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), - bool isValidKey(potentialKey)]) { + bool isValidKey(Object potentialKey)]) { SplayTreeMap result = new SplayTreeMap(); other.forEach((k, v) { result[k] = v; }); return result; @@ -292,7 +293,7 @@ class SplayTreeMap extends _SplayTree implements Map { {K key(element), V value(element), int compare(K key1, K key2), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { SplayTreeMap map = new SplayTreeMap(compare, isValidKey); Maps._fillMapWithMappedIterable(map, iterable, key, value); return map; @@ -310,7 +311,7 @@ class SplayTreeMap extends _SplayTree implements Map { * It is an error if the two [Iterable]s don't have the same length. */ factory SplayTreeMap.fromIterables(Iterable keys, Iterable values, - [int compare(K key1, K key2), bool isValidKey(potentialKey)]) { + [int compare(K key1, K key2), bool isValidKey(Object potentialKey)]) { SplayTreeMap map = new SplayTreeMap(compare, isValidKey); Maps._fillMapWithIterables(map, keys, values); return map; @@ -658,8 +659,8 @@ class _SplayTreeNodeIterator * in that case. */ class SplayTreeSet extends _SplayTree with IterableMixin, SetMixin { - Comparator _comparator; - _Predicate _validKey; + Comparator _comparator; + _Predicate _validKey; /** * Create a new [SplayTreeSet] with the given compare function. @@ -685,7 +686,8 @@ class SplayTreeSet extends _SplayTree with IterableMixin, SetMixin { * If omitted, the `isValidKey` function defaults to checking against the * type parameter: `other is E`. */ - SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) + SplayTreeSet([int compare(E key1, E key2), + bool isValidKey(Object potentialKey)]) : _comparator = (compare == null) ? Comparable.compare : compare, _validKey = (isValidKey != null) ? isValidKey : ((v) => v is E); @@ -698,7 +700,7 @@ class SplayTreeSet extends _SplayTree with IterableMixin, SetMixin { */ factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), - bool isValidKey(potentialKey)]) { + bool isValidKey(Object potentialKey)]) { SplayTreeSet result = new SplayTreeSet(compare, isValidKey); for (final E element in elements) { result.add(element); diff --git a/pkg/dev_compiler/test/generated_sdk/lib/core/list.dart b/pkg/dev_compiler/test/generated_sdk/lib/core/list.dart index 828d03f7c55c..fcd83709770a 100644 --- a/pkg/dev_compiler/test/generated_sdk/lib/core/list.dart +++ b/pkg/dev_compiler/test/generated_sdk/lib/core/list.dart @@ -105,7 +105,7 @@ abstract class List implements Iterable, EfficientLength { * The [length] must not be negative or null. */ factory List.filled(int length, E fill) { - List result = new List(length); + List result = new List(length); if (length != 0 && fill != null) { for (int i = 0; i < result.length; i++) { result[i] = fill; diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_map.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_map.dart index e67fa77556fc..003cd4f18c8b 100644 --- a/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_map.dart +++ b/pkg/dev_compiler/tool/input_sdk/lib/collection/hash_map.dart @@ -5,9 +5,9 @@ part of dart.collection; /** Default function for equality comparison in customized HashMaps */ -bool _defaultEquals(a, b) => a == b; +bool _defaultEquals(Object a, Object b) => a == b; /** Default function for hash-code computation in customized HashMaps */ -int _defaultHashCode(a) => a.hashCode; +int _defaultHashCode(Object a) => a.hashCode; /** Type of custom equality function */ typedef bool _Equality(K a, K b); diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/iterable.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/iterable.dart index 154d19c2ddee..8020e7e68fa8 100644 --- a/pkg/dev_compiler/tool/input_sdk/lib/collection/iterable.dart +++ b/pkg/dev_compiler/tool/input_sdk/lib/collection/iterable.dart @@ -120,7 +120,7 @@ abstract class IterableMixin implements Iterable { } E get first { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -128,7 +128,7 @@ abstract class IterableMixin implements Iterable { } E get last { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -140,7 +140,7 @@ abstract class IterableMixin implements Iterable { } E get single { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); E result = it.current; if (it.moveNext()) throw IterableElementError.tooMany(); @@ -288,7 +288,7 @@ abstract class IterableBase implements Iterable { int get length { assert(this is! EfficientLength); int count = 0; - Iterator it = iterator; + Iterator it = iterator; while (it.moveNext()) { count++; } @@ -316,7 +316,7 @@ abstract class IterableBase implements Iterable { } E get first { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -324,7 +324,7 @@ abstract class IterableBase implements Iterable { } E get last { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -336,7 +336,7 @@ abstract class IterableBase implements Iterable { } E get single { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); E result = it.current; if (it.moveNext()) throw IterableElementError.tooMany(); diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/set.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/set.dart index 4eb330606ede..717089e0b9e7 100644 --- a/pkg/dev_compiler/tool/input_sdk/lib/collection/set.dart +++ b/pkg/dev_compiler/tool/input_sdk/lib/collection/set.dart @@ -125,7 +125,7 @@ abstract class SetMixin implements Set { E get single { if (length > 1) throw IterableElementError.tooMany(); - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) throw IterableElementError.noElement(); E result = it.current; return result; @@ -213,7 +213,7 @@ abstract class SetMixin implements Set { } E get first { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } @@ -221,7 +221,7 @@ abstract class SetMixin implements Set { } E get last { - Iterator it = iterator; + Iterator it = iterator; if (!it.moveNext()) { throw IterableElementError.noElement(); } diff --git a/pkg/dev_compiler/tool/input_sdk/lib/collection/splay_tree.dart b/pkg/dev_compiler/tool/input_sdk/lib/collection/splay_tree.dart index 3bc43eac89a1..112698b98b7e 100644 --- a/pkg/dev_compiler/tool/input_sdk/lib/collection/splay_tree.dart +++ b/pkg/dev_compiler/tool/input_sdk/lib/collection/splay_tree.dart @@ -258,9 +258,10 @@ abstract class _SplayTree { */ class SplayTreeMap extends _SplayTree implements Map { Comparator _comparator; - _Predicate _validKey; + _Predicate _validKey; - SplayTreeMap([int compare(K key1, K key2), bool isValidKey(potentialKey)]) + SplayTreeMap([int compare(K key1, K key2), + bool isValidKey(Object potentialKey)]) : _comparator = (compare == null) ? Comparable.compare : compare, _validKey = (isValidKey != null) ? isValidKey : ((v) => v is K); @@ -269,7 +270,7 @@ class SplayTreeMap extends _SplayTree implements Map { */ factory SplayTreeMap.from(Map other, [int compare(K key1, K key2), - bool isValidKey(potentialKey)]) { + bool isValidKey(Object potentialKey)]) { SplayTreeMap result = new SplayTreeMap(); other.forEach((k, v) { result[k] = v; }); return result; @@ -292,7 +293,7 @@ class SplayTreeMap extends _SplayTree implements Map { {K key(element), V value(element), int compare(K key1, K key2), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { SplayTreeMap map = new SplayTreeMap(compare, isValidKey); Maps._fillMapWithMappedIterable(map, iterable, key, value); return map; @@ -310,7 +311,7 @@ class SplayTreeMap extends _SplayTree implements Map { * It is an error if the two [Iterable]s don't have the same length. */ factory SplayTreeMap.fromIterables(Iterable keys, Iterable values, - [int compare(K key1, K key2), bool isValidKey(potentialKey)]) { + [int compare(K key1, K key2), bool isValidKey(Object potentialKey)]) { SplayTreeMap map = new SplayTreeMap(compare, isValidKey); Maps._fillMapWithIterables(map, keys, values); return map; @@ -658,8 +659,8 @@ class _SplayTreeNodeIterator * in that case. */ class SplayTreeSet extends _SplayTree with IterableMixin, SetMixin { - Comparator _comparator; - _Predicate _validKey; + Comparator _comparator; + _Predicate _validKey; /** * Create a new [SplayTreeSet] with the given compare function. @@ -685,7 +686,8 @@ class SplayTreeSet extends _SplayTree with IterableMixin, SetMixin { * If omitted, the `isValidKey` function defaults to checking against the * type parameter: `other is E`. */ - SplayTreeSet([int compare(E key1, E key2), bool isValidKey(potentialKey)]) + SplayTreeSet([int compare(E key1, E key2), + bool isValidKey(Object potentialKey)]) : _comparator = (compare == null) ? Comparable.compare : compare, _validKey = (isValidKey != null) ? isValidKey : ((v) => v is E); @@ -698,7 +700,7 @@ class SplayTreeSet extends _SplayTree with IterableMixin, SetMixin { */ factory SplayTreeSet.from(Iterable elements, [int compare(E key1, E key2), - bool isValidKey(potentialKey)]) { + bool isValidKey(Object potentialKey)]) { SplayTreeSet result = new SplayTreeSet(compare, isValidKey); for (final E element in elements) { result.add(element); diff --git a/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart index 184e8ce0406d..c06f55287fa2 100644 --- a/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart +++ b/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart @@ -12,7 +12,7 @@ class HashMap { @patch factory HashMap({ bool equals(K key1, K key2), int hashCode(K key), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { if (isValidKey == null) { if (hashCode == null) { if (equals == null) { @@ -384,8 +384,9 @@ class _IdentityHashMap extends _HashMap { class _CustomHashMap extends _HashMap { final _Equality _equals; final _Hasher _hashCode; - final _Predicate _validKey; - _CustomHashMap(this._equals, this._hashCode, bool validKey(potentialKey)) + final _Predicate _validKey; + _CustomHashMap(this._equals, this._hashCode, + bool validKey(Object potentialKey)) : _validKey = (validKey != null) ? validKey : ((v) => v is K); V operator[](Object key) { @@ -487,7 +488,7 @@ class LinkedHashMap { @patch factory LinkedHashMap({ bool equals(K key1, K key2), int hashCode(K key), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { if (isValidKey == null) { if (hashCode == null) { if (equals == null) { @@ -859,9 +860,9 @@ class _LinkedIdentityHashMap extends _LinkedHashMap { class _LinkedCustomHashMap extends _LinkedHashMap { final _Equality _equals; final _Hasher _hashCode; - final _Predicate _validKey; + final _Predicate _validKey; _LinkedCustomHashMap(this._equals, this._hashCode, - bool validKey(potentialKey)) + bool validKey(Object potentialKey)) : _validKey = (validKey != null) ? validKey : ((v) => v is K); V operator[](Object key) { @@ -971,7 +972,7 @@ class HashSet { @patch factory HashSet({ bool equals(E e1, E e2), int hashCode(E e), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { if (isValidKey == null) { if (hashCode == null) { if (equals == null) { @@ -1300,8 +1301,9 @@ class _IdentityHashSet extends _HashSet { class _CustomHashSet extends _HashSet { _Equality _equality; _Hasher _hasher; - _Predicate _validKey; - _CustomHashSet(this._equality, this._hasher, bool validKey(potentialKey)) + _Predicate _validKey; + _CustomHashSet(this._equality, this._hasher, + bool validKey(Object potentialKey)) : _validKey = (validKey != null) ? validKey : ((x) => x is E); Set _newSet() => new _CustomHashSet(_equality, _hasher, _validKey); @@ -1376,7 +1378,7 @@ class LinkedHashSet { @patch factory LinkedHashSet({ bool equals(E e1, E e2), int hashCode(E e), - bool isValidKey(potentialKey) }) { + bool isValidKey(Object potentialKey) }) { if (isValidKey == null) { if (hashCode == null) { if (equals == null) { @@ -1742,9 +1744,9 @@ class _LinkedIdentityHashSet extends _LinkedHashSet { class _LinkedCustomHashSet extends _LinkedHashSet { _Equality _equality; _Hasher _hasher; - _Predicate _validKey; + _Predicate _validKey; _LinkedCustomHashSet(this._equality, this._hasher, - bool validKey(potentialKey)) + bool validKey(Object potentialKey)) : _validKey = (validKey != null) ? validKey : ((x) => x is E); Set _newSet() => diff --git a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart index de2058dab768..dfb6ac0a1233 100644 --- a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart +++ b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart @@ -268,7 +268,7 @@ class List { @patch factory List.filled(int length, E fill) { - List result = new List(length); + List result = new List(length); if (length != 0 && fill != null) { for (int i = 0; i < result.length; i++) { result[i] = fill;