Make toTypedArray reified again and thus inline, rewrite copyToArray and copyToArrayImpl in kotlin.

This commit is contained in:
Ilya Gorbunov
2016-11-17 19:26:07 +03:00
parent 698bc7bd31
commit 0dbaf2a605
2 changed files with 18 additions and 20 deletions
+1 -16
View File
@@ -406,7 +406,7 @@ Kotlin.collectionsSort = function (mutableList, comparator) {
}
if (mutableList.size > 1) {
var array = Kotlin.copyToArray(mutableList);
var array = _.kotlin.collections.copyToArray(mutableList);
array.sort(boundComparator);
@@ -420,21 +420,6 @@ Kotlin.primitiveArraySort = function(array) {
array.sort(Kotlin.primitiveCompareTo)
};
Kotlin.copyToArray = function (collection) {
if (typeof collection.toArray !== "undefined") return collection.toArray();
return Kotlin.copyToArrayImpl(collection);
};
Kotlin.copyToArrayImpl = function (collection) {
var array = [];
var it = collection.iterator();
while (it.hasNext()) {
array.push(it.next());
}
return array;
};
Kotlin.splitString = function (str, regex, limit) {
return str.split(new RegExp(regex), limit);
};