[squeak-dev] The Inbox: Collections-dtl.562.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jan 19 19:06:22 UTC 2014


David T. Lewis uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-dtl.562.mcz

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

Name: Collections-dtl.562
Author: dtl
Time: 19 January 2014, 2:06:03.032 pm
UUID: 5ffdcb69-50fb-4dbd-8da0-db2193fe9a0a
Ancestors: Collections-cwp.561

A possible fix for WriteStreamTest>>testStreamContentsPositioning

Change SequencebleCollection class>>new:streamContents: so that the optimization to answer originalContents is not invoked if the stream collection has been expanded. This permits the stream to be positioned forward then back to the position matching its original size.

=============== Diff against Collections-cwp.561 ===============

Item was changed:
  ----- Method: SequenceableCollection class>>new:streamContents: (in category 'stream creation') -----
  new: newSize streamContents: blockWithArg
  
+ 	| stream p endPos |
- 	| stream |
  	stream := WriteStream on: (self new: newSize).
  	blockWithArg value: stream.
+ 	p := stream position.
+ 	endPos := stream setToEnd position.
+ 	p = endPos
+ 		ifTrue: [p = newSize
+ 				ifTrue: [^ stream originalContents]]
+ 		ifFalse: [stream position: p].
+ 	^ stream contents!
- 	stream position = newSize
- 		ifTrue: [ ^stream originalContents ]
- 		ifFalse: [ ^stream contents ]!



More information about the Squeak-dev mailing list