5311
|
1 |
Object subclass:#QualifiedName
|
|
2 |
instanceVariableNames:'pathString'
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'Kernel-Support'
|
|
6 |
!
|
|
7 |
|
|
8 |
|
|
9 |
!QualifiedName class methodsFor:'instance creation'!
|
|
10 |
|
|
11 |
for:aStringOrSymbol
|
|
12 |
^ self new name:aStringOrSymbol
|
|
13 |
|
|
14 |
|
|
15 |
!
|
|
16 |
|
|
17 |
makeUnambiguous
|
|
18 |
^ self
|
|
19 |
!
|
|
20 |
|
|
21 |
pathString:aPathString
|
|
22 |
^ self new pathString:aPathString
|
|
23 |
! !
|
|
24 |
|
|
25 |
!QualifiedName methodsFor:'accessing'!
|
|
26 |
|
|
27 |
asString
|
|
28 |
^ pathString
|
|
29 |
|
|
30 |
|
|
31 |
!
|
|
32 |
|
|
33 |
comment:aString
|
|
34 |
"empty for now"
|
|
35 |
!
|
|
36 |
|
|
37 |
name:aStringOrSymbol
|
|
38 |
pathString := aStringOrSymbol asSymbol
|
|
39 |
|
|
40 |
!
|
|
41 |
|
|
42 |
pathString
|
|
43 |
"return the value of the instance variable 'pathString' (automatically generated)"
|
|
44 |
|
|
45 |
^ pathString!
|
|
46 |
|
|
47 |
pathString:something
|
|
48 |
"set the value of the instance variable 'pathString' (automatically generated)"
|
|
49 |
|
|
50 |
pathString := something.! !
|
|
51 |
|
|
52 |
!QualifiedName methodsFor:'conditional execution'!
|
|
53 |
|
|
54 |
value
|
|
55 |
"return my binding value, if unbound, return nil"
|
|
56 |
|
|
57 |
^ self valueOrDo:[]
|
|
58 |
!
|
|
59 |
|
|
60 |
valueOrDo:aBlock
|
|
61 |
"return my binding value, if unbound, return the result from evaluating aBlock"
|
|
62 |
|
|
63 |
|ns path|
|
|
64 |
|
|
65 |
path := pathString asCollectionOfSubstringsSeparatedBy:$..
|
|
66 |
((path size > 0) and:[path first = 'Core']) ifTrue:[
|
|
67 |
path := path copyFrom:2
|
|
68 |
].
|
|
69 |
ns := Smalltalk.
|
|
70 |
path do:[:component |
|
|
71 |
ns := ns at:component asSymbol ifAbsent:[ ^ aBlock value ].
|
|
72 |
].
|
|
73 |
^ ns
|
|
74 |
! !
|
|
75 |
|
|
76 |
!QualifiedName methodsFor:'defining'!
|
|
77 |
|
|
78 |
defineClass: name superclass: superclass
|
|
79 |
indexedType: indexed
|
|
80 |
private: private
|
|
81 |
instanceVariableNames: instVars
|
|
82 |
classInstanceVariableNames: classInstVars
|
|
83 |
imports: imports
|
|
84 |
category: category
|
|
85 |
attributes: annotations
|
|
86 |
|
|
87 |
|sc|
|
|
88 |
|
|
89 |
sc := superclass value.
|
|
90 |
sc isNil ifTrue:[
|
|
91 |
self halt.
|
|
92 |
].
|
|
93 |
self halt.
|
|
94 |
|
|
95 |
!
|
|
96 |
|
|
97 |
defineNameSpace: name private: private imports: imports category: category attributes: annotations
|
|
98 |
"klduge for now"
|
|
99 |
|
|
100 |
pathString = 'Smalltalk' ifTrue:[
|
5366
|
101 |
NameSpace name:name asSymbol.
|
5311
|
102 |
] ifFalse:[
|
|
103 |
self halt.
|
|
104 |
].
|
|
105 |
|
|
106 |
! !
|
|
107 |
|
|
108 |
!QualifiedName methodsFor:'dummy for now'!
|
|
109 |
|
|
110 |
makeUnambiguous
|
|
111 |
^ self
|
|
112 |
|
|
113 |
|
|
114 |
! !
|
|
115 |
|
|
116 |
!QualifiedName class methodsFor:'documentation'!
|
|
117 |
|
|
118 |
version
|
17892
|
119 |
^ '$Header: /cvs/stx/stx/libbasic/QualifiedName.st,v 1.2 2000/04/12 21:38:35 cg Exp $'
|
17846
|
120 |
! !
|
17892
|
121 |
|
17910
|
122 |
|
17911
|
123 |
|