Bug 44684

GemStone/S 64 Bit

3.2.2, 3.2.1,,,,,,, 3.1

All Platforms


Class>>_classDefiningClassVar: returns nil for class vars defined on superclass

Class>>_classDefiningClassVar: will correctly return the receiver when the argument is a class variable defined on the receiver.  But if the class variable is defined on one of the receiver's superclasses, this method will return nil instead of the correct superclass.


File in the following code as SystemUser and commit.

category: 'Subclass Creation'
method: Class
_classDefiningClassVar: aSymbol

"Returns the receiver or the superclass that defines a class variable with
 name aSymbol, otherwise returns nil."

| aClass |
aClass := self .
  aClass _classVars ifNotNil:[ :cvs |
    ( cvs associationAt: aSymbol otherwise: nil ) ifNotNil:[
      ^ aClass 
  aClass := aClass superClass .
  aClass == nil
] untilTrue .
^ nil

Last updated: 10/14/14