[squeak-dev] The Inbox: Morphic-ct.1639.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 20 19:50:07 UTC 2020


Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1639.mcz

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

Name: Morphic-ct.1639
Author: ct
Time: 20 March 2020, 8:49:59.689237 pm
UUID: 068f59a1-989d-b244-ad1f-84e726dcf055
Ancestors: Morphic-eem.1638

Extracts lazy accessor in LazyListMorph

This does not only follow SRP but also makes it easier for other objects to access listItems properly. Pheno uses this, for example [1].

[1] https://github.com/tom95/Pheno/commit/ab39c5b72c1764e9d525e287f3efff99917b38e2#diff-bf98bbb5fedbbc4b66a4b825d3c8d14b

=============== Diff against Morphic-eem.1638 ===============

Item was changed:
  ----- Method: LazyListMorph>>item: (in category 'list access - cached') -----
  item: index
  	"Do inst-var access on listItems here to initialize it as late as possible."
  
+ 	^ (self listItems at: index) ifNil: [
- 	listItems ifNil: [listItems := Array new: self getListSize].
- 
- 	^ (listItems at: index) ifNil: [
  		| newItem itemWidth |	
  		newItem := self getListItem: index.
  
  		"Update the width cache."
  		maxWidth ifNotNil: [
  			itemWidth := self widthToDisplayItem: newItem.
  			itemWidth > maxWidth ifTrue: [
  				maxWidth := itemWidth.
  				super layoutChanged]].
  
  		listItems at: index put: newItem.
  		newItem].!

Item was added:
+ ----- Method: LazyListMorph>>listItems (in category 'accessing') -----
+ listItems
+ 
+ 	^ listItems ifNil: [listItems := Array new: self getListSize]!



More information about the Squeak-dev mailing list