Logic fail.
Also, why did cur work when it should have been cur.ID?
This commit is contained in:
parent
6b3443c12a
commit
482f6444fe
@ -1500,11 +1500,12 @@
|
||||
return;
|
||||
}
|
||||
cur = start === 0 ? this.first : this[start];
|
||||
while (cur !== this[end]) {
|
||||
if (!(next = cur.next, cur)) {
|
||||
while (cur) {
|
||||
next = cur.next;
|
||||
this.rm(cur.ID);
|
||||
if (!next || cur.ID === end) {
|
||||
return;
|
||||
}
|
||||
this.rm(cur);
|
||||
cur = next;
|
||||
}
|
||||
};
|
||||
@ -1517,7 +1518,9 @@
|
||||
}
|
||||
delete this[ID];
|
||||
this.length--;
|
||||
return this.rmi(item);
|
||||
this.rmi(item);
|
||||
delete item.next;
|
||||
return delete item.previous;
|
||||
};
|
||||
|
||||
RandomAccessList.prototype.rmi = function(item) {
|
||||
|
||||
@ -1506,11 +1506,12 @@
|
||||
return;
|
||||
}
|
||||
cur = start === 0 ? this.first : this[start];
|
||||
while (cur !== this[end]) {
|
||||
if (!(next = cur.next, cur)) {
|
||||
while (cur) {
|
||||
next = cur.next;
|
||||
this.rm(cur.ID);
|
||||
if (!next || cur.ID === end) {
|
||||
return;
|
||||
}
|
||||
this.rm(cur);
|
||||
cur = next;
|
||||
}
|
||||
};
|
||||
@ -1523,7 +1524,9 @@
|
||||
}
|
||||
delete this[ID];
|
||||
this.length--;
|
||||
return this.rmi(item);
|
||||
this.rmi(item);
|
||||
delete item.next;
|
||||
return delete item.previous;
|
||||
};
|
||||
|
||||
RandomAccessList.prototype.rmi = function(item) {
|
||||
|
||||
@ -34,9 +34,10 @@ class RandomAccessList
|
||||
splice: (start, end) ->
|
||||
return unless @[end]
|
||||
cur = if start is 0 then @first else @[start]
|
||||
while cur isnt @[end]
|
||||
return unless {next} = cur
|
||||
@rm cur
|
||||
while cur
|
||||
{next} = cur
|
||||
@rm cur.ID
|
||||
return if not next or cur.ID is end
|
||||
cur = next
|
||||
|
||||
rm: (ID) ->
|
||||
@ -45,6 +46,8 @@ class RandomAccessList
|
||||
delete @[ID]
|
||||
@length--
|
||||
@rmi item
|
||||
delete item.next
|
||||
delete item.previous
|
||||
|
||||
rmi: (item) ->
|
||||
{prev, next} = item
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user