[JS BE] Extract backend specific code from shared stdlib sources
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JS_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
// EXPECTED_REACHABLE_NODES: 1556
|
// EXPECTED_REACHABLE_NODES: 1556
|
||||||
package foo
|
package foo
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ package kotlin.js
|
|||||||
// Used for js.translator/testData/box/number/mulInt32.kt
|
// Used for js.translator/testData/box/number/mulInt32.kt
|
||||||
@library
|
@library
|
||||||
@JsName("imulEmulated")
|
@JsName("imulEmulated")
|
||||||
internal fun imul(x: Int, y: Int): Int = definedExternally
|
internal fun imul(x: Int, y: Int): Int = definedExternally
|
||||||
|
|
||||||
|
internal inline fun isArrayish(o: dynamic) = js("Kotlin").isArrayish(o)
|
||||||
@@ -14,7 +14,7 @@ internal fun <T> Array<out T>.contentDeepHashCodeImpl(): Int {
|
|||||||
for (element in this) {
|
for (element in this) {
|
||||||
val elementHash = when {
|
val elementHash = when {
|
||||||
element == null -> 0
|
element == null -> 0
|
||||||
js("Kotlin").isArrayish(element) -> (element.unsafeCast<Array<*>>()).contentDeepHashCodeImpl()
|
isArrayish(element) -> (element.unsafeCast<Array<*>>()).contentDeepHashCodeImpl()
|
||||||
|
|
||||||
element is UByteArray -> element.contentHashCode()
|
element is UByteArray -> element.contentHashCode()
|
||||||
element is UShortArray -> element.contentHashCode()
|
element is UShortArray -> element.contentHashCode()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public operator fun dynamic.iterator(): Iterator<dynamic> {
|
|||||||
return when {
|
return when {
|
||||||
this["iterator"] != null ->
|
this["iterator"] != null ->
|
||||||
this["iterator"]()
|
this["iterator"]()
|
||||||
js("Kotlin").isArrayish(r) ->
|
isArrayish(r) ->
|
||||||
r.unsafeCast<Array<*>>().iterator()
|
r.unsafeCast<Array<*>>().iterator()
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
|
|||||||
Reference in New Issue
Block a user