JS: Drop native map get/set intrinsics altogether.

MutableMap.set extension operator is now common among stdlib and stdlib-js.
#KT-2323
This commit is contained in:
Ilya Gorbunov
2016-12-16 22:03:03 +03:00
parent e8c9e81235
commit 6ee8a23ddd
7 changed files with 9 additions and 124 deletions
@@ -130,6 +130,14 @@ public inline operator fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.
public inline operator fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.get(key: K): V?
= @Suppress("UNCHECKED_CAST") (this as Map<K, V>).get(key)
/**
* Allows to use the index operator for storing values in a mutable map.
*/
@kotlin.internal.InlineOnly
public inline operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit {
put(key, value)
}
/**
* Returns `true` if the map contains the specified [key].
*
@@ -11,14 +11,7 @@ import java.util.SortedMap
import java.util.TreeMap
import java.util.concurrent.ConcurrentMap
/**
* Allows to use the index operator for storing values in a mutable map.
*/
// this code is JVM-specific, because JS has native set function
@kotlin.internal.InlineOnly
public inline operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit {
put(key, value)
}
/**
* Concurrent getOrPut, that is safe for concurrent maps.