[BUG][FIX] OrderedCollection>>#do:

R. A. Harmon harmonra at webname.com
Thu Apr 13 15:26:51 UTC 2000


Evaluating:

	ContextPart trace: [OrderedCollection new]

cause a MNU error because index (= firstIndex = nil) <= lastIndex (= nil).

My proposed fix is the following:

'From Squeak2.7 of 5 January 2000 [latest update: #1782] on 12 April 2000 at
9:51:53 am'!

!OrderedCollection methodsFor: 'enumerating' stamp: 'RAH 4/12/2000 09:43'!
do: aBlock 
        "Override the superclass for performance reasons."
        | index |
        firstIndex isNil ifTrue: [^self].      "<- Added."
        index _ firstIndex.
        [index <= lastIndex]
                whileTrue: 
                        [aBlock value: (array at: index).
                        index _ index + 1]! !
--
Richard A. Harmon          "The only good zombie is a dead zombie"
harmonra at webname.com           E. G. McCarthy
Spencer, Iowa





More information about the Squeak-dev mailing list