Class.st
changeset 5703 36c0ae8ba8d6
parent 5660 c7cb5040a2f0
child 5707 0b7652a19caf
--- a/Class.st	Fri Nov 10 18:26:31 2000 +0100
+++ b/Class.st	Tue Nov 14 14:41:06 2000 +0100
@@ -3483,7 +3483,15 @@
      The receiver must be a private class.
      Returns the new public class."
 
-    |sel owner newClass|
+    ^ self makePublicIn:Smalltalk
+!
+
+makePublicIn:aNameSpace
+    "make a public class from the receiver.
+     The receiver must be a private class.
+     Returns the new public class."
+
+    |sel owner newName newClass|
 
     owner := self topOwningClass.
     owner isNil ifTrue:[^ self].
@@ -3491,26 +3499,34 @@
     "/ first, create the public class ...
     sel := self definitionSelector.
 
-    Class nameSpaceQuerySignal answer:Smalltalk
+    Class nameSpaceQuerySignal answer:aNameSpace
     do:[
-	newClass := self superclass
-	    perform:sel
-	    withArguments:(Array 
-			    with:(self nameWithoutPrefix asSymbol)
-			    with:(self instanceVariableString)
-			    with:(self classVariableString)
-			    with:''
-			    with:(owner category)).
-
-	"/ copy over methods ...
-	self class copyInvalidatedMethodsFrom:self class for:newClass class.
-	self class copyInvalidatedMethodsFrom:self for:newClass.
-	newClass class recompileInvalidatedMethods.
-	newClass recompileInvalidatedMethods.
+        (aNameSpace isNil or:[aNameSpace == Smalltalk]) ifTrue:[
+            newName := self nameWithoutPrefix
+        ] ifFalse:[
+            newName := aNameSpace name , '::' , self nameWithoutPrefix
+        ].
+        newClass := self superclass
+            perform:sel
+            withArguments:(Array 
+                            with:(newName asSymbol)
+                            with:(self instanceVariableString)
+                            with:(self classVariableString)
+                            with:''
+                            with:(owner category)).
+
+        "/ copy over methods ...
+        self class copyInvalidatedMethodsFrom:self class for:newClass class.
+        self class copyInvalidatedMethodsFrom:self for:newClass.
+        newClass class recompileInvalidatedMethods.
+        newClass recompileInvalidatedMethods.
     ].
 
     owner changed:#newClass with:newClass.
     Smalltalk changed:#newClass with:newClass.
+    (aNameSpace notNil and:[aNameSpace ~~ Smalltalk]) ifTrue:[
+        aNameSpace changed:#newClass with:newClass.
+    ].
 
     self removeFromSystem.
 
@@ -4502,5 +4518,5 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.383 2000-10-09 14:31:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.384 2000-11-14 13:41:06 cg Exp $'
 ! !