author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 01 Apr 2013 14:07:13 +0100 | |
branch | jv |
changeset 3208 | e8bdf898d7ac |
parent 3158 | f8c56a311307 |
parent 3163 | 16fdcb5a998b |
child 3219 | 92e64a42ab4e |
permissions | -rw-r--r-- |
3 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
85 | 3 |
All Rights Reserved |
3 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
957 | 12 |
"{ Package: 'stx:libbasic3' }" |
13 |
||
0 | 14 |
ClassChange subclass:#ClassDefinitionChange |
2316 | 15 |
instanceVariableNames:'objectType superClassName classType indexedType otherParameters |
16 |
instanceVariableNames classVariableNames |
|
1854 | 17 |
classInstanceVariableNames poolDictionaries category private |
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
18 |
definitionSelector owningClassName' |
235 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'System-Changes' |
|
0 | 22 |
! |
23 |
||
9 | 24 |
!ClassDefinitionChange class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
38 | 29 |
All Rights Reserved |
9 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
1162 | 42 |
instances represent class definition-changes. |
43 |
They are typically held in a ChangeSet. |
|
235 | 44 |
|
45 |
[author:] |
|
46 |
Claus Gittinger |
|
9 | 47 |
" |
100 | 48 |
! ! |
49 |
||
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
50 |
|
2876 | 51 |
!ClassDefinitionChange class methodsFor:'others'! |
52 |
||
53 |
version_CVS |
|
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
54 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.76 2013-03-30 01:54:34 cg Exp $' |
2876 | 55 |
! ! |
56 |
||
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
57 |
|
911 | 58 |
!ClassDefinitionChange methodsFor:'accessing'! |
59 |
||
1434 | 60 |
basicSuperClassName |
61 |
^ superClassName |
|
62 |
! |
|
63 |
||
1427 | 64 |
category |
1854 | 65 |
category isNil ifTrue:[ |
66 |
self setupFromSource. |
|
67 |
]. |
|
1427 | 68 |
^ category |
1854 | 69 |
|
70 |
"Modified: / 11-10-2006 / 14:12:01 / cg" |
|
1427 | 71 |
! |
72 |
||
1178 | 73 |
category:something |
74 |
category := something. |
|
75 |
! |
|
76 |
||
1427 | 77 |
classInstanceVariableNames |
78 |
^ classInstanceVariableNames |
|
79 |
! |
|
80 |
||
81 |
classInstanceVariableNames:something |
|
82 |
classInstanceVariableNames := something. |
|
83 |
! |
|
84 |
||
85 |
classVariableNames |
|
86 |
^ classVariableNames |
|
87 |
! |
|
88 |
||
89 |
classVariableNames:something |
|
90 |
classVariableNames := something. |
|
91 |
! |
|
92 |
||
2368 | 93 |
delta |
3139
c6eb068647cc
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3111
diff
changeset
|
94 |
| class | |
2368 | 95 |
|
96 |
class := self changeClass. |
|
97 |
class ifNil:[^#+]. |
|
3139
c6eb068647cc
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3111
diff
changeset
|
98 |
|
2504 | 99 |
^(self class isSource: self source sameSourceAs: class definitionWithoutPackage "definition") |
2368 | 100 |
ifTrue:[#=] |
101 |
ifFalse:[#~] |
|
2504 | 102 |
|
103 |
"Modified: / 31-08-2011 / 09:26:48 / cg" |
|
104 |
! |
|
105 |
||
106 |
deltaDetail |
|
107 |
"Returns a delta to the current state as a ChangeDelta object" |
|
108 |
||
2690 | 109 |
| class mySource imageSource myTree imageTree same | |
2504 | 110 |
|
111 |
class := self changeClass. |
|
112 |
class isNil ifTrue:[^ ChangeDeltaInformation added ]. |
|
2753 | 113 |
class isLoaded ifFalse:[^ ChangeDeltaInformation different ]. |
2504 | 114 |
mySource := self source. |
115 |
imageSource := class definitionWithoutPackage "definition". |
|
2690 | 116 |
same := (mySource = imageSource). |
117 |
same ifFalse:[ |
|
118 |
same := (self class isSource: mySource sameSourceAs: imageSource ). |
|
119 |
same ifFalse:[ |
|
120 |
"/ care for formatting (tabs, indentation etc.) |
|
121 |
myTree := RBParser parseExpression:mySource. |
|
122 |
imageTree := RBParser parseExpression:imageSource. |
|
123 |
same := (myTree = imageTree). |
|
124 |
same ifFalse:[ |
|
125 |
"/ some classDefinition strings contain sn |
|
126 |
"/ instVarName string like 'foo bar ' instead of 'foo bar' (i.e. added a space)... |
|
127 |
((myTree receiver = imageTree receiver) |
|
128 |
and:[ (myTree selector = imageTree selector) |
|
129 |
and:[ ('*ubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' match: myTree selector) |
|
130 |
and:[ (myTree arguments at:1) = (imageTree arguments at:1) |
|
131 |
||
132 |
and:[ (2 to:5) conform:[:i | |
|
133 |
((myTree arguments at:i) isLiteral |
|
134 |
and:[ (imageTree arguments at:i) isLiteral |
|
135 |
and:[ (myTree arguments at:i) value asString withoutSeparators |
|
136 |
= (imageTree arguments at:i) value asString withoutSeparators ]]) ] |
|
137 |
||
138 |
]]]]) |
|
139 |
ifTrue:[ |
|
140 |
same := true |
|
141 |
] |
|
142 |
]. |
|
143 |
] |
|
144 |
]. |
|
145 |
||
146 |
^ same |
|
2504 | 147 |
ifTrue:[ ChangeDeltaInformation identical ] |
148 |
ifFalse:[ ChangeDeltaInformation different ] |
|
149 |
||
150 |
"Created: / 31-08-2011 / 10:26:42 / cg" |
|
2753 | 151 |
"Modified: / 24-01-2012 / 22:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2368 | 152 |
! |
153 |
||
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
154 |
imageSource |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
155 |
"return the source for the in-image version of the method" |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
156 |
|
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
157 |
| cls | |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
158 |
|
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
159 |
cls := self changeClass. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
160 |
cls isNil ifTrue:[ ^ nil ]. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
161 |
^ cls definitionWithoutPackage |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
162 |
! |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
163 |
|
1427 | 164 |
instanceVariableNames |
165 |
^ instanceVariableNames |
|
166 |
! |
|
167 |
||
168 |
instanceVariableNames:something |
|
169 |
instanceVariableNames := something. |
|
170 |
! |
|
171 |
||
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
172 |
localClassName |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
173 |
"for private classes, this returns the name relative to its owner; |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
174 |
for non-private ones, this is the regular name. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
175 |
Notice that className always returns the full name (incl. any owner prefix)" |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
176 |
|
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
177 |
self isPrivateClassDefinitionChange ifFalse:[^ self className]. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
178 |
(className startsWith:(owningClassName,'::')) ifTrue:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
179 |
^ className copyFrom:(owningClassName size + 2 + 1). |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
180 |
] ifFalse:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
181 |
"/ should not happen |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
182 |
^ self className |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
183 |
] |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
184 |
! |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
185 |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
186 |
nameSpaceName |
1318 | 187 |
objectType == #variable ifTrue:[ |
188 |
^ nil |
|
189 |
]. |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
190 |
^ self cutNameSpaceOf:(self nameSpaceOverride ? super nameSpaceName) |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
191 |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
192 |
"Modified: / 07-09-2011 / 20:47:14 / cg" |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
193 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
194 |
|
1196 | 195 |
nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg |
1854 | 196 |
"this instance setup message is used when reading from a VW-xml change file. |
197 |
Support for this is not yet complete." |
|
198 |
||
199 |
|indexedType imports| |
|
1196 | 200 |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
201 |
nameSpaceOverride := aNameSpaceName. |
911 | 202 |
classType := aClassType. |
1196 | 203 |
otherParameters := Dictionary new addAll:otherParametersArg; yourself. |
204 |
||
205 |
superClassName := otherParameters at:#superclass: ifAbsent:nil. |
|
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
206 |
self assert:(superClassName notNil). |
1196 | 207 |
superClassName notNil ifTrue:[ |
208 |
superClassName := superClassName pathString. |
|
209 |
]. |
|
210 |
indexedType := otherParameters at:#indexedType: ifAbsent:nil. |
|
211 |
private := otherParameters at:#private: ifAbsent:nil. |
|
212 |
instanceVariableNames := otherParameters at:#instanceVariableNames: ifAbsent:nil. |
|
213 |
classInstanceVariableNames := otherParameters at:#classInstanceVariableNames: ifAbsent:nil. |
|
214 |
imports := otherParameters at:#imports: ifAbsent:nil. |
|
215 |
category := otherParameters at:#category: ifAbsent:nil. |
|
1854 | 216 |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
217 |
"Modified: / 15-06-2010 / 14:50:35 / cg" |
911 | 218 |
! |
219 |
||
220 |
objectType |
|
221 |
"return the value of the instance variable 'objectType' (automatically generated)" |
|
222 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
223 |
^ objectType |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
224 |
! |
911 | 225 |
|
226 |
objectType:something |
|
227 |
"set the value of the instance variable 'objectType' (automatically generated)" |
|
228 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
229 |
objectType := something. |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
230 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
231 |
|
1427 | 232 |
poolDictionaries |
2832 | 233 |
poolDictionaries isNil ifTrue:[ |
234 |
self setupFromSource. |
|
235 |
]. |
|
1427 | 236 |
^ poolDictionaries |
2832 | 237 |
|
238 |
"Modified: / 13-06-2012 / 12:23:41 / cg" |
|
1427 | 239 |
! |
240 |
||
241 |
poolDictionaries:something |
|
242 |
poolDictionaries := something. |
|
243 |
! |
|
244 |
||
2289 | 245 |
private:aBoolean |
246 |
private := aBoolean. |
|
247 |
||
248 |
"Created: / 30-08-2010 / 13:56:11 / cg" |
|
249 |
! |
|
250 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
251 |
source |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
252 |
"return the source of the change" |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
253 |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
254 |
|src ns| |
1196 | 255 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
256 |
(src := source) isNil ifTrue:[ |
1196 | 257 |
src := self definitionString |
258 |
]. |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
259 |
|
2900
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
260 |
"/ ouch - already done in definitionString !!!!!! |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
261 |
"/ (ns := self nameSpaceOverride) notNil ifTrue:[ |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
262 |
"/ (className startsWith:(ns,'::')) ifFalse:[ |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
263 |
"/ ^ '"{ NameSpace: ' , ns , ' }"' , |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
264 |
"/ Character cr, Character cr , |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
265 |
"/ src string |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
266 |
"/ ]. |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
267 |
"/ ]. |
1196 | 268 |
^ src |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
269 |
|
2900
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
270 |
"Modified: / 10-08-2012 / 11:53:54 / cg" |
1196 | 271 |
! |
272 |
||
273 |
superClassName |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
274 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
275 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
276 |
nm := superClassName. |
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
277 |
nm isNil ifTrue:[^ 'nil']. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
278 |
"/ convert VW namespace syntax |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
279 |
(nm includes:$.) ifTrue:[ |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
280 |
^ nm copyReplaceAll:$. withAll:'::'. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
281 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
282 |
^ nm |
1427 | 283 |
! |
284 |
||
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
285 |
superClassName:aString |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
286 |
superClassName := aString. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
287 |
self assert:(aString notNil). |
2207 | 288 |
self invalidateSource. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
289 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
290 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
291 |
superClassNameWithoutMyNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
292 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
293 |
|
1956 | 294 |
superClassName isNil ifTrue:[^ 'nil']. |
295 |
||
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
296 |
nm := self cutMyNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
297 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
298 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
299 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
300 |
^ nm |
1956 | 301 |
|
302 |
"Modified: / 03-03-2007 / 13:09:07 / cg" |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
303 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
304 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
305 |
superClassNameWithoutNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
306 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
307 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
308 |
nm := self cutNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
309 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
310 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
311 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
312 |
^ nm |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
313 |
! ! |
911 | 314 |
|
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
315 |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
316 |
!ClassDefinitionChange methodsFor:'applying'! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
317 |
|
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
318 |
apply |
3111 | 319 |
|changeClass| |
320 |
||
2425 | 321 |
superClassName isNil ifTrue:[ |
322 |
self setupFromSource |
|
3111 | 323 |
superClassName isNil ifTrue:[ |
324 |
self error:'Should not happen' |
|
325 |
]. |
|
2425 | 326 |
]. |
327 |
(Smalltalk classNamed:superClassName) isNil ifTrue:[ |
|
328 |
Class undeclared:superClassName |
|
329 |
]. |
|
3111 | 330 |
Parser evaluate:self source. |
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
331 |
package notNil ifTrue:[ |
3111 | 332 |
changeClass := self changeClass. |
333 |
changeClass notNil ifTrue:[ |
|
334 |
changeClass setPackage:package. |
|
335 |
]. |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
336 |
]. |
2368 | 337 |
|
338 |
" |
|
2425 | 339 |
(ClassDefinitionChange className: #TestB source: 'TestA subclass: #TestB |
340 |
instanceVariableNames:'''' |
|
341 |
classVariableNames:'''' |
|
342 |
poolDictionaries:'''' |
|
343 |
category:''* remove me *''') |
|
344 |
apply |
|
2368 | 345 |
" |
346 |
||
347 |
"Modified: / 08-11-2010 / 16:10:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2554 | 348 |
"Modified: / 06-10-2011 / 17:01:58 / cg" |
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
349 |
! ! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
350 |
|
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
351 |
|
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
352 |
!ClassDefinitionChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
353 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
354 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
355 |
"return true, if the given change represents a change for the same |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
356 |
thingy as the receiver (i.e. same method, same definition etc.)." |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
357 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
358 |
changeB isClassDefinitionChange ifFalse:[^ false]. |
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
359 |
^ className = changeB className |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
360 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
361 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
362 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
363 |
"return true, if the given change represents the same change as the receiver." |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
364 |
|
798 | 365 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
366 |
^ self sameSourceAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
367 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
368 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
369 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
370 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
371 |
|
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
372 |
|
2410 | 373 |
!ClassDefinitionChange methodsFor:'converting'! |
374 |
||
375 |
asAntiChange |
|
376 |
||
377 |
^ClassRemoveChange className: self className |
|
378 |
||
379 |
"Created: / 02-11-2009 / 11:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
380 |
! ! |
|
381 |
||
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
382 |
|
962 | 383 |
!ClassDefinitionChange methodsFor:'printing & storing'! |
787 | 384 |
|
1196 | 385 |
definitionString |
2834 | 386 |
|ns classNameUsed superClassNameUsed selPart| |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
387 |
|
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
388 |
ns := self nameSpaceOverride. |
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
389 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
390 |
objectType == #variable ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
391 |
^ String streamContents:[:stream | |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
392 |
ns notNil ifTrue:[ |
2834 | 393 |
stream nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
394 |
] ifFalse:[ |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
395 |
self halt:'can this happen ?'. |
2834 | 396 |
stream nextPutAll:'Smalltalk' |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
397 |
]. |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
398 |
|
1196 | 399 |
stream |
400 |
nextPutAll:' addClassVarName:'; |
|
1318 | 401 |
nextPutAll:className asString storeString |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
402 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
403 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
404 |
|
2554 | 405 |
superClassNameUsed := self superClassName. |
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
406 |
"/ careful with private classes: the definition MUST give the |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
407 |
"/ local name as argument, not the full name |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
408 |
classNameUsed := self localClassName. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
409 |
|
2834 | 410 |
selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:') |
411 |
keywords first. |
|
2554 | 412 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
413 |
^ String streamContents:[:stream | |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
414 |
stream |
2554 | 415 |
nextPutAll:superClassNameUsed; |
2834 | 416 |
nextPutAll:' ',selPart; |
417 |
nextPutAll: classNameUsed asSymbol storeString; |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
418 |
cr; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
419 |
spaces:4; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
420 |
nextPutAll:'instanceVariableNames: '; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
421 |
nextPutAll:(instanceVariableNames ? '') storeString; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
422 |
cr; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
423 |
spaces:4; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
424 |
nextPutAll:'classVariableNames: '; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
425 |
nextPutAll:(classVariableNames ? '') storeString; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
426 |
cr; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
427 |
spaces:4; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
428 |
nextPutAll:'poolDictionaries: '; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
429 |
nextPutAll:(poolDictionaries ? '') storeString; |
2831 | 430 |
cr. |
431 |
private == true ifTrue:[ |
|
432 |
stream |
|
433 |
spaces:4; |
|
434 |
nextPutAll:'privateIn: '; |
|
435 |
nextPutAll:(self owningClassName) |
|
436 |
] ifFalse:[ |
|
437 |
stream |
|
438 |
spaces:4; |
|
439 |
nextPutAll:'category: '; |
|
440 |
nextPutAll:(category ? '') storeString |
|
441 |
]. |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
442 |
] |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
443 |
|
2834 | 444 |
"Modified: / 13-06-2012 / 13:01:58 / cg" |
1196 | 445 |
! |
446 |
||
2876 | 447 |
definitionStringInNamespace: ns |
448 |
| classNameUsed superClassNameUsed | |
|
449 |
||
450 |
objectType == #variable ifTrue:[ |
|
451 |
^ String streamContents:[:stream | |
|
452 |
ns notNil ifTrue:[ |
|
453 |
stream |
|
454 |
nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
455 |
] ifFalse:[ |
|
456 |
self halt:'can this happen ?'. |
|
457 |
stream |
|
458 |
nextPutAll:'Smalltalk' |
|
459 |
]. |
|
460 |
||
461 |
stream |
|
462 |
nextPutAll:' addClassVarName:'; |
|
463 |
nextPutAll:className asString storeString |
|
464 |
]. |
|
465 |
]. |
|
466 |
||
467 |
superClassNameUsed := self superClassName. |
|
468 |
classNameUsed := self classNameWithoutNamespace. |
|
469 |
||
470 |
^ String streamContents:[:stream | |
|
471 |
self isPrivateClassDefinitionChange ifFalse:[ |
|
472 |
stream |
|
3082 | 473 |
nextPutAll:(superClassNameUsed ? 'nil'); |
2876 | 474 |
nextPutAll:' subclass:'; |
475 |
nextPutAll: classNameUsed asSymbol storeString |
|
476 |
; |
|
477 |
cr; |
|
478 |
tab; |
|
479 |
nextPutAll:'instanceVariableNames:'; |
|
480 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
481 |
cr; |
|
482 |
tab; |
|
483 |
nextPutAll:'classVariableNames:'; |
|
484 |
nextPutAll:(classVariableNames ? '') storeString; |
|
485 |
cr; |
|
486 |
tab; |
|
487 |
nextPutAll:'poolDictionaries:'; |
|
488 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
489 |
cr; |
|
490 |
tab; |
|
491 |
nextPutAll:'category:'; |
|
492 |
nextPutAll:(category ? '') storeString; |
|
493 |
cr |
|
494 |
] ifTrue:[ |
|
495 |
stream |
|
496 |
nextPutAll:superClassNameUsed; |
|
497 |
nextPutAll:' subclass:'; |
|
498 |
nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString |
|
499 |
; |
|
500 |
cr; |
|
501 |
tab; |
|
502 |
nextPutAll:'instanceVariableNames:'; |
|
503 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
504 |
cr; |
|
505 |
tab; |
|
506 |
nextPutAll:'classVariableNames:'; |
|
507 |
nextPutAll:(classVariableNames ? '') storeString; |
|
508 |
cr; |
|
509 |
tab; |
|
510 |
nextPutAll:'poolDictionaries:'; |
|
511 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
512 |
cr; |
|
513 |
tab; |
|
514 |
nextPutAll:'privateIn:'; |
|
515 |
nextPutAll: |
|
516 |
(ns isNil |
|
517 |
ifTrue:[owningClassName] |
|
518 |
ifFalse:[owningClassName copyFrom: ns size + 3]); |
|
519 |
cr |
|
520 |
] |
|
521 |
] |
|
522 |
||
523 |
"Modified: / 06-10-2011 / 17:02:05 / cg" |
|
524 |
"Created: / 20-03-2012 / 19:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
525 |
! |
|
526 |
||
527 |
definitionStringWithoutNamespace |
|
528 |
|ns classNameUsed superClassNameUsed| |
|
529 |
||
530 |
ns := self nameSpaceOverride. |
|
531 |
||
532 |
objectType == #variable ifTrue:[ |
|
533 |
^ String streamContents:[:stream | |
|
534 |
ns notNil ifTrue:[ |
|
535 |
stream |
|
536 |
nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
537 |
] ifFalse:[ |
|
538 |
self halt:'can this happen ?'. |
|
539 |
stream |
|
540 |
nextPutAll:'Smalltalk' |
|
541 |
]. |
|
542 |
||
543 |
stream |
|
544 |
nextPutAll:' addClassVarName:'; |
|
545 |
nextPutAll:className asString storeString |
|
546 |
]. |
|
547 |
]. |
|
548 |
||
549 |
superClassNameUsed := self superClassName. |
|
550 |
classNameUsed := self classNameWithoutNamespace. |
|
551 |
||
552 |
^ String streamContents:[:stream | |
|
553 |
self isPrivateClassDefinitionChange ifFalse:[ |
|
554 |
stream |
|
555 |
nextPutAll:superClassNameUsed; |
|
556 |
nextPutAll:' subclass:'; |
|
557 |
nextPutAll: classNameUsed asSymbol storeString |
|
558 |
; |
|
559 |
cr; |
|
560 |
tab; |
|
561 |
nextPutAll:'instanceVariableNames:'; |
|
562 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
563 |
cr; |
|
564 |
tab; |
|
565 |
nextPutAll:'classVariableNames:'; |
|
566 |
nextPutAll:(classVariableNames ? '') storeString; |
|
567 |
cr; |
|
568 |
tab; |
|
569 |
nextPutAll:'poolDictionaries:'; |
|
570 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
571 |
cr; |
|
572 |
tab; |
|
573 |
nextPutAll:'category:'; |
|
574 |
nextPutAll:(category ? '') storeString; |
|
575 |
cr |
|
576 |
] ifTrue:[ |
|
577 |
stream |
|
578 |
nextPutAll:superClassNameUsed; |
|
579 |
nextPutAll:' subclass:'; |
|
580 |
nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString |
|
581 |
; |
|
582 |
cr; |
|
583 |
tab; |
|
584 |
nextPutAll:'instanceVariableNames:'; |
|
585 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
586 |
cr; |
|
587 |
tab; |
|
588 |
nextPutAll:'classVariableNames:'; |
|
589 |
nextPutAll:(classVariableNames ? '') storeString; |
|
590 |
cr; |
|
591 |
tab; |
|
592 |
nextPutAll:'poolDictionaries:'; |
|
593 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
594 |
cr; |
|
595 |
tab; |
|
596 |
nextPutAll:'privateIn:'; |
|
597 |
nextPutAll: |
|
598 |
((ns := self nameSpaceName) isNil |
|
599 |
ifTrue:[owningClassName] |
|
600 |
ifFalse:[owningClassName copyFrom: ns size + 3]); |
|
601 |
cr |
|
602 |
] |
|
603 |
] |
|
604 |
||
605 |
"Modified: / 06-10-2011 / 17:02:05 / cg" |
|
606 |
"Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
607 |
! |
|
608 |
||
1101 | 609 |
printOn:aStream |
1866 | 610 |
aStream |
611 |
nextPutAll:className; nextPutAll:' {definition}' |
|
612 |
||
613 |
"Modified: / 12-10-2006 / 17:48:28 / cg" |
|
1101 | 614 |
! |
615 |
||
896 | 616 |
printWithoutClassNameOn:aStream |
787 | 617 |
aStream nextPutAll:('definition of ' , className) |
618 |
||
619 |
||
620 |
! ! |
|
621 |
||
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
622 |
|
772 | 623 |
!ClassDefinitionChange methodsFor:'queries'! |
624 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
625 |
definitionSelector |
1854 | 626 |
definitionSelector isNil ifTrue:[ |
627 |
self setupFromSource. |
|
628 |
]. |
|
629 |
^ definitionSelector |
|
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
630 |
|
1854 | 631 |
"Modified: / 11-10-2006 / 14:11:44 / cg" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
632 |
! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
633 |
|
2833 | 634 |
definitionSelector:aSelector |
635 |
definitionSelector := aSelector |
|
636 |
||
637 |
"Created: / 13-06-2012 / 12:45:02 / cg" |
|
638 |
! |
|
639 |
||
772 | 640 |
isClassDefinitionChange |
641 |
^ true |
|
1854 | 642 |
! |
643 |
||
644 |
isPrivateClassDefinitionChange |
|
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
645 |
"compute lazily; remember in private" |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
646 |
|
1854 | 647 |
private isNil ifTrue:[ |
1904 | 648 |
(className includes:$:) ifFalse:[ |
649 |
"/ cannot be private |
|
650 |
private := false |
|
651 |
] ifTrue:[ |
|
1909
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
652 |
source isNil ifTrue:[^ false ]. |
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
653 |
(source includesString:'private') ifFalse:[ |
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
654 |
private := false. |
1904 | 655 |
] ifTrue:[ |
1916 | 656 |
"/ (self changeClass notNil |
657 |
"/ and:[self changeClass isLoaded not]) ifTrue:[ |
|
658 |
"/ "/ cannot be private |
|
659 |
"/ private := false |
|
660 |
"/ ] ifTrue:[ |
|
1909
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
661 |
self setupFromSource. |
1916 | 662 |
"/ ]. |
1904 | 663 |
]. |
664 |
]. |
|
1854 | 665 |
]. |
666 |
^ private |
|
667 |
||
668 |
"Created: / 11-10-2006 / 14:19:03 / cg" |
|
1909
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
669 |
"Modified: / 16-11-2006 / 16:34:19 / cg" |
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
670 |
! |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
671 |
|
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
672 |
owningClassName |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
673 |
self isPrivateClassDefinitionChange ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
674 |
owningClassName isNil ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
675 |
self setupFromSource. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
676 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
677 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
678 |
^ owningClassName |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
679 |
|
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
680 |
"Created: / 12-10-2006 / 23:07:25 / cg" |
2289 | 681 |
! |
682 |
||
683 |
owningClassName:aStringOrSymbol |
|
684 |
owningClassName := aStringOrSymbol |
|
685 |
||
686 |
"Created: / 30-08-2010 / 13:55:37 / cg" |
|
772 | 687 |
! ! |
688 |
||
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
689 |
|
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
690 |
!ClassDefinitionChange methodsFor:'special'! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
691 |
|
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
692 |
installAsAutoloadedClassIfPublicWithFilename:aFilenameString |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
693 |
"install the class defined by this change as autoloaded. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
694 |
Skip private classes. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
695 |
Enter class file name as abbreviation" |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
696 |
|
1904 | 697 |
|parseTree sel cat clsName cls catIdx pkg| |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
698 |
|
2289 | 699 |
private == true ifTrue:[^ self]. |
700 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
701 |
parseTree := Parser parseExpression:self source. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
702 |
parseTree isMessage ifFalse:[ |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
703 |
self error:'bad change source'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
704 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
705 |
|
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
706 |
sel := parseTree selector. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
707 |
(sel endsWith:':privateIn:') ifTrue:[^ self]. |
1418 | 708 |
|
2402
f6799fe6acc4
changed: #installAsAutoloadedClassIfPublicWithFilename:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
709 |
catIdx := sel asSymbol keywords indexOf:'category:'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
710 |
catIdx ~~ 0 ifTrue:[ |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
711 |
cat := (parseTree args at:catIdx) evaluate. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
712 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
713 |
|
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
714 |
clsName := self className asSymbol. |
1802 | 715 |
cls := Smalltalk at:clsName. |
1904 | 716 |
|
717 |
pkg := package ? Project current package. |
|
718 |
||
1802 | 719 |
(cls isNil |
720 |
or:[cls isBehavior not |
|
721 |
or:[cls isLoaded not]]) ifTrue:[ |
|
1904 | 722 |
|autoloadedClass| |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
723 |
|
1836 | 724 |
autoloadedClass := Smalltalk |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
725 |
installAutoloadedClassNamed:clsName |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
726 |
category:cat |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
727 |
package:pkg |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
728 |
revision:nil. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
729 |
aFilenameString notNil ifTrue:[ |
1836 | 730 |
autoloadedClass setClassFilename:aFilenameString. |
731 |
"/ Smalltalk setFilename:aFilenameString forClass:clsName package:pkg. |
|
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
732 |
] |
1904 | 733 |
] ifFalse:[ |
734 |
cls notNil ifTrue:[ |
|
735 |
cls isBehavior ifTrue:[ |
|
736 |
cls package ~= pkg ifTrue:[ |
|
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
737 |
Transcript showCR:('Autoloaded class: %1 not installed (package would change from %2 to %3)' |
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
738 |
bindWith:clsName with:cls package with:pkg). |
1904 | 739 |
] |
740 |
]. |
|
741 |
]. |
|
742 |
]. |
|
1836 | 743 |
|
2402
f6799fe6acc4
changed: #installAsAutoloadedClassIfPublicWithFilename:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
744 |
"Modified: / 03-07-2011 / 18:34:05 / cg" |
1854 | 745 |
! |
746 |
||
2207 | 747 |
invalidateSource |
748 |
"internal - flush the sourceString if it got invalidated due to a |
|
749 |
className, superclassName, etc... change" |
|
750 |
||
751 |
source := nil. |
|
752 |
! |
|
753 |
||
1854 | 754 |
setupFromSource |
3124
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
755 |
"Extract data from class definition string in source. |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
756 |
WARNING: This overwrites values in instvars!!" |
1854 | 757 |
|
3124
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
758 |
|parseTree catIdx poolIdx instVarIdx classVarIdx | |
1854 | 759 |
|
760 |
source notNil ifTrue:[ |
|
761 |
parseTree := Parser parseExpression:source. |
|
1878 | 762 |
(parseTree notNil and:[parseTree isMessage]) ifFalse:[ |
1887 | 763 |
self error:'bad change source' mayProceed:true. |
764 |
^ self |
|
1854 | 765 |
]. |
766 |
||
767 |
definitionSelector := parseTree selector. |
|
768 |
||
769 |
private := (definitionSelector endsWith:':privateIn:'). |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
770 |
private ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
771 |
owningClassName := parseTree args last name. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
772 |
]. |
1854 | 773 |
|
774 |
catIdx := definitionSelector keywords indexOf:'category:'. |
|
775 |
catIdx ~~ 0 ifTrue:[ |
|
776 |
category := (parseTree args at:catIdx) evaluate. |
|
777 |
]. |
|
2368 | 778 |
|
2832 | 779 |
poolIdx := definitionSelector keywords indexOf:'poolDictionaries:'. |
780 |
poolIdx ~~ 0 ifTrue:[ |
|
781 |
poolDictionaries := (parseTree args at:poolIdx) evaluate. |
|
782 |
]. |
|
783 |
||
3124
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
784 |
instVarIdx := definitionSelector keywords indexOf:'instanceVariableNames:'. |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
785 |
instVarIdx ~~ 0 ifTrue:[ |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
786 |
instanceVariableNames := (parseTree args at:instVarIdx) value. |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
787 |
]. |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
788 |
|
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
789 |
classVarIdx := definitionSelector keywords indexOf:'classVariableNames:'. |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
790 |
classVarIdx ~~ 0 ifTrue:[ |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
791 |
classVariableNames := (parseTree args at:classVarIdx) value. |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
792 |
]. |
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
793 |
|
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
794 |
|
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
795 |
|
2368 | 796 |
superClassName := parseTree receiver name. |
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
797 |
self assert:(superClassName notNil). |
1854 | 798 |
]. |
799 |
||
800 |
"Created: / 11-10-2006 / 14:10:02 / cg" |
|
2832 | 801 |
"Modified: / 13-06-2012 / 12:25:10 / cg" |
3124
feeb4a1df52b
Bugfix in ClassDefinitionChange>>setupFromSource: - extract inst and class vars as well.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3121
diff
changeset
|
802 |
"Modified: / 30-01-2013 / 12:01:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
803 |
! ! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
804 |
|
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
805 |
|
2614
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
806 |
!ClassDefinitionChange methodsFor:'visiting'! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
807 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
808 |
acceptChangeVisitor:aVisitor |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
809 |
^ aVisitor visitClassDefinitionChange:self. |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
810 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
811 |
"Created: / 25-11-2011 / 17:13:13 / cg" |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
812 |
! ! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
813 |
|
3158
f8c56a311307
Merged 87750af738dc and 72ca7e81fbbf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
814 |
|
100 | 815 |
!ClassDefinitionChange class methodsFor:'documentation'! |
816 |
||
2518 | 817 |
version |
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
818 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.76 2013-03-30 01:54:34 cg Exp $' |
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
819 |
! |
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
820 |
|
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3082
diff
changeset
|
821 |
version_HG |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3082
diff
changeset
|
822 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3082
diff
changeset
|
823 |
^ '$Changeset: <not expanded> $' |
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
824 |
! |
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
825 |
|
2368 | 826 |
version_SVN |
2876 | 827 |
^ '§Id:: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1 §' |
100 | 828 |
! ! |
3111 | 829 |