fixed a bug in at: and at:put: of OrderedCollection
This commit is contained in:
parent
c0cf2b0368
commit
e1ec7a7f38
@ -346,8 +346,8 @@ class(#byte) ByteString(Array)
|
|||||||
class OrderedCollection(SequenceableCollection)
|
class OrderedCollection(SequenceableCollection)
|
||||||
{
|
{
|
||||||
var buffer.
|
var buffer.
|
||||||
var firstIndex.
|
var(#get) firstIndex.
|
||||||
var lastIndex. ## this is the last index plus 1.
|
var(#get) lastIndex. ## this is the last index plus 1.
|
||||||
|
|
||||||
method(#class) new
|
method(#class) new
|
||||||
{
|
{
|
||||||
@ -380,7 +380,7 @@ class OrderedCollection(SequenceableCollection)
|
|||||||
{
|
{
|
||||||
| i |
|
| i |
|
||||||
i := index + self.firstIndex.
|
i := index + self.firstIndex.
|
||||||
if ((i >= self.firstIndex) and (i < self.lastIndex)) { ^self.buffer at: index }.
|
if ((i >= self.firstIndex) and (i < self.lastIndex)) { ^self.buffer at: i}.
|
||||||
Exception signal: ('index ' & index asString & ' out of range').
|
Exception signal: ('index ' & index asString & ' out of range').
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ class OrderedCollection(SequenceableCollection)
|
|||||||
## replace an existing element. it doesn't grow the buffer.
|
## replace an existing element. it doesn't grow the buffer.
|
||||||
| i |
|
| i |
|
||||||
i := index + self.firstIndex.
|
i := index + self.firstIndex.
|
||||||
if ((i >= self.firstIndex) and (i < self.lastIndex)) { ^self.buffer at: index put: obj }.
|
if ((i >= self.firstIndex) and (i < self.lastIndex)) { ^self.buffer at: i put: obj }.
|
||||||
Exception signal: ('index ' & index asString & ' out of range').
|
Exception signal: ('index ' & index asString & ' out of range').
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user