keep classVarNames as array (much like instVars)
authorClaus Gittinger <cg@exept.de>
Fri, 11 Aug 2000 19:38:27 +0200
changeset 5514 0db3f902e1df
parent 5513 17d96aee4111
child 5515 4adb4b3a7475
keep classVarNames as array (much like instVars)
Class.st
--- a/Class.st	Fri Aug 11 17:34:42 2000 +0200
+++ b/Class.st	Fri Aug 11 19:38:27 2000 +0200
@@ -482,9 +482,14 @@
      in the returned collection - use allClassVarNames, to get all known names."
 
     classvars isNil ifTrue:[
-	^ OrderedCollection new
+        ^ OrderedCollection new
     ].
-    ^ classvars asCollectionOfWords
+    classvars isString ifTrue:[
+        classvars := classvars asCollectionOfWords asArray.
+        ^ classvars
+    ].
+
+    ^ classvars
 
     "
      Object classVarNames 
@@ -498,7 +503,11 @@
      returned string."
 
     classvars isNil ifTrue:[^ ''].
-    ^ classvars
+    classvars isString ifTrue:[
+        ^ classvars
+    ].
+
+    ^ classvars asStringWith:(Character space)
 
     "
      Object classVariableString 
@@ -513,32 +522,32 @@
 
     |prevVarNames varNames any|
 
-    (classvars = aString) ifFalse:[
-	prevVarNames := self classVarNames.
-	classvars := aString.
-	varNames := self classVarNames.
-
-	"new ones get initialized to nil;
-	 - old ones are nilled and removed from Smalltalk"
-	any := false.
-
-	varNames do:[:aName |
-	    (prevVarNames includes:aName) ifFalse:[
-		"a new one"
-		self classVarAt:aName put:nil.
-		any := true.
-	    ] ifTrue:[
-		prevVarNames remove:aName
-	    ]
-	].
-	"left overs are gone"
-	prevVarNames do:[:aName |
-	    self classVarAt:aName put:nil.
-	    Smalltalk removeKey:(self name , ':' , aName) asSymbol.
-	].
-	any ifTrue:[
-	    Smalltalk changed:#classVariables with:self
-	].
+    (aString = self classVariableString) ifFalse:[
+        prevVarNames := self classVarNames.
+        classvars := aString.
+        varNames := self classVarNames.
+
+        "new ones get initialized to nil;
+         - old ones are nilled and removed from Smalltalk"
+        any := false.
+
+        varNames do:[:aName |
+            (prevVarNames includes:aName) ifFalse:[
+                "a new one"
+                self classVarAt:aName put:nil.
+                any := true.
+            ] ifTrue:[
+                prevVarNames remove:aName
+            ]
+        ].
+        "left overs are gone"
+        prevVarNames do:[:aName |
+            self classVarAt:aName put:nil.
+            Smalltalk removeKey:(self name , ':' , aName) asSymbol.
+        ].
+        any ifTrue:[
+            Smalltalk changed:#classVariables with:self
+        ].
     ]
 
     "Modified: 2.4.1997 / 00:16:05 / stefan"
@@ -1336,14 +1345,14 @@
     (instvars isNil or:[instvars isEmpty]) ifTrue:[
         s := nil
     ] ifFalse:[
-        s := instvars isString ifTrue:[instvars] ifFalse:[instvars asStringCollection asString]
+        s := self instanceVariableString
     ].
     s storeBinaryOn:stream manager:manager.
 
-    (classvars notNil and:[classvars isEmpty]) ifTrue:[
+    (classvars isNil or:[classvars isEmpty]) ifTrue:[
         s := nil
     ] ifFalse:[
-        s := classvars isString ifTrue:[classvars] ifFalse:[classvars asStringCollection asString]
+        s := self classVariableString
     ].
     s storeBinaryOn:stream manager:manager.
 
@@ -4452,5 +4461,5 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.374 2000-07-20 14:02:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.375 2000-08-11 17:38:27 cg Exp $'
 ! !