Bert Freudenberg uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-bf.966.mcz ==================== Summary ==================== Name: System-bf.966 Author: bf Time: 14 October 2017, 2:30:57.487381 pm UUID: be22259c-73c6-4721-86a9-f17059c77ebf Ancestors: System-dtl.965 Mark SmartRefStream>>mapClass: as sender of all conversion methods. =============== Diff against System-dtl.965 =============== Item was added: + ----- Method: SmartRefStream class>>isConversionSelector: (in category 'browsing support') ----- + isConversionSelector: aSelector + "Let mapClass: be found as sender of our conversion methods" + ^aSelector last isDigit and: [self includesSelector: aSelector] + ! Item was changed: ----- Method: SmartRefStream>>mapClass: (in category 'read write') ----- mapClass: incoming "See if the old class named nm exists. If so, return it. If not, map it to a new class, and save the mapping in renamed. " + <hasLiteralTest: #isConversionSelector:> + "To find this method as sender of all conversion methods" + | cls oldVer sel nm | self flag: #bobconv. nm := renamed at: incoming ifAbsent: [incoming]. "allow pre-mapping around collisions" (nm endsWith: ' class') ifFalse: [cls := Smalltalk at: nm ifAbsent: [nil]. cls ifNotNil: [^ cls]] "Known class. It will know how to translate the instance." ifTrue: [cls := Smalltalk at: nm substrings first asSymbol ifAbsent: [nil]. cls ifNotNil: [^ cls class]]. "Known class. It will know how to translate the instance." oldVer := self versionSymbol: (structures at: nm). sel := nm asString. sel at: 1 put: (sel at: 1) asLowercase. sel := sel, oldVer. "i.e. #rectangleoc4" - self flag: #multiNewParagraphttfclpomsswfpp0. "identify senders of multiNewParagraphttfclpomsswfpp0" Symbol hasInterned: sel ifTrue: [:symb | (self class canUnderstand: sel asSymbol) ifTrue: [ reshaped ifNil: [reshaped := Dictionary new]. cls := self perform: sel asSymbol]]. "This class will take responsibility" cls ifNil: [cls := self writeClassRenameMethod: sel was: nm fromInstVars: (structures at: nm). cls isString ifTrue: [cls := nil]]. cls ifNotNil: [renamed at: nm put: cls name]. ^ cls ! |
Great addition to save time when 'rediscovering' how the
SmartRefStream mapping mechanism works. On Sat, 14 Oct 2017 12:31:12 0000, [hidden email] <[hidden email]> wrote: > Bert Freudenberg uploaded a new version of System to project The Trunk: > http://source.squeak.org/trunk/System-bf.966.mcz > > ==================== Summary ==================== > > Name: System-bf.966 > Author: bf > Time: 14 October 2017, 2:30:57.487381 pm > UUID: be22259c-73c6-4721-86a9-f17059c77ebf > Ancestors: System-dtl.965 > > Mark SmartRefStream>>mapClass: as sender of all conversion methods. > > =============== Diff against System-dtl.965 =============== > > Item was added: > + ----- Method: SmartRefStream class>>isConversionSelector: (in category > 'browsing support') ----- > + isConversionSelector: aSelector > + "Let mapClass: be found as sender of our conversion methods" > + ^aSelector last isDigit and: [self includesSelector: aSelector] > + ! > > Item was changed: > ----- Method: SmartRefStream>>mapClass: (in category 'read write') ----- > mapClass: incoming > "See if the old class named nm exists. If so, return it. If not, map it > to a new class, and save the mapping in renamed. " > > + <hasLiteralTest: #isConversionSelector:> > + "To find this method as sender of all conversion methods" > + > | cls oldVer sel nm | > > self flag: #bobconv. > > > nm := renamed at: incoming ifAbsent: [incoming]. "allow pre-mapping > around collisions" > (nm endsWith: ' class') > ifFalse: [cls := Smalltalk at: nm ifAbsent: [nil]. > cls ifNotNil: [^ cls]] "Known class. It will know how to translate > the instance." > ifTrue: [cls := Smalltalk at: nm substrings first asSymbol ifAbsent: > [nil]. > cls ifNotNil: [^ cls class]]. "Known class. It will know how to > translate the instance." > oldVer := self versionSymbol: (structures at: nm). > sel := nm asString. > sel at: 1 put: (sel at: 1) asLowercase. > sel := sel, oldVer. "i.e. #rectangleoc4" > - self flag: #multiNewParagraphttfclpomsswfpp0. "identify senders of > multiNewParagraphttfclpomsswfpp0" > Symbol hasInterned: sel ifTrue: [:symb | > (self class canUnderstand: sel asSymbol) ifTrue: [ > reshaped ifNil: [reshaped := Dictionary new]. > cls := self perform: sel asSymbol]]. "This class will take > responsibility" > cls ifNil: [cls := self writeClassRenameMethod: sel was: nm > fromInstVars: (structures at: nm). > cls isString ifTrue: [cls := nil]]. > cls ifNotNil: [renamed at: nm put: cls name]. > ^ cls > ! > > > |
Free forum by Nabble | Edit this page |