mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 18:31:32 +00:00
Adjust internal hash_map libraries to match updated UP
SDK issue #54002 is a breaking change request about a change to the rules about the type function `UP`. This CL serves as a preparation for landing the tool changes that are the topic of #54002. It changes a few conditional expressions such that one branch gets an explicit type based on an `as` expression, which means that the code has the same semantics as before the change, but now it will compile without errors both before and after the change in #54002 has been landed. Change-Id: Iddc99c1c184c1f36744d089c15c5cf29aea699df Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337780 Commit-Queue: Erik Ernst <eernst@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com>
This commit is contained in:
parent
cba120dbac
commit
efe3d00dcd
|
@ -103,7 +103,8 @@ base class CustomHashMap<K, V> extends InternalMap<K, V> {
|
|||
K k = JS('', '#[#]', buckets, i);
|
||||
if (equals(k, key)) {
|
||||
V value = JS('', '#.get(#)', _map, k);
|
||||
return value == null ? null : value; // coerce undefined to null.
|
||||
// coerce undefined to null.
|
||||
return JS<bool>('!', '# === void 0', value) ? null : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +176,8 @@ base class CustomHashMap<K, V> extends InternalMap<K, V> {
|
|||
V value = JS('', '#.get(#)', map, k);
|
||||
JS('', '#.delete(#)', map, k);
|
||||
_modifications = (_modifications + 1) & 0x3fffffff;
|
||||
return value == null ? null : value; // coerce undefined to null.
|
||||
// coerce undefined to null.
|
||||
return JS<bool>('!', '# === void 0', value) ? null : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,8 @@ base class IdentityMap<K, V> extends InternalMap<K, V> {
|
|||
|
||||
V? operator [](Object? key) {
|
||||
V value = JS('', '#.get(#)', _map, key);
|
||||
return value == null ? null : value; // coerce undefined to null.
|
||||
// coerce undefined to null.
|
||||
return JS<bool>('!', '# === void 0', value) ? null : value;
|
||||
}
|
||||
|
||||
void operator []=(K key, V value) {
|
||||
|
@ -84,7 +85,8 @@ base class IdentityMap<K, V> extends InternalMap<K, V> {
|
|||
if (JS<bool>('!', '#.delete(#)', _map, key)) {
|
||||
_modifications = (_modifications + 1) & 0x3fffffff;
|
||||
}
|
||||
return value == null ? null : value; // coerce undefined to null.
|
||||
// coerce undefined to null.
|
||||
return JS<bool>('!', '# === void 0', value) ? null : value;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
|
|
|
@ -150,7 +150,8 @@ base class LinkedMap<K, V> extends InternalMap<K, V> {
|
|||
return null;
|
||||
}
|
||||
V value = JS('', '#.get(#)', _map, key);
|
||||
return value == null ? null : value; // coerce undefined to null.
|
||||
// coerce undefined to null.
|
||||
return JS<bool>('!', '# === void 0', value) ? null : value;
|
||||
}
|
||||
|
||||
void operator []=(K key, V value) {
|
||||
|
@ -228,7 +229,8 @@ base class LinkedMap<K, V> extends InternalMap<K, V> {
|
|||
if (JS<bool>('!', '#.delete(#)', map, key)) {
|
||||
_modifications = (_modifications + 1) & 0x3fffffff;
|
||||
}
|
||||
return value == null ? null : value; // coerce undefined to null.
|
||||
// coerce undefined to null.
|
||||
return JS<bool>('!', '# === void 0', value) ? null : value;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
|
|
Loading…
Reference in a new issue