Metaclass.st
changeset 1798 543f1601bbeb
parent 1778 fd558245c662
child 1809 d5f8d427904b
--- a/Metaclass.st	Tue Oct 22 11:18:10 1996 +0200
+++ b/Metaclass.st	Tue Oct 22 16:27:24 1996 +0200
@@ -400,6 +400,7 @@
 
     (Smalltalk at:(oldClass name asSymbol) ifAbsent:nil) == oldClass ifTrue:[
         Smalltalk at:(oldClass name asSymbol) put:newClass.
+        self checkForAliasesOf:oldClass with:newClass.
     ].
     ObjectMemory flushCachesFor:oldClass.
 
@@ -413,6 +414,7 @@
 
         (Smalltalk at:(oldSubClass name asSymbol) ifAbsent:nil) == oldSubClass ifTrue:[
             Smalltalk at:oldSubClass name asSymbol put:newSubClass.
+            self checkForAliasesOf:oldSubClass with:newSubClass.
         ].
         ObjectMemory flushCachesFor:oldSubClass.
     ].
@@ -426,7 +428,7 @@
 
     "Created: 29.10.1995 / 19:57:08 / cg"
     "Modified: 7.6.1996 / 08:43:19 / stefan"
-    "Modified: 14.10.1996 / 16:48:11 / cg"
+    "Modified: 22.10.1996 / 15:20:47 / cg"
 ! !
 
 !Metaclass methodsFor:'copying'!
@@ -1164,6 +1166,9 @@
             aSystemDictionaryOrClass privateClassesAt:classSymbol put:newClass.
         ] ifFalse:[
             aSystemDictionaryOrClass at:classSymbol put:newClass.
+            aSystemDictionaryOrClass == Smalltalk ifTrue:[
+                self checkForAliasesOf:oldClass with:newClass.
+            ].
 
             oldClass category ~= categoryString ifTrue:[
                 "notify change of organization"
@@ -1192,7 +1197,7 @@
 
     "Created: 26.5.1996 / 11:55:26 / cg"
     "Modified: 18.6.1996 / 14:19:39 / stefan"
-    "Modified: 18.10.1996 / 11:15:17 / cg"
+    "Modified: 22.10.1996 / 15:22:17 / cg"
 !
 
 name:newName inEnvironment:aSystemDictionary
@@ -1334,6 +1339,25 @@
     "Modified: 15.10.1996 / 12:00:30 / cg"
 !
 
+checkForAliasesOf:oldClass with:newClass
+    "oldClass changed its identity (now use newClass).
+     check if there are any global aliases, which should also be changed"
+
+    Smalltalk keysAndValuesDo:[:nm :o |
+        o == oldClass ifTrue:[
+            nm ~~ oldClass name ifTrue:[
+                (self confirm:('The global `' , nm , ''' is an alias for ' , oldClass name , '.\\Change it to the new class ?') withCRs)
+                ifTrue:[
+                    Smalltalk at:nm put:newClass
+                ]
+            ]
+        ]
+    ].
+
+    "Created: 22.10.1996 / 15:20:59 / cg"
+    "Modified: 22.10.1996 / 15:25:50 / cg"
+!
+
 copyInvalidatedMethodsFrom:oldClass for:newClass
     "copy all methods from oldClass to newClass and change their code
      to a trap method reporting an error.
@@ -1572,5 +1596,5 @@
 !Metaclass class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.74 1996-10-18 10:15:52 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.75 1996-10-22 14:27:24 cg Exp $'
 ! !