mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:07:57 +00:00
Remove the retype
method.
See #33075. Bug: http://dartbug.com/33075 Change-Id: I1ee2f587afbc672dd08ac61ac003bbdc85bb95e2 Reviewed-on: https://dart-review.googlesource.com/59091 Commit-Queue: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Leaf Petersen <leafp@google.com>
This commit is contained in:
parent
420b95aa06
commit
0b91676362
|
@ -62,6 +62,9 @@ be inferred as `void`.
|
|||
* `dart:convert`
|
||||
* Allow `utf8.decoder.fuse(json.decoder)` to ignore leading Unicode BOM.
|
||||
|
||||
* `dart:core`/`dart:collection`
|
||||
* Remove the `retype` method on iterables and maps again. Use `cast` instead.
|
||||
|
||||
### Tool Changes
|
||||
|
||||
#### Analyzer
|
||||
|
|
2
DEPS
2
DEPS
|
@ -59,7 +59,7 @@ vars = {
|
|||
"charcode_tag": "v1.1.1",
|
||||
"chrome_rev" : "19997",
|
||||
"cli_util_tag" : "0.1.2+1",
|
||||
"collection_tag": "1.14.9",
|
||||
"collection_tag": "1.14.10",
|
||||
"convert_tag": "2.0.1",
|
||||
"crypto_tag" : "2.0.2+1",
|
||||
"csslib_tag" : "0.14.1",
|
||||
|
|
|
@ -22,10 +22,6 @@ class DebugMap<K, V> implements Map<K, V> {
|
|||
}
|
||||
|
||||
Map<RK, RV> cast<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
|
||||
|
||||
bool containsValue(Object value) {
|
||||
return sourceMap.containsValue(value);
|
||||
}
|
||||
|
@ -108,10 +104,6 @@ class DebugIterable<E> implements Iterable<E> {
|
|||
Iterator<E> get iterator => iterable.iterator;
|
||||
|
||||
Iterable<R> cast<R>() => Iterable.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Iterable<R> retype<R>() => cast<R>();
|
||||
|
||||
Iterable<T> map<T>(T f(E element)) => iterable.map(f);
|
||||
|
||||
Iterable<E> where(bool test(E element)) => iterable.where(test);
|
||||
|
@ -190,10 +182,6 @@ class DebugList<E> extends DebugIterable<E> implements List<E> {
|
|||
List<E> get list => iterable;
|
||||
|
||||
List<R> cast<R>() => List.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
List<E> operator +(List<E> other) => list + other;
|
||||
|
||||
E operator [](int index) => list[index];
|
||||
|
@ -297,10 +285,6 @@ class DebugSet<E> extends DebugIterable<E> implements Set<E> {
|
|||
Set<E> get set => iterable;
|
||||
|
||||
Set<R> cast<R>() => Set.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
bool contains(Object value) => set.contains(value);
|
||||
|
||||
bool add(E value) {
|
||||
|
|
|
@ -69,10 +69,6 @@ class ExpensiveMap<K, V> extends MapBase<K, V> {
|
|||
}
|
||||
|
||||
Map<KR, VR> cast<KR, VR>() => Map.castFrom<K, V, KR, VR>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<KR, VR> retype<KR, VR>() => cast<KR, VR>();
|
||||
|
||||
Iterable<MapEntry<K, V>> get entries => _maps[0].entries;
|
||||
|
||||
void addEntries(Iterable<MapEntry<K, V>> entries) {
|
||||
|
|
|
@ -98,10 +98,6 @@ class TrackMap<K, V> implements Map<K, V> {
|
|||
}
|
||||
|
||||
Map<KR, VR> cast<KR, VR>() => _map.cast<KR, VR>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<KR, VR> retype<KR, VR>() => cast<KR, VR>();
|
||||
|
||||
Iterable<MapEntry<K, V>> get entries => _map.entries;
|
||||
|
||||
void addEntries(Iterable<MapEntry<K, V>> entries) {
|
||||
|
|
|
@ -10,10 +10,6 @@ class ImmutableEmptySet<E> extends IterableBase<E> implements Set<E> {
|
|||
const ImmutableEmptySet();
|
||||
|
||||
Set<R> cast<R>() => new ImmutableEmptySet<R>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
get iterator => const _EmptySetIterator();
|
||||
int get length => 0;
|
||||
bool get isEmpty => true;
|
||||
|
|
|
@ -30,10 +30,6 @@ class Setlet<E> extends SetBase<E> {
|
|||
static Set<R> _newSet<R>() => new Setlet<R>();
|
||||
|
||||
Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newSet);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
Iterator<E> get iterator {
|
||||
if (_extra == null) {
|
||||
return new _SetletSingleIterator<E>(_contents);
|
||||
|
|
|
@ -69,10 +69,6 @@ class JSArray<E> implements List<E>, JSIndexable<E> {
|
|||
}
|
||||
|
||||
List<R> cast<R>() => List.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
void add(E value) {
|
||||
checkGrowable('add');
|
||||
JS('void', r'#.push(#)', this, value);
|
||||
|
|
|
@ -461,10 +461,6 @@ class _CompactLinkedHashSet<E> extends _HashFieldBase
|
|||
static Set<R> _newEmpty<R>() => new _CompactLinkedHashSet<R>();
|
||||
|
||||
Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newEmpty);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
int get length => _usedData - _deletedKeys;
|
||||
|
||||
E get first {
|
||||
|
@ -622,9 +618,6 @@ class _CompactLinkedIdentityHashSet<E> extends _CompactLinkedHashSet<E>
|
|||
static Set<R> _newEmpty<R>() => new _CompactLinkedIdentityHashSet<R>();
|
||||
|
||||
Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newEmpty);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
}
|
||||
|
||||
class _CompactLinkedCustomHashSet<E> extends _CompactLinkedHashSet<E> {
|
||||
|
@ -643,10 +636,6 @@ class _CompactLinkedCustomHashSet<E> extends _CompactLinkedHashSet<E> {
|
|||
: _validKey = (validKey != null) ? validKey : new _TypeTest<E>().test;
|
||||
|
||||
Set<R> cast<R>() => Set.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
Set<E> toSet() =>
|
||||
new _CompactLinkedCustomHashSet<E>(_equality, _hasher, _validKey)
|
||||
..addAll(this);
|
||||
|
|
|
@ -14,10 +14,6 @@ class _ImmutableMap<K, V> implements Map<K, V> {
|
|||
: _kvPairs = keyValuePairs;
|
||||
|
||||
Map<K2, V2> cast<K2, V2>() => Map.castFrom<K, V, K2, V2>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<K2, V2> retype<K2, V2>() => cast<K2, V2>();
|
||||
|
||||
V operator [](Object key) {
|
||||
// To preserve the key-value order of the map literal, the keys are
|
||||
// not sorted. Need to do linear search or implement an additional
|
||||
|
|
|
@ -124,10 +124,6 @@ abstract class _IntListMixin implements List<int> {
|
|||
new FollowedByIterable<int>.firstEfficient(this, other);
|
||||
|
||||
List<R> cast<R>() => List.castFrom<int, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
void set first(int value) {
|
||||
if (this.length == 0) throw new RangeError.index(0, this);
|
||||
this[0] = value;
|
||||
|
@ -485,10 +481,6 @@ abstract class _DoubleListMixin implements List<double> {
|
|||
new FollowedByIterable<double>.firstEfficient(this, other);
|
||||
|
||||
List<R> cast<R>() => List.castFrom<double, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
void set first(double value) {
|
||||
if (this.length == 0) throw new RangeError.index(0, this);
|
||||
this[0] = value;
|
||||
|
@ -849,10 +841,6 @@ abstract class _Float32x4ListMixin implements List<Float32x4> {
|
|||
new FollowedByIterable<Float32x4>.firstEfficient(this, other);
|
||||
|
||||
List<R> cast<R>() => List.castFrom<Float32x4, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
void set first(Float32x4 value) {
|
||||
if (this.length == 0) throw new RangeError.index(0, this);
|
||||
this[0] = value;
|
||||
|
@ -1217,10 +1205,6 @@ abstract class _Int32x4ListMixin implements List<Int32x4> {
|
|||
new FollowedByIterable<Int32x4>.firstEfficient(this, other);
|
||||
|
||||
List<R> cast<R>() => List.castFrom<Int32x4, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
void set first(Int32x4 value) {
|
||||
if (this.length == 0) throw new RangeError.index(0, this);
|
||||
this[0] = value;
|
||||
|
@ -1584,10 +1568,6 @@ abstract class _Float64x2ListMixin implements List<Float64x2> {
|
|||
new FollowedByIterable<Float64x2>.firstEfficient(this, other);
|
||||
|
||||
List<R> cast<R>() => List.castFrom<Float64x2, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
void set first(Float64x2 value) {
|
||||
if (this.length == 0) throw new RangeError.index(0, this);
|
||||
this[0] = value;
|
||||
|
|
|
@ -24,7 +24,7 @@ var tests = <IsolateTest>[
|
|||
|
||||
// Avoid to manually encode and decode messages from the stream
|
||||
Stream<String> stream = socket.stream.map(jsonEncode);
|
||||
stream.retype<Object>().pipe(_socket);
|
||||
stream.cast<Object>().pipe(_socket);
|
||||
dynamic _decoder(dynamic obj) {
|
||||
return jsonDecode(obj);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ var tests = <IsolateTest>[
|
|||
|
||||
// Avoid to manually encode and decode messages from the stream
|
||||
Stream<String> stream = socket.stream.map(jsonEncode);
|
||||
stream.retype<Object>().pipe(_socket);
|
||||
stream.cast<Object>().pipe(_socket);
|
||||
dynamic _decoder(dynamic obj) {
|
||||
return jsonDecode(obj);
|
||||
}
|
||||
|
|
|
@ -27,10 +27,10 @@ var tests = <IsolateTest>[
|
|||
|
||||
// Avoid to manually encode and decode messages from the stream
|
||||
Stream<String> socket_stream = socket.stream.map(jsonEncode);
|
||||
socket_stream.retype<Object>().pipe(_socket);
|
||||
socket_stream.cast<Object>().pipe(_socket);
|
||||
Stream<String> socket_invoker_stream =
|
||||
socket_invoker.stream.map(jsonEncode);
|
||||
socket_invoker_stream.retype<Object>().pipe(_socket_invoker);
|
||||
socket_invoker_stream.cast<Object>().pipe(_socket_invoker);
|
||||
dynamic _decoder(dynamic obj) {
|
||||
return jsonDecode(obj);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ var tests = <IsolateTest>[
|
|||
|
||||
// Avoid to manually encode and decode messages from the stream
|
||||
Stream<String> socket_stream = socket.stream.map(jsonEncode);
|
||||
socket_stream.retype<Object>().pipe(_socket);
|
||||
socket_stream.cast<Object>().pipe(_socket);
|
||||
dynamic _decoder(dynamic obj) {
|
||||
return jsonDecode(obj);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ var tests = <IsolateTest>[
|
|||
|
||||
// Avoid to manually encode and decode messages from the stream
|
||||
Stream<String> stream = socket.stream.map(jsonEncode);
|
||||
stream.retype<Object>().pipe(_socket);
|
||||
stream.cast<Object>().pipe(_socket);
|
||||
dynamic _decoder(dynamic obj) {
|
||||
return jsonDecode(obj);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ var tests = <IsolateTest>[
|
|||
|
||||
// Avoid to manually encode and decode messages from the stream
|
||||
Stream<String> stream = socket.stream.map(jsonEncode);
|
||||
stream.retype<Object>().pipe(_socket);
|
||||
stream.cast<Object>().pipe(_socket);
|
||||
dynamic _decoder(dynamic obj) {
|
||||
return jsonDecode(obj);
|
||||
}
|
||||
|
|
|
@ -147,10 +147,6 @@ class ObservableList<T> extends AbstractObservable
|
|||
int get length => _internal.length;
|
||||
|
||||
List<R> cast<R>() => _internal.cast<R>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
Iterable<R> whereType<R>() => _internal.whereType<R>();
|
||||
|
||||
List<T> operator +(List<T> other) => _internal + other;
|
||||
|
|
|
@ -78,10 +78,6 @@ class _HttpSession implements HttpSession {
|
|||
}
|
||||
|
||||
Map<K, V> cast<K, V>() => _data.cast<K, V>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<K, V> retype<K, V>() => cast<K, V>();
|
||||
|
||||
update(key, update(value), {ifAbsent()}) =>
|
||||
_data.update(key, update, ifAbsent: ifAbsent);
|
||||
|
||||
|
|
|
@ -48,10 +48,6 @@ abstract class ConstantMap<K, V> implements Map<K, V> {
|
|||
const ConstantMap._();
|
||||
|
||||
Map<RK, RV> cast<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
|
||||
|
||||
bool get isEmpty => length == 0;
|
||||
|
||||
bool get isNotEmpty => !isEmpty;
|
||||
|
|
|
@ -120,10 +120,6 @@ class JSArray<E> extends Interceptor implements List<E>, JSIndexable {
|
|||
}
|
||||
|
||||
List<R> cast<R>() => List.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
void add(E value) {
|
||||
checkGrowable('add');
|
||||
JS('void', r'#.push(#)', this, value);
|
||||
|
|
|
@ -939,10 +939,6 @@ abstract class Stream<T> {
|
|||
* each data event emitted by this stream is also an instance of [R].
|
||||
*/
|
||||
Stream<R> cast<R>() => Stream.castFrom<T, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Stream<R> retype<R>() => cast<R>();
|
||||
|
||||
/**
|
||||
* Collects all elements of this stream in a [List].
|
||||
*
|
||||
|
@ -2020,9 +2016,6 @@ abstract class StreamTransformer<S, T> {
|
|||
* are acually instances of [RT].
|
||||
*/
|
||||
StreamTransformer<RS, RT> cast<RS, RT>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
StreamTransformer<RS, RT> retype<RS, RT>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2035,9 +2028,6 @@ abstract class StreamTransformerBase<S, T> implements StreamTransformer<S, T> {
|
|||
|
||||
StreamTransformer<RS, RT> cast<RS, RT>() =>
|
||||
StreamTransformer.castFrom<S, T, RS, RT>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
StreamTransformer<RS, RT> retype<RS, RT>() => cast<RS, RT>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,10 +22,6 @@ class UnmodifiableListView<E> extends UnmodifiableListBase<E> {
|
|||
UnmodifiableListView(Iterable<E> source) : _source = source;
|
||||
|
||||
List<R> cast<R>() => new UnmodifiableListView(_source.cast<R>());
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
int get length => _source.length;
|
||||
|
||||
E operator [](int index) => _source.elementAt(index);
|
||||
|
|
|
@ -15,10 +15,6 @@ abstract class _HashSetBase<E> extends SetBase<E> {
|
|||
Set<R> _newSimilarSet<R>();
|
||||
|
||||
Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newSimilarSet);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
Set<E> difference(Set<Object> other) {
|
||||
Set<E> result = _newSet();
|
||||
for (var element in this) {
|
||||
|
|
|
@ -16,10 +16,6 @@ abstract class IterableMixin<E> implements Iterable<E> {
|
|||
// If changing a method here, also change the other copies.
|
||||
|
||||
Iterable<R> cast<R>() => Iterable.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Iterable<R> retype<R>() => cast<R>();
|
||||
|
||||
Iterable<T> map<T>(T f(E element)) => new MappedIterable<E, T>(this, f);
|
||||
|
||||
Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
|
||||
|
|
|
@ -330,10 +330,6 @@ abstract class ListMixin<E> implements List<E> {
|
|||
}
|
||||
|
||||
List<R> cast<R>() => List.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>() => cast<R>();
|
||||
|
||||
E removeLast() {
|
||||
if (length == 0) {
|
||||
throw IterableElementError.noElement();
|
||||
|
|
|
@ -119,10 +119,6 @@ abstract class MapMixin<K, V> implements Map<K, V> {
|
|||
void clear();
|
||||
|
||||
Map<RK, RV> cast<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
|
||||
|
||||
void forEach(void action(K key, V value)) {
|
||||
for (K key in keys) {
|
||||
action(key, this[key]);
|
||||
|
@ -315,10 +311,6 @@ class MapView<K, V> implements Map<K, V> {
|
|||
const MapView(Map<K, V> map) : _map = map;
|
||||
|
||||
Map<RK, RV> cast<RK, RV>() => _map.cast<RK, RV>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
|
||||
|
||||
V operator [](Object key) => _map[key];
|
||||
void operator []=(K key, V value) {
|
||||
_map[key] = value;
|
||||
|
@ -381,7 +373,4 @@ class UnmodifiableMapView<K, V> extends MapView<K, V>
|
|||
|
||||
Map<RK, RV> cast<RK, RV>() =>
|
||||
new UnmodifiableMapView<RK, RV>(_map.cast<RK, RV>());
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
|
||||
}
|
||||
|
|
|
@ -78,10 +78,6 @@ abstract class Queue<E> implements EfficientLengthIterable<E> {
|
|||
* this queue as well.
|
||||
*/
|
||||
Queue<R> cast<R>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Queue<R> retype<R>();
|
||||
|
||||
/**
|
||||
* Removes and returns the first element of this queue.
|
||||
*
|
||||
|
@ -344,10 +340,6 @@ class DoubleLinkedQueue<E> extends Iterable<E> implements Queue<E> {
|
|||
new DoubleLinkedQueue<E>()..addAll(elements);
|
||||
|
||||
Queue<R> cast<R>() => Queue.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Queue<R> retype<R>() => cast<R>();
|
||||
|
||||
int get length => _elementCount;
|
||||
|
||||
void addLast(E value) {
|
||||
|
@ -643,10 +635,6 @@ class ListQueue<E> extends ListIterable<E> implements Queue<E> {
|
|||
// Iterable interface.
|
||||
|
||||
Queue<R> cast<R>() => Queue.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Queue<R> retype<R>() => cast<R>();
|
||||
|
||||
Iterator<E> get iterator => new _ListQueueIterator<E>(this);
|
||||
|
||||
void forEach(void f(E element)) {
|
||||
|
|
|
@ -48,10 +48,6 @@ abstract class SetMixin<E> implements Set<E> {
|
|||
bool get isNotEmpty => length != 0;
|
||||
|
||||
Set<R> cast<R>() => Set.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
Iterable<E> followedBy(Iterable<E> other) =>
|
||||
new FollowedByIterable<E>.firstEfficient(this, other);
|
||||
|
||||
|
|
|
@ -766,10 +766,6 @@ class SplayTreeSet<E> extends _SplayTree<E, _SplayTreeNode<E>>
|
|||
new SplayTreeSet<T>((T a, T b) => _comparator(a as E, b as E), _validKey);
|
||||
|
||||
Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newSet);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
int _compare(E e1, E e2) => _comparator(e1, e2);
|
||||
|
||||
// From Iterable.
|
||||
|
|
|
@ -65,9 +65,6 @@ abstract class Converter<S, T> extends StreamTransformerBase<S, T> {
|
|||
* are acually instances of [RT].
|
||||
*/
|
||||
Converter<RS, RT> cast<RS, RT>() => Converter.castFrom<S, T, RS, RT>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Converter<RS, RT> retype<RS, RT>() => cast<RS, RT>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -164,10 +164,6 @@ abstract class Iterable<E> {
|
|||
* the type [R], e.g., from [toList], it will have exactly the type [R].
|
||||
*/
|
||||
Iterable<R> cast<R>() => Iterable.castFrom<E, R>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Iterable<R> retype<R>() => cast<R>();
|
||||
|
||||
/**
|
||||
* Returns the lazy concatentation of this iterable and [other].
|
||||
*
|
||||
|
|
|
@ -268,10 +268,6 @@ abstract class List<E> implements EfficientLengthIterable<E> {
|
|||
* Typically implemented as `List.castFrom<E, R>(this)`.
|
||||
*/
|
||||
List<R> cast<R>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
List<R> retype<R>();
|
||||
|
||||
/**
|
||||
* Returns the object at the given [index] in the list
|
||||
* or throws a [RangeError] if [index] is out of bounds.
|
||||
|
|
|
@ -192,10 +192,6 @@ abstract class Map<K, V> {
|
|||
* `Map<RK, RV>`.
|
||||
*/
|
||||
Map<RK, RV> cast<RK, RV>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<RK, RV> retype<RK, RV>();
|
||||
|
||||
/**
|
||||
* Returns true if this map contains the given [value].
|
||||
*
|
||||
|
|
|
@ -126,10 +126,6 @@ abstract class Set<E> extends EfficientLengthIterable<E> {
|
|||
* this set as well.
|
||||
*/
|
||||
Set<R> cast<R>();
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>();
|
||||
|
||||
/**
|
||||
* Provides an iterator that iterates over the elements of this set.
|
||||
*
|
||||
|
|
|
@ -46684,10 +46684,6 @@ abstract class _AttributeMap extends MapBase<String, String> {
|
|||
}
|
||||
|
||||
Map<K, V> cast<K, V>() => Map.castFrom<String, String, K, V>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<K, V> retype<K, V>() => cast<K, V>();
|
||||
|
||||
bool containsValue(Object value) {
|
||||
for (var v in this.values) {
|
||||
if (value == v) {
|
||||
|
@ -46849,10 +46845,6 @@ class _DataAttributeMap extends MapBase<String, String> {
|
|||
}
|
||||
|
||||
Map<K, V> cast<K, V>() => Map.castFrom<String, String, K, V>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<K, V> retype<K, V>() => cast<K, V>();
|
||||
|
||||
// TODO: Use lazy iterator when it is available on Map.
|
||||
bool containsValue(Object value) => values.any((v) => v == value);
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ class CastStream<S, T> extends Stream<T> {
|
|||
}
|
||||
|
||||
Stream<R> cast<R>() => new CastStream<S, R>(_source);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Stream<R> retype<R>() => cast<R>();
|
||||
}
|
||||
|
||||
class CastStreamSubscription<S, T> implements StreamSubscription<T> {
|
||||
|
@ -64,10 +61,6 @@ class CastStreamTransformer<SS, ST, TS, TT>
|
|||
|
||||
StreamTransformer<RS, RT> cast<RS, RT>() =>
|
||||
new CastStreamTransformer<SS, ST, RS, RT>(_source);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
StreamTransformer<RS, RT> retype<RS, RT>() => cast<RS, RT>();
|
||||
|
||||
Stream<TT> bind(Stream<TS> stream) =>
|
||||
_source.bind(stream.cast<SS>()).cast<TT>();
|
||||
}
|
||||
|
@ -85,7 +78,4 @@ class CastConverter<SS, ST, TS, TT> extends Converter<TS, TT> {
|
|||
|
||||
Converter<RS, RT> cast<RS, RT>() =>
|
||||
new CastConverter<SS, ST, RS, RT>(_source);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Converter<RS, RT> retype<RS, RT>() => cast<RS, RT>();
|
||||
}
|
||||
|
|
|
@ -189,10 +189,6 @@ class CastSet<S, T> extends _CastIterableBase<S, T> implements Set<T> {
|
|||
static Set<R> _defaultEmptySet<R>() => new Set<R>();
|
||||
|
||||
Set<R> cast<R>() => new CastSet<S, R>(_source, _emptySet);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
|
||||
bool add(T value) => _source.add(value as S);
|
||||
|
||||
void addAll(Iterable<T> elements) {
|
||||
|
@ -368,9 +364,6 @@ class CastQueue<S, T> extends _CastIterableBase<S, T>
|
|||
final Queue<S> _source;
|
||||
CastQueue(this._source);
|
||||
Queue<R> cast<R>() => new CastQueue<S, R>(_source);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Queue<R> retype<R>() => cast<R>();
|
||||
}
|
||||
|
||||
// TODO(lrn): Use when ListQueue implements List.
|
||||
|
|
|
@ -90,7 +90,7 @@ void testList() {
|
|||
|
||||
// Regression test.
|
||||
var list3 = <num>[4, 3, 2, 1];
|
||||
var dList3 = list3.retype<int>();
|
||||
var dList3 = list3.cast<int>();
|
||||
dList3.sort(null);
|
||||
Expect.listEquals([1, 2, 3, 4], list3);
|
||||
}
|
||||
|
|
|
@ -37,9 +37,6 @@ class EfficientTestIterable extends TestIterableBase implements Set<int> {
|
|||
// Avoid warnings because we don't actually implement Set.
|
||||
noSuchMethod(i) => super.noSuchMethod(i);
|
||||
Set<R> cast<R>() => throw "not used by test";
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Set<R> retype<R>() => cast<R>();
|
||||
}
|
||||
|
||||
class CallbackIterator implements Iterator<int> {
|
||||
|
|
|
@ -19,11 +19,6 @@ void main() {
|
|||
test(new UnmodifiableListView<Object>(<num>[37]).cast<int>());
|
||||
test(new UnmodifiableListView<Object>(<int>[37]).cast<num>());
|
||||
|
||||
test(new UnmodifiableListView<num>(<num>[37]).retype<int>());
|
||||
test(new UnmodifiableListView<num>(<int>[37]).retype<int>());
|
||||
test(new UnmodifiableListView<Object>(<num>[37]).retype<int>());
|
||||
test(new UnmodifiableListView<Object>(<int>[37]).retype<num>());
|
||||
|
||||
var m2 = new List<num>.unmodifiable([37]);
|
||||
test(m2);
|
||||
test(m2.cast<int>());
|
||||
|
|
|
@ -10,16 +10,13 @@ import 'dart:collection';
|
|||
void main() {
|
||||
testNum(const {1: 37}, "const");
|
||||
testNum(const <num, num>{1: 37}.cast<int, int>(), "const.cast");
|
||||
testNum(const <num, num>{1: 37}.retype<int, int>(), "const.retype");
|
||||
|
||||
testNum(new UnmodifiableMapView({1: 37}), "unmod");
|
||||
testNum(new UnmodifiableMapView<num, num>(<num, num>{1: 37}), "unmod.cast");
|
||||
testNum(new UnmodifiableMapView<num, num>(<int, int>{1: 37}), "unmod.retype");
|
||||
|
||||
testNum(new UnmodifiableMapView<num, num>(<num, num>{1: 37}).cast<int, int>(),
|
||||
"unmodView<num>.cast<int>");
|
||||
"unmodView<num>(num).cast<int>");
|
||||
testNum(new UnmodifiableMapView<num, num>(<int, int>{1: 37}).cast<int, int>(),
|
||||
"unmodView<int>.cast<int>");
|
||||
"unmodView<num>(int).cast<int>");
|
||||
testNum(
|
||||
new UnmodifiableMapView<Object, Object>(<num, num>{1: 37})
|
||||
.cast<int, int>(),
|
||||
|
@ -29,21 +26,6 @@ void main() {
|
|||
.cast<num, num>(),
|
||||
"unmodView<Object>(int).cast<num>");
|
||||
|
||||
testNum(
|
||||
new UnmodifiableMapView<num, num>(<num, num>{1: 37}).retype<int, int>(),
|
||||
"unmodView<num>(num).retype<int>");
|
||||
testNum(
|
||||
new UnmodifiableMapView<num, num>(<int, int>{1: 37}).retype<int, int>(),
|
||||
"unmodView<num>(int).retype<int>");
|
||||
testNum(
|
||||
new UnmodifiableMapView<Object, Object>(<num, num>{1: 37})
|
||||
.retype<int, int>(),
|
||||
"unmodView<Object>(num).retype<int>");
|
||||
testNum(
|
||||
new UnmodifiableMapView<Object, Object>(<int, int>{1: 37})
|
||||
.retype<num, num>(),
|
||||
"unmodView<Object>(int).retype<num>");
|
||||
|
||||
var m2 = new Map<num, num>.unmodifiable({1: 37});
|
||||
testNum(m2, "Map<num>.unmod");
|
||||
testNum(m2.cast<int, int>(), "Map<num>.unmod.cast<int>");
|
||||
|
@ -51,7 +33,6 @@ void main() {
|
|||
Map<Symbol, dynamic> nsm = new NsmMap().foo(a: 0);
|
||||
test(nsm, #a, 0, "nsm", noSuchMethodMap: true);
|
||||
test(nsm.cast<Object, int>(), #a, 0, "nsm.cast", noSuchMethodMap: true);
|
||||
test(nsm.retype<Object, int>(), #a, 0, "nsm.retype", noSuchMethodMap: true);
|
||||
}
|
||||
|
||||
void testNum(Map<Object, Object> map, String name) {
|
||||
|
|
|
@ -16,10 +16,6 @@ abstract class _AttributeMap extends MapBase<String, String> {
|
|||
}
|
||||
|
||||
Map<K, V> cast<K, V>() => Map.castFrom<String, String, K, V>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<K, V> retype<K, V>() => cast<K, V>();
|
||||
|
||||
bool containsValue(Object value) {
|
||||
for (var v in this.values) {
|
||||
if (value == v) {
|
||||
|
@ -181,10 +177,6 @@ class _DataAttributeMap extends MapBase<String, String> {
|
|||
}
|
||||
|
||||
Map<K, V> cast<K, V>() => Map.castFrom<String, String, K, V>(this);
|
||||
|
||||
@Deprecated("Use cast instead.")
|
||||
Map<K, V> retype<K, V>() => cast<K, V>();
|
||||
|
||||
// TODO: Use lazy iterator when it is available on Map.
|
||||
bool containsValue(Object value) => values.any((v) => v == value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue