[Cuis-dev] [FIX] Add class instance variables to classes sometimes fails
Gerald Klix
cuis.01 at klix.ch
Tue Jun 28 05:42:16 PDT 2022
Hi all, Hi Juan,
Yesterday night I discovered that adding class instance variables to a
class with sub-classes (sometimes) fails in Haver.
Alas this is not only an issue in Haver but also in
Cuis. Please find enclosed a fix for that issue.
HTH and Best Regards,
Gerald
-------------- next part --------------
'From Cuis 6.0 [latest update: #5323] on 28 June 2022 at 2:28:55 pm'!
!ClassDescription methodsFor: 'private' stamp: 'KLG 6/28/2022 14:28:39'!
newInstanceFrom: oldInstance variable: variable size: instSize map: map
"Create a new instance of the receiver based on the given old instance.
The supplied map contains a mapping of the old instVar names into
the receiver's instVars"
| new |
variable
ifTrue: [new _ self basicNew: oldInstance basicSize]
ifFalse: [new _ self basicNew].
"Limit this to the map's size, if the map's size is smaller than the instance size, we added an instance variable."
1 to: (instSize min: map size) do:
[:offset | (map at: offset) > 0 ifTrue:
[new instVarAt: offset
put: (oldInstance instVarAt: (map at: offset))]].
variable
ifTrue: [1 to: oldInstance basicSize do:
[:offset |
new basicAt: offset put: (oldInstance basicAt: offset)]].
^new! !
More information about the Cuis-dev
mailing list