Smalltalk.st
changeset 7996 facae0a118da
parent 7992 fbf6f1080ba2
child 7999 475bba3ead9a
--- a/Smalltalk.st	Wed Feb 25 17:17:32 2004 +0100
+++ b/Smalltalk.st	Wed Feb 25 17:33:59 2004 +0100
@@ -1181,24 +1181,24 @@
     i2 := 1.
     ns := self.
     [i2 ~~ 0] whileTrue:[
-	i2 := newName indexOfSubCollection:'::' startingAt:i1.
-	i2 ~~ 0 ifTrue:[
-	    nm := newName copyFrom:i1 to:i2-1.
-	    ns isNameSpace ifTrue:[
-		subns := ns at:nm asSymbol ifAbsent:nil.
-		subns isNil ifTrue:[
-		    self error:'Nonexisting namespace: ',nm.
-		    ^ nil.
-		].
-	    ] ifFalse:[
-		subns := ns privateClassesAt:nm asSymbol.
-		subns isNil ifTrue:[
-		    self error:'Cannot create a namespace below a class'
-		]
-	    ].
-	    ns := subns.
-	    i1 := i2 + 2.
-	].
+        i2 := newName indexOfSubCollection:'::' startingAt:i1.
+        i2 ~~ 0 ifTrue:[
+            nm := newName copyFrom:i1 to:i2-1.
+            ns isNameSpace ifTrue:[
+                subns := ns at:nm asSymbol ifAbsent:nil.
+                subns isNil ifTrue:[
+                    self error:'Nonexisting namespace: ',nm.
+                    ^ nil.
+                ].
+            ] ifFalse:[
+                subns := ns privateClassesAt:nm asSymbol.
+                subns isNil ifTrue:[
+                    self error:'Cannot create a namespace below a class'
+                ]
+            ].
+            ns := subns.
+            i1 := i2 + 2.
+        ].
     ].
 
     oldName := aClass name.
@@ -1209,8 +1209,8 @@
     privateClasses := aClass privateClassesSorted.
 
     ((self at:oldSym) ~~ aClass) ifTrue:[
-	'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR.
-	^ self
+        'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR.
+        ^ self
     ].
 
     "/ rename the class
@@ -1224,28 +1224,28 @@
 
     "/ change the owning class
     ns isNameSpace ifFalse:[
-	aClass isPrivate ifTrue:[
-	    aClass class setOwningClass:ns.
-	] ifFalse:[
-	    oldMetaclass := aClass class.
-
-	    "/ sigh - must make a PrivateMetaclass from Metaclass
-	    newMetaclass := PrivateMetaclass new.
-	    newMetaclass flags:(oldMetaclass flags).
-	    newMetaclass setSuperclass:(oldMetaclass superclass).
-	    newMetaclass instSize:(oldMetaclass instSize).
-	    newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString).
-	    newMetaclass setMethodDictionary:(oldMetaclass methodDictionary).
-	    newMetaclass setSoleInstance:aClass.
-	    newMetaclass setOwningClass:ns.
-
-	    aClass changeClassTo:newMetaclass.
-	    ObjectMemory flushCaches.
-	]
+        aClass isPrivate ifTrue:[
+            aClass class setOwningClass:ns.
+        ] ifFalse:[
+            oldMetaclass := aClass class.
+
+            "/ sigh - must make a PrivateMetaclass from Metaclass
+            newMetaclass := PrivateMetaclass new.
+            newMetaclass flags:(oldMetaclass flags).
+            newMetaclass setSuperclass:(oldMetaclass superclass).
+            newMetaclass instSize:(oldMetaclass instSize).
+            newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString).
+            newMetaclass setMethodDictionary:(oldMetaclass methodDictionary).
+            newMetaclass setSoleInstance:aClass.
+            newMetaclass setOwningClass:ns.
+
+            aClass changeClassTo:newMetaclass.
+            ObjectMemory flushCaches.
+        ]
     ] ifTrue:[
-	aClass isPrivate ifTrue:[
-	    aClass class setOwningClass:nil.
-	]        
+        aClass isPrivate ifTrue:[
+            aClass class setOwningClass:nil.
+        ]        
     ].
 
     "/
@@ -1260,32 +1260,32 @@
 
     names := aClass classVariableString asCollectionOfWords.
     names do:[:name |
-	oldCVSym := (oldSym , ':' , name) asSymbol.
-	value := self at:oldCVSym.
-	self at:oldCVSym put:nil.
-
-	"/
-	"/ see comment in #removeKey: on why we dont remove it it here
-	"/
-	"/ self removeKey:cSym.
-
-	newCVSym := (newSym , ':' , name) asSymbol.
-	self at:newCVSym put:value.
-
-	oldNameToNewName at:oldCVSym put:newCVSym.
+        oldCVSym := (oldSym , ':' , name) asSymbol.
+        value := self at:oldCVSym.
+        self at:oldCVSym put:nil.
+
+        "/
+        "/ see comment in #removeKey: on why we dont remove it it here
+        "/
+        "/ self removeKey:cSym.
+
+        newCVSym := (newSym , ':' , name) asSymbol.
+        self at:newCVSym put:value.
+
+        oldNameToNewName at:oldCVSym put:newCVSym.
     ].
 
     "/ patch methods literal arrays from oldCVname to newCVname
 
     oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym |
-	aClass withAllSubclasses do:[:aSubClass |
-	    Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'.        
-	    aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod |
-		aMethod changeLiteral:oldNameSym to:newNameSym
-	    ].
-	].
-
-	"/ and also in privateClasses ? ...
+        aClass withAllSubclasses do:[:aSubClass |
+            Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'.        
+            aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod |
+                aMethod changeLiteral:oldNameSym to:newNameSym
+            ].
+        ].
+
+        "/ and also in privateClasses ? ...
 
 "/        privateClasses size > 0 ifTrue:[
 "/            privateClasses do:[:aPrivateClass |
@@ -1308,77 +1308,81 @@
     newNameSpace := aClass topNameSpace.
 
     privateClasses size > 0 ifTrue:[
-	"/ must rename privateClasses as well
-	Class withoutUpdatingChangesDo:[
-	    privateClasses do:[:aPrivateClass |
-		self renameClass:aPrivateClass
-		     to:(newSym , '::' , aPrivateClass nameWithoutPrefix).
+        "/ must rename privateClasses as well
+        Class withoutUpdatingChangesDo:[
+            privateClasses do:[:aPrivateClass |
+                self renameClass:aPrivateClass
+                     to:(newSym , '::' , aPrivateClass nameWithoutPrefix).
             
-		Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'.
-		ClassBuilder
-		    recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol 
-		    in:newNameSpace 
-		    except:nil.
-	    ]
-	]
+                Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'.
+                ClassBuilder
+                    recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol 
+                    in:newNameSpace 
+                    except:nil.
+            ]
+        ]
     ].
 
     oldNameSpace ~~ newNameSpace ifTrue:[
 
-	"/ all those referencing the class from the old nameSpace
-	"/ must be recompiled ...
-	"/ (to now access the global from smalltalk)
-
-	oldNameSpace ~~ Smalltalk ifTrue:[
-	    Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'.
-
-	    ClassBuilder
-		recompileGlobalAccessorsTo:oldName asSymbol 
-		in:oldNameSpace 
-		except:nil.
-	].
-
-	"/ all referencing the class in the new namespace
-	"/ as well; to now access the new class.
-
-	(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[
-	    Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'.
-
-	    ClassBuilder
-		recompileGlobalAccessorsTo:oldBaseName asSymbol 
-		in:newNameSpace 
-		except:nil.
-	].
+        "/ all those referencing the class from the old nameSpace
+        "/ must be recompiled ...
+        "/ (to now access the global from smalltalk)
+
+        oldNameSpace ~~ Smalltalk ifTrue:[
+            Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'.
+
+            ClassBuilder
+                recompileGlobalAccessorsTo:oldName asSymbol 
+                in:oldNameSpace 
+                except:nil.
+        ].
+
+        "/ all referencing the class in the new namespace
+        "/ as well; to now access the new class.
+
+        (newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[
+            Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'.
+
+            ClassBuilder
+                recompileGlobalAccessorsTo:oldBaseName asSymbol 
+                in:newNameSpace 
+                except:nil.
+        ].
     ] ifFalse:[
-	"/ all references to a global with my new name in my owning class
-	"/ must now be redirected to myself.
-
-	aClass isPrivate ifTrue:[
-	    newBaseName := aClass nameWithoutNameSpacePrefix.
-	    newBaseNameWithoutPrefix := aClass nameWithoutPrefix.
-
-	    Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.        
-	    aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
-	    aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
-
-	    Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.        
-	    aClass owningClass recompileMethodsAccessingGlobal:oldBaseName.
-	    aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName.
-
-	    Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.        
-	    aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
-	    aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
-
-	    Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.        
-	    aClass owningClass recompileMethodsAccessingGlobal:newBaseName.
-	    aClass owningClass class recompileMethodsAccessingGlobal:newBaseName.
-	]
+        "/ all references to a global with my new name in my owning class
+        "/ must now be redirected to myself.
+
+        aClass isPrivate ifTrue:[
+            newBaseName := aClass nameWithoutNameSpacePrefix.
+            newBaseNameWithoutPrefix := aClass nameWithoutPrefix.
+
+            Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.        
+            aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
+            aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
+
+            Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.        
+            aClass owningClass recompileMethodsAccessingGlobal:oldBaseName.
+            aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName.
+
+            Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.        
+            aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
+            aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
+
+            Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.        
+            aClass owningClass recompileMethodsAccessingGlobal:newBaseName.
+            aClass owningClass class recompileMethodsAccessingGlobal:newBaseName.
+        ]
     ].
 
     aClass changed:#definition.
     "/ because of the change of my superclasses name ...
     aClass allSubclassesDo:[:subClass |
-	subClass changed:#definition.
+        subClass changed:#definition.
+    ].
+    "/ because of the change of my superclasses name ...
+    aClass subclassesDo:[:subClass |
+        subClass addChangeRecordForClass:subClass.
     ].
     self changed:#definition.
     Smalltalk changed:#classRename with:(Array with:aClass with:oldName).
@@ -6658,5 +6662,5 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.631 2004-02-24 19:59:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.632 2004-02-25 16:33:59 cg Exp $'
 ! !