Fix CharArray sort in JS IR-backend
This commit is contained in:
@@ -1926,8 +1926,7 @@ public actual fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size): Uni
|
|||||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||||
public actual fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {
|
public actual fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {
|
||||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||||
val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast<CharArray>()
|
sortArrayWith(this.unsafeCast<Array<Char>>(), fromIndex, toIndex, naturalOrder())
|
||||||
subarray.sort()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1357,21 +1357,19 @@ object ArrayOps : TemplateGroupBase() {
|
|||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
specialFor(ArraysOfPrimitives) {
|
specialFor(ArraysOfPrimitives) {
|
||||||
if (primitive != PrimitiveType.Long) {
|
body {
|
||||||
body {
|
if (primitive == PrimitiveType.Char && target.backend == Backend.IR || primitive == PrimitiveType.Long) {
|
||||||
|
"""
|
||||||
|
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||||
|
sortArrayWith(this.unsafeCast<Array<T>>(), fromIndex, toIndex, naturalOrder())
|
||||||
|
"""
|
||||||
|
} else {
|
||||||
"""
|
"""
|
||||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
||||||
val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast<SELF>()
|
val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast<SELF>()
|
||||||
subarray.sort()
|
subarray.sort()
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
body {
|
|
||||||
"""
|
|
||||||
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
|
|
||||||
sortArrayWith(this.unsafeCast<Array<Long>>(), fromIndex, toIndex, naturalOrder())
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user