Fix functional Array & String methods and avoid buffer caching (#415)

This commit is contained in:
Max Graey
2019-01-17 02:34:09 +02:00
committed by Daniel Wirtz
parent df3b2befd7
commit 54b02c287c
11 changed files with 933 additions and 936 deletions

View File

@ -451,7 +451,9 @@ export class String {
}
return result;
} else if (!length) {
return <String[]>[changetype<String>("")];
let result = new Array<String>(1);
unchecked(result[0] = changetype<String>(""));
return result;
}
var result = new Array<String>();
var end = 0, start = 0, i = 0;
@ -467,7 +469,11 @@ export class String {
if (++i == limit) return result;
start = end + sepLen;
}
if (!start) return <String[]>[this];
if (!start) {
let result = new Array<String>(1);
unchecked(result[0] = this);
return result;
}
var len = length - start;
if (len > 0) {
let out = allocateUnsafe(len);