Moved MutableMap.set from Maps.kt to MapsJVM.kt to avoid ambiguity when compile MapTest.kt by JS backend.
This commit is contained in:
committed by
Ilya Ryzhenkov
parent
9b081fd254
commit
223a14a855
@@ -8,8 +8,9 @@ import java.lang.*;
|
|||||||
native
|
native
|
||||||
public val noImpl : Nothing = throw Exception()
|
public val noImpl : Nothing = throw Exception()
|
||||||
|
|
||||||
|
// Drop this after KT-2093 will be fixed and restore MutableMap.set in Maps.kt from MapsJVM.kt
|
||||||
/** Provides [] access to maps */
|
/** Provides [] access to maps */
|
||||||
native public fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit = noImpl
|
native public fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = noImpl
|
||||||
|
|
||||||
library("println")
|
library("println")
|
||||||
public fun println() {}
|
public fun println() {}
|
||||||
@@ -22,4 +23,4 @@ native public fun parseInt(s: String, radix: Int = 10): Int = js.noImpl
|
|||||||
library
|
library
|
||||||
public fun safeParseInt(s : String) : Int? = js.noImpl
|
public fun safeParseInt(s : String) : Int? = js.noImpl
|
||||||
library
|
library
|
||||||
public fun safeParseDouble(s : String) : Double? = js.noImpl
|
public fun safeParseDouble(s : String) : Double? = js.noImpl
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ public val Map<*, *>.size: Int
|
|||||||
public val Map<*, *>.empty: Boolean
|
public val Map<*, *>.empty: Boolean
|
||||||
get() = isEmpty()
|
get() = isEmpty()
|
||||||
|
|
||||||
/** Provides [] access to maps */
|
|
||||||
public fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = this.put(key, value)
|
|
||||||
|
|
||||||
/** Returns the [[Map]] if its not null otherwise it returns the empty [[Map]] */
|
/** Returns the [[Map]] if its not null otherwise it returns the empty [[Map]] */
|
||||||
public fun <K,V> Map<K,V>?.orEmpty() : Map<K,V>
|
public fun <K,V> Map<K,V>?.orEmpty() : Map<K,V>
|
||||||
= if (this != null) this else stdlib_emptyMap()
|
= if (this != null) this else stdlib_emptyMap()
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import java.util.Properties
|
|||||||
|
|
||||||
// Map APIs
|
// Map APIs
|
||||||
|
|
||||||
|
// Move back to Maps.kt after KT-2093 will be fixed
|
||||||
|
/** Provides [] access to maps */
|
||||||
|
public fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = this.put(key, value)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts this [[Map]] to a [[LinkedHashMap]] so future insertion orders are maintained
|
* Converts this [[Map]] to a [[LinkedHashMap]] so future insertion orders are maintained
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user