Adding an iVar to class "Class" still gives error
Unfortunately it is not fixed, anyone with knowledge of the new class builder able to fix it: https://pharo.fogbugz.com/f/cases/11596
I found a way to fix it. For certain classes and metaclasses, the slotScope is not correct. That is "aClass superclass layout slotScope == aClass layout slotScope parentScope" responds false!! Here is a dirty fix to find and rebuild these classes and metaclasses. But I would like to have a better way to rebuild a class than adding then removing an inst var. After executing this, you can add an iv to class (beware it takes several minutes). ivName := 'anIVNameImPrettySureNobodyUses'. all := Smalltalk allClasses flatCollect: [ :e | { e . e class } ]. candidates := all reject: [ :e | e superclass isNil or: [e layout slotScope isKindOf: LayoutEmptyScope ] ]. toRebuild := candidates reject: [ :e | e superclass layout slotScope == e layout slotScope parentScope ]. toRebuild do: [ :e | e addInstVarNamed: ivName ]. toRebuild do: [ :e | (e isClassSide ifTrue: [ (Smalltalk at: e instanceSide name) classSide ] ifFalse: [ Smalltalk at: e name ]) removeInstVarNamed: ivName ] On 25 févr. 2014, at 09:09, Torsten Bergmann <astares@gmx.de> wrote:
Unfortunately it is not fixed, anyone with knowledge of the new class builder able to fix it:
participants (2)
-
Camille Teruel -
Torsten Bergmann