66 fullName:aFullNameSpacePathName |
66 fullName:aFullNameSpacePathName |
67 "given a possibly nested name of a namespace, create all required |
67 "given a possibly nested name of a namespace, create all required |
68 intermediate spaces (if not already existing) and return the |
68 intermediate spaces (if not already existing) and return the |
69 bottom-level space." |
69 bottom-level space." |
70 |
70 |
|
71 ^ self fullName:aFullNameSpacePathName createIfAbsent:true |
|
72 |
|
73 "Created: 8.11.1996 / 13:41:59 / cg" |
|
74 "Modified: 4.1.1997 / 16:50:59 / cg" |
|
75 ! |
|
76 |
|
77 fullName:aFullNameSpacePathName createIfAbsent:createIfAbsent |
|
78 "given a possibly nested name of a namespace, lookup and return |
|
79 a namespace instance for it. |
|
80 If createIfAbsent is true, create all required intermediate spaces (if not already existing) |
|
81 and return the bottom-level space. |
|
82 If false, and if any namespace along the path does not exist, reutrn nil." |
|
83 |
|
84 |list thisNamespace| |
|
85 |
71 "/ break it up, check for all intermediate spaces to exist |
86 "/ break it up, check for all intermediate spaces to exist |
72 "/ create them as required. |
87 "/ create them as required. |
73 |
|
74 |list thisNamespace| |
|
75 |
88 |
76 (aFullNameSpacePathName includes:$:) ifTrue:[ |
89 (aFullNameSpacePathName includes:$:) ifTrue:[ |
77 "/ old style |
90 "/ old style |
78 list := aFullNameSpacePathName asCollectionOfSubstringsSeparatedByAll:'::'. |
91 list := aFullNameSpacePathName asCollectionOfSubstringsSeparatedByAll:'::'. |
79 ] ifFalse:[ |
92 ] ifFalse:[ |
92 thisNamespace isNil ifTrue:[ |
105 thisNamespace isNil ifTrue:[ |
93 (Smalltalk includesKey:key) ifTrue:[ |
106 (Smalltalk includesKey:key) ifTrue:[ |
94 thisNamespace := Smalltalk at:key. |
107 thisNamespace := Smalltalk at:key. |
95 (thisNamespace notNil |
108 (thisNamespace notNil |
96 and:[thisNamespace isBehavior not]) ifTrue:[ |
109 and:[thisNamespace isBehavior not]) ifTrue:[ |
|
110 createIfAbsent ifFalse:[ ^ nil ]. |
97 self error:'name conflict: namespace ' , aName , ' vs. global'. |
111 self error:'name conflict: namespace ' , aName , ' vs. global'. |
98 ] |
112 ] |
99 ]. |
113 ]. |
100 thisNamespace isNil ifTrue:[ |
114 thisNamespace isNil ifTrue:[ |
|
115 createIfAbsent ifFalse:[ ^ nil ]. |
101 thisNamespace := self name:key |
116 thisNamespace := self name:key |
102 ]. |
117 ]. |
103 ] ifFalse:[ |
118 ] ifFalse:[ |
104 thisNamespace isNameSpace ifTrue:[ |
119 thisNamespace isNameSpace ifTrue:[ |
105 x := thisNamespace at:key. |
120 x := thisNamespace at:key. |
108 x := thisNamespace privateClassesAt:key. |
123 x := thisNamespace privateClassesAt:key. |
109 ]. |
124 ]. |
110 ]. |
125 ]. |
111 |
126 |
112 x isNil ifTrue:[ |
127 x isNil ifTrue:[ |
|
128 createIfAbsent ifFalse:[ ^ nil ]. |
113 thisNamespace isNameSpace ifTrue:[ |
129 thisNamespace isNameSpace ifTrue:[ |
114 thisNamespace == Smalltalk ifTrue:[ |
130 thisNamespace == Smalltalk ifTrue:[ |
115 x := self name:key |
131 x := self name:key |
116 ] ifFalse:[ |
132 ] ifFalse:[ |
117 x := thisNamespace name:key. |
133 x := thisNamespace name:key. |
118 ] |
134 ] |
119 ] ifFalse:[ |
135 ] ifFalse:[ |
120 x := |
136 x := |
121 self subclass:key |
137 self subclass:key |
122 instanceVariableNames:'' |
138 instanceVariableNames:'' |
123 classVariableNames:'' |
139 classVariableNames:'' |