[Wasm] Add sorting function to the stdlib

This commit is contained in:
Igor Laevsky
2021-10-08 19:33:07 +03:00
committed by TeamCityServer
parent 049e48e780
commit 7943298240
2 changed files with 1 additions and 4 deletions
@@ -2511,7 +2511,7 @@ public actual fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit
* The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
*/
public actual fun <T> Array<out T>.sortWith(comparator: Comparator<in T>): Unit {
TODO("Wasm stdlib: sortWith(comparator: Comparator<in T>)")
if (size > 1) sortArrayWith(this, 0, size, comparator)
}
/**
@@ -1284,9 +1284,6 @@ object ArrayOps : TemplateGroupBase() {
}
on(Platform.Native) {
body { """if (size > 1) sortArrayWith(this, 0, size, comparator)""" }
on(Backend.Wasm) {
body { """TODO("Wasm stdlib: $signature")""" }
}
}
}