fix(facades): fix splice semantics; add test
This commit is contained in:
@@ -154,7 +154,8 @@ class ListWrapper {
|
||||
static List slice(List l, int from, int to) {
|
||||
return l.sublist(from, to);
|
||||
}
|
||||
static List splice(List l, int from, int to) {
|
||||
static List splice(List l, int from, int length) {
|
||||
var to = from + length;
|
||||
var sub = l.sublist(from, to);
|
||||
l.removeRange(from, to);
|
||||
return sub;
|
||||
|
||||
@@ -193,8 +193,8 @@ export class ListWrapper {
|
||||
static slice(l:List, from:int, to:int):List {
|
||||
return l.slice(from, to);
|
||||
}
|
||||
static splice(l:List, from:int, to:int):List {
|
||||
return l.splice(from, to);
|
||||
static splice(l:List, from:int, length:int):List {
|
||||
return l.splice(from, length);
|
||||
}
|
||||
static sort(l:List, compareFn:Function) {
|
||||
l.sort(compareFn);
|
||||
|
||||
@@ -168,6 +168,9 @@ export class ListWrapper {
|
||||
return true;
|
||||
}
|
||||
static slice<T>(l: List<T>, from: int, to: int): List<T> { return l.slice(from, to); }
|
||||
static splice<T>(l:List<T>, from:int, length:int):List<T> {
|
||||
return l.splice(from, length);
|
||||
}
|
||||
static sort<T>(l: List<T>, compareFn: (a: T, b: T) => number) { l.sort(compareFn); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user