ClassBuilder.st
changeset 8743 3992e2ac5c7f
parent 8724 dceaa47d4217
child 8764 1fe531dc199b
--- a/ClassBuilder.st	Wed Feb 16 00:13:38 2005 +0100
+++ b/ClassBuilder.st	Wed Feb 16 13:29:23 2005 +0100
@@ -325,7 +325,7 @@
      This might change in the future.
     "
 
-    |newClass newMetaclass nameString newComment|
+    |newClass newMetaclass newComment|
 
     "NOTICE:
      this method is too complex and should be splitted into managable pieces ...
@@ -357,8 +357,6 @@
         ].
     ].
 
-    nameString := className asString.
-
     (self determineNewName) ifFalse:[
         ^ nil.
     ].
@@ -430,7 +428,7 @@
             "/
             ((variable == true) and:[pointers]) ifTrue:[
                 (oldClass isKindOf:Set class) ifTrue:[
-                    (self confirm:('ST/X Set & Dictionary are not variable-classes.\Create %1 anyway ?' bindWith:nameString) withCRs)
+                    (self confirm:('ST/X Set & Dictionary are not variable-classes.\Create %1 anyway ?' bindWith:className) withCRs)
                     ifFalse:[
                         ^ nil
                     ]
@@ -1784,6 +1782,25 @@
 !ClassBuilder methodsFor:'checks'!
 
 checkClassName
+    |fullNameString idx environmentName|
+
+    "/ check if the given name implies a (sub-) namespace
+    "/ happens (currently) when installing autoloaded classes
+    (className includes:$:) ifTrue:[
+        environment notNil ifTrue:[
+            fullNameString := environment name , '::' , className
+        ] ifFalse:[
+            fullNameString := className
+        ].
+        idx := fullNameString lastIndexOf:$:.
+        className := (fullNameString copyFrom:idx+1) asSymbol.
+        environmentName := fullNameString copyTo:idx-2.
+        environment := Smalltalk at:environmentName asSymbol.
+        environment isNil ifTrue:[
+            environment := NameSpace fullName:environmentName
+        ].
+    ].
+
     environment isNil ifTrue:[
         "/ no constraints
         ^ self
@@ -2008,5 +2025,5 @@
 !ClassBuilder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.42 2005-02-01 15:31:59 james Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.43 2005-02-16 12:29:23 cg Exp $'
 ! !