The Trunk: Collections-ul.901.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-ul.901.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.901.mcz

==================== Summary ====================

Name: Collections-ul.901
Author: ul
Time: 29 June 2020, 2:08:55.776619 am
UUID: 8df577a2-3856-4432-b54c-25c93831b5a8
Ancestors: Collections-ul.900

Fix regression in ReadStream >> #match:. When the subCollection is not present in the receiver, the stream's position must be set to the end to match the original behavior.

=============== Diff against Collections-ul.900 ===============

Item was changed:
  ----- Method: ReadStream>>match: (in category 'positioning') -----
  match: subCollection
  "Faster version than the one implemented by super, but due to my subclasses breaking various invariants true for actual ReadStreams, only use it when the receiver's class is ReadStream."
 
  | matchPosition |
  self class == ReadStream ifFalse: [ ^super match: subCollection ].
  subCollection isEmpty ifTrue: [ ^true ].
  matchPosition := collection indexOfSubCollection: subCollection startingAt: position + 1.
+ matchPosition = 0 ifTrue: [
+ position := readLimit.
+ ^false ].
- matchPosition = 0 ifTrue: [ ^false ].
  matchPosition <= readLimit ifFalse: [ ^false ].
  position := matchPosition + subCollection size - 1.
  ^true!