fixed package setting
authorClaus Gittinger <cg@exept.de>
Thu, 26 Aug 1999 13:51:19 +0200
changeset 4638 c0984e7647a7
parent 4637 814b3d8e3f72
child 4639 a139399c5f4f
fixed package setting
Metaclass.st
--- a/Metaclass.st	Thu Aug 26 12:18:21 1999 +0200
+++ b/Metaclass.st	Thu Aug 26 13:51:19 1999 +0200
@@ -851,41 +851,41 @@
     ].
 
     "/ set the new classes package
-    "/ but prefer the old package
+    "/ but be careful here ...
 
     oldClass isNil ifTrue:[
+        "/ new classes get the current package ...
         pkg := Class packageQuerySignal query.
     ] ifFalse:[
-"/        pkg := Class packageQuerySignal query.
-
-        pkg := oldPkg := oldClass package.
-        oldClass isLoaded ifTrue:[
-            "/ if not autoloading, check if we are in another project-package
+        oldPkg := oldClass package.
+        oldClass isLoaded ifFalse:[
+            "/ autoloaded classes get the package of the autoload stub ...
+            pkg := oldPkg
+        ] ifTrue:[
+            "/ not autoloading, check for packageRedef ...
 
             pkg := Class packageQuerySignal query.
             oldPkg ~= pkg ifTrue:[
                 newClass package:pkg.
-
                 answer := Class classRedefinitionSignal
                               raiseRequestWith:(oldClass -> newClass)
                               errorString:('redefinition of class: ' , oldClass name).
                 answer == #keep ifTrue:[
-"/                    Smalltalk silentLoading ifFalse:[
-"/                      Transcript showCR:('keeping original package: ''' , oldPkg , ''' of class: ' , oldClass name).
-"/                    ].
+                    "/ keep old package
                     pkg := oldPkg.
                 ] ifFalse:[
                     answer ~~ #continue ifTrue:[
+                        "/ cancel
                         ^ nil
-                   ].
+                    ].
+                    "/ take new package
                 ].
             ].
             newClass setBinaryRevision:(oldClass binaryRevision).
         ].
     ].
     pkg notNil ifTrue:[
-        "/ newMetaclass package:pkg.
-        "/ Transcript showCR:('set package of class: ' , newClass name , ' to ' , pkg printString).
+"/ Transcript showCR:('set package of class: ' , newClass name , ' to ' , pkg printString).
         newClass package:pkg.
     ].
 
@@ -1034,34 +1034,34 @@
                       oldClass addChangeRecordForClassComment:oldClass.
                   ]
               ]. 
+              oldClass package:newClass package.
 
               (oldClassVars = newClassVars) ifTrue:[
-
-                "/ really no change (just comment and/or category)
+                  "/ really no change (just comment and/or category)
 
-                anyChange := false.
+                  anyChange := false.
 
-                oldClass setInstanceVariableString:(newClass instanceVariableString).
-                oldClass setClassVariableString:(newClass classVariableString).
+                  oldClass setInstanceVariableString:(newClass instanceVariableString).
+                  oldClass setClassVariableString:(newClass classVariableString).
 
-                oldClass category ~= categoryString ifTrue:[
-                    oldClass category:categoryString. 
-                    changed ifTrue:[
-                        newClass addChangeRecordForClass:newClass.
-                    ].    
-                    namespace notNil ifTrue:[
-                        thisIsPrivate ifFalse:[
-                            "notify change of category"
-                            namespace changed:#organization.
-                            namespace ~~ Smalltalk ifTrue:[
-                                Smalltalk changed:#organization.
-                            ]
-                        ]
-                    ]
-                ].
-                "notify change of class"
+                  oldClass category ~= categoryString ifTrue:[
+                      oldClass category:categoryString. 
+                      changed ifTrue:[
+                          newClass addChangeRecordForClass:newClass.
+                      ].    
+                      namespace notNil ifTrue:[
+                          thisIsPrivate ifFalse:[
+                              "notify change of category"
+                              namespace changed:#organization.
+                              namespace ~~ Smalltalk ifTrue:[
+                                  Smalltalk changed:#organization.
+                              ]
+                          ]
+                      ]
+                  ].
+                  "notify change of class"
 "/                oldClass changed.
-                ^ oldClass
+                  ^ oldClass
               ].
 
               "/ when we arrive here, class variables have changed
@@ -1070,13 +1070,13 @@
                   "notify change of organization"
                   oldClass category:categoryString. 
                   namespace notNil ifTrue:[
-                       thisIsPrivate ifFalse:[ 
-                            "notify change of organization"
-                            namespace changed:#organization.
-                            namespace ~~ Smalltalk ifTrue:[
-                                Smalltalk changed:#organization.
-                            ]
-                        ]
+                      thisIsPrivate ifFalse:[ 
+                          "notify change of organization"
+                          namespace changed:#organization.
+                          namespace ~~ Smalltalk ifTrue:[
+                              Smalltalk changed:#organization.
+                          ]
+                      ]
                   ].
               ].
 
@@ -2019,6 +2019,6 @@
 !Metaclass class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.151 1999-08-10 18:26:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.152 1999-08-26 11:51:19 cg Exp $'
 ! !
 Metaclass initialize!