[squeak-dev] SmartRefStream tweak?

St├ęphane Rollandin lecteur at zogotounga.net
Sun Jul 24 09:17:06 UTC 2022

I am in the process of porting my code to 6.0, and I found that I had to 
tweak the #next method in SmartRefStream in order to load properly some 
morphs that were serialized from a 5.1 image.

I had to add four calls to #rehash (see attached code).

Would that be something useful to have, or am I (again) missing something?

-------------- next part --------------
'From Squeak5.1 of 23 August 2016 [latest update: #16548] on 24 July 2022 at 11:10:23 am'!

!SmartRefStream methodsFor: '*MuO-overrides' stamp: 'spfa 7/24/2022 10:45'!
	"Really write three objects: (version, class structure, object). But only when called from the outside.  "

	| version ss object |
	^ topCall == nil 
			[topCall := #marked.
			version := super next.
			version class == SmallInteger ifFalse: [^ version].	
				"version number, else just a regular object, not in our format, "
			self checkCrLf.
			ss := super next.
			ss class == Array ifFalse: [^ ss].  "just a regular object"
			(ss at: 1) = 'class structure' ifFalse: [^ ss].
			structures := (ss at: 2) rehash.
			superclasses := (ss size > 3 and: [(ss at: 3) = 'superclasses']) 
				ifTrue: [(ss at: 4) rehash]		"class name -> superclass name"
				ifFalse: [Dictionary new].
			(self verifyStructure = 'conversion method needed') ifTrue: [^ nil].
			object := super next rehash.	"all the action here"
			self restoreClassInstVars.		"for UniClasses. version 4"

			topCall := nil.	"reset it"
			[super next rehash]
! !

More information about the Squeak-dev mailing list