NameSpace.st
changeset 7426 4059d00c81d7
parent 7317 461d6124fd63
child 7431 ba25eb29e77d
--- a/NameSpace.st	Wed Jun 18 15:40:19 2003 +0200
+++ b/NameSpace.st	Wed Jun 18 15:58:52 2003 +0200
@@ -71,26 +71,15 @@
     "/ break it up, check for all intermediate spaces to exist
     "/ create them as required.
 
-    |list idx0 idx superSpace done thisNamespace|
+    |list thisNamespace|
 
-    list := OrderedCollection new.
-    idx0 := 1.
-    done := false.
-    [done] whileFalse:[
-        idx := aFullNameSpacePathName indexOf:$: startingAt:idx0.
-        (idx ~~ 0) ifTrue:[
-            (idx < aFullNameSpacePathName size and:[(aFullNameSpacePathName at:(idx+1)) == $:]) ifTrue:[
-                superSpace := aFullNameSpacePathName copyFrom:idx0 to:(idx-1).
-                list add:superSpace.
-                idx0 := idx +2.
-            ] ifFalse:[
-                done := true
-            ]
-        ] ifFalse:[
-            done := true.
-        ]
+    (aFullNameSpacePathName includes:$:) ifTrue:[
+        "/ old style
+        list := aFullNameSpacePathName asCollectionOfSubstringsSeparatedByAll:'..'.
+    ] ifFalse:[
+        "/ new style
+        list := aFullNameSpacePathName asCollectionOfSubstringsSeparatedBy:$..
     ].
-    list add:(aFullNameSpacePathName copyFrom:idx0).
 
     "/ now, look and create 'em
 
@@ -112,20 +101,30 @@
                 thisNamespace := self name:key
             ]
         ] ifFalse:[
-            x := thisNamespace privateClassesAt:key.
-            x notNil ifTrue:[
-                thisNamespace := x
+            thisNamespace isNameSpace ifTrue:[
+                x := thisNamespace at:key.
             ] ifFalse:[
-                thisNamespace :=
-                    self subclass:key
-                       instanceVariableNames:''
-                       classVariableNames:''
-                       poolDictionaries:''
-                       privateIn:thisNamespace.
+                thisNamespace isBehavior ifTrue:[
+                    x := thisNamespace privateClassesAt:key.
+                ].
+            ].
 
-                "/ nameSpaces are not in any package
-                thisNamespace setPackage:nil.
-            ]    
+            x isNil ifTrue:[
+                thisNamespace isNameSpace ifTrue:[
+                    x := thisNamespace name:key.
+                ] ifFalse:[
+                    x :=
+                        self subclass:key
+                           instanceVariableNames:''
+                           classVariableNames:''
+                           poolDictionaries:''
+                           privateIn:thisNamespace.
+                ].
+
+                "/ nameSpaces are not in any package (yet)
+                x setPackage:nil.
+            ].
+            thisNamespace := x.
         ]
     ].
 
@@ -512,5 +511,5 @@
 !NameSpace class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.47 2003-05-22 19:41:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.48 2003-06-18 13:58:52 cg Exp $'
 ! !