author | Claus Gittinger <cg@exept.de> |
Tue, 23 Dec 2014 23:51:35 +0100 | |
changeset 3689 | 4d94248f61ed |
parent 3543 | ed4000ee3e21 |
child 3694 | 401ad8b2ca8b |
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 |
3446 | 18 |
definitionSelector' |
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 |
||
911 | 50 |
!ClassDefinitionChange methodsFor:'accessing'! |
51 |
||
1434 | 52 |
basicSuperClassName |
53 |
^ superClassName |
|
54 |
! |
|
55 |
||
1427 | 56 |
category |
1854 | 57 |
category isNil ifTrue:[ |
58 |
self setupFromSource. |
|
59 |
]. |
|
1427 | 60 |
^ category |
1854 | 61 |
|
62 |
"Modified: / 11-10-2006 / 14:12:01 / cg" |
|
1427 | 63 |
! |
64 |
||
1178 | 65 |
category:something |
66 |
category := something. |
|
67 |
! |
|
68 |
||
1427 | 69 |
classInstanceVariableNames |
70 |
^ classInstanceVariableNames |
|
71 |
! |
|
72 |
||
73 |
classInstanceVariableNames:something |
|
74 |
classInstanceVariableNames := something. |
|
75 |
! |
|
76 |
||
77 |
classVariableNames |
|
78 |
^ classVariableNames |
|
79 |
! |
|
80 |
||
81 |
classVariableNames:something |
|
82 |
classVariableNames := something. |
|
83 |
! |
|
84 |
||
2368 | 85 |
delta |
3446 | 86 |
| changeClass changeSource imageSource | |
87 |
||
2368 | 88 |
|
3446 | 89 |
changeClass := self changeClass. |
90 |
changeClass isNil ifTrue:[^#+]. |
|
91 |
changeSource := self definitionString. |
|
92 |
imageSource := self isPrivateClassDefinitionChange |
|
93 |
ifTrue:[changeClass definition] |
|
94 |
ifFalse:[changeClass definitionWithoutPackage]. |
|
3139
c6eb068647cc
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3111
diff
changeset
|
95 |
|
3446 | 96 |
^ (self class isSource: changeSource |
97 |
sameSourceAs: imageSource) ifTrue:[ #= ] ifFalse:[ #~ ]. |
|
98 |
||
99 |
" |
|
100 |
Tools::TextDiff2Tool openOn: changeSource label: 'Change' and: imageSource label: 'Image' |
|
101 |
" |
|
2504 | 102 |
|
103 |
"Modified: / 31-08-2011 / 09:26:48 / cg" |
|
3446 | 104 |
"Modified: / 04-02-2014 / 20:30:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2504 | 105 |
! |
106 |
||
107 |
deltaDetail |
|
108 |
"Returns a delta to the current state as a ChangeDelta object" |
|
109 |
||
2690 | 110 |
| class mySource imageSource myTree imageTree same | |
2504 | 111 |
|
112 |
class := self changeClass. |
|
113 |
class isNil ifTrue:[^ ChangeDeltaInformation added ]. |
|
2753 | 114 |
class isLoaded ifFalse:[^ ChangeDeltaInformation different ]. |
2504 | 115 |
mySource := self source. |
116 |
imageSource := class definitionWithoutPackage "definition". |
|
2690 | 117 |
same := (mySource = imageSource). |
118 |
same ifFalse:[ |
|
119 |
same := (self class isSource: mySource sameSourceAs: imageSource ). |
|
120 |
same ifFalse:[ |
|
121 |
"/ care for formatting (tabs, indentation etc.) |
|
122 |
myTree := RBParser parseExpression:mySource. |
|
123 |
imageTree := RBParser parseExpression:imageSource. |
|
124 |
same := (myTree = imageTree). |
|
125 |
same ifFalse:[ |
|
3275
e525d31c2a9b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3270
diff
changeset
|
126 |
"/ some classDefinition strings may contain whitespace |
2690 | 127 |
"/ instVarName string like 'foo bar ' instead of 'foo bar' (i.e. added a space)... |
128 |
((myTree receiver = imageTree receiver) |
|
129 |
and:[ (myTree selector = imageTree selector) |
|
130 |
and:[ ('*ubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' match: myTree selector) |
|
131 |
and:[ (myTree arguments at:1) = (imageTree arguments at:1) |
|
132 |
||
133 |
and:[ (2 to:5) conform:[:i | |
|
134 |
((myTree arguments at:i) isLiteral |
|
135 |
and:[ (imageTree arguments at:i) isLiteral |
|
3275
e525d31c2a9b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3270
diff
changeset
|
136 |
and:[ (myTree arguments at:i) value asString asCollectionOfWords |
e525d31c2a9b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3270
diff
changeset
|
137 |
= (imageTree arguments at:i) value asString asCollectionOfWords ]]) ] |
2690 | 138 |
|
139 |
]]]]) |
|
140 |
ifTrue:[ |
|
141 |
same := true |
|
142 |
] |
|
143 |
]. |
|
144 |
] |
|
145 |
]. |
|
146 |
||
147 |
^ same |
|
2504 | 148 |
ifTrue:[ ChangeDeltaInformation identical ] |
149 |
ifFalse:[ ChangeDeltaInformation different ] |
|
150 |
||
151 |
"Created: / 31-08-2011 / 10:26:42 / cg" |
|
2753 | 152 |
"Modified: / 24-01-2012 / 22:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2368 | 153 |
! |
154 |
||
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
155 |
imageSource |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
156 |
"return the source for the in-image version of the method" |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
157 |
|
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
158 |
| cls | |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
159 |
|
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
160 |
cls := self changeClass. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
161 |
cls isNil ifTrue:[ ^ nil ]. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
162 |
^ cls definitionWithoutPackage |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
163 |
! |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
164 |
|
3689
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
165 |
indexedType |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
166 |
^ indexedType |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
167 |
! |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
168 |
|
1427 | 169 |
instanceVariableNames |
170 |
^ instanceVariableNames |
|
171 |
! |
|
172 |
||
173 |
instanceVariableNames:something |
|
174 |
instanceVariableNames := something. |
|
175 |
! |
|
176 |
||
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
177 |
localClassName |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
178 |
"for private classes, this returns the name relative to its owner; |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
179 |
for non-private ones, this is the regular name. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
180 |
Notice that className always returns the full name (incl. any owner prefix)" |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
181 |
|
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
182 |
self isPrivateClassDefinitionChange ifFalse:[^ self className]. |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
183 |
|
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
184 |
(className startsWith:(owningClassName,'::')) ifTrue:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
185 |
^ className copyFrom:(owningClassName size + 2 + 1). |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
186 |
] ifFalse:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
187 |
"/ should not happen |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
188 |
^ self className |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
189 |
] |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
190 |
! |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
191 |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
192 |
nameSpaceName |
3446 | 193 |
| nm | |
3270
b986056e7fe8
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3245
diff
changeset
|
194 |
|
3446 | 195 |
nm := super nameSpaceName. |
196 |
^nm. |
|
197 |
||
198 |
"/ "/ JV: What is the following good for? Please explain..." |
|
199 |
"/ objectType == #variable ifTrue:[ |
|
200 |
"/ ^ nil |
|
201 |
"/ ]. |
|
202 |
"/ ^ 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
|
203 |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
204 |
"Modified: / 07-09-2011 / 20:47:14 / cg" |
3446 | 205 |
"Modified: / 11-06-2013 / 17:18:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
206 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
207 |
|
1196 | 208 |
nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg |
1854 | 209 |
"this instance setup message is used when reading from a VW-xml change file. |
210 |
Support for this is not yet complete." |
|
211 |
||
3446 | 212 |
| imports | |
1196 | 213 |
|
3446 | 214 |
nameSpaceName := aNameSpaceName. |
911 | 215 |
classType := aClassType. |
1196 | 216 |
otherParameters := Dictionary new addAll:otherParametersArg; yourself. |
3543
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
217 |
private := otherParameters at:#private: ifAbsent:nil. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
218 |
category := otherParameters at:#category: ifAbsent:nil. |
1196 | 219 |
|
3543
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
220 |
aClassType == #defineSharedVariable: ifTrue:[ |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
221 |
] ifFalse:[ |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
222 |
superClassName := otherParameters at:#superclass: ifAbsent:nil. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
223 |
self assert:(superClassName notNil). |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
224 |
superClassName notNil ifTrue:[ |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
225 |
superClassName := superClassName pathString. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
226 |
]. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
227 |
indexedType := otherParameters at:#indexedType: ifAbsent:nil. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
228 |
instanceVariableNames := otherParameters at:#instanceVariableNames: ifAbsent:nil. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
229 |
classInstanceVariableNames := otherParameters at:#classInstanceVariableNames: ifAbsent:nil. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
230 |
imports := otherParameters at:#imports: ifAbsent:nil. |
1196 | 231 |
]. |
1854 | 232 |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
233 |
"Modified: / 15-06-2010 / 14:50:35 / cg" |
3446 | 234 |
"Modified: / 12-12-2013 / 12:59:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
911 | 235 |
! |
236 |
||
237 |
objectType |
|
238 |
"return the value of the instance variable 'objectType' (automatically generated)" |
|
239 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
240 |
^ objectType |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
241 |
! |
911 | 242 |
|
243 |
objectType:something |
|
244 |
"set the value of the instance variable 'objectType' (automatically generated)" |
|
245 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
246 |
objectType := something. |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
247 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
248 |
|
1427 | 249 |
poolDictionaries |
2832 | 250 |
poolDictionaries isNil ifTrue:[ |
251 |
self setupFromSource. |
|
252 |
]. |
|
1427 | 253 |
^ poolDictionaries |
2832 | 254 |
|
255 |
"Modified: / 13-06-2012 / 12:23:41 / cg" |
|
1427 | 256 |
! |
257 |
||
258 |
poolDictionaries:something |
|
259 |
poolDictionaries := something. |
|
260 |
! |
|
261 |
||
2289 | 262 |
private:aBoolean |
263 |
private := aBoolean. |
|
264 |
||
265 |
"Created: / 30-08-2010 / 13:56:11 / cg" |
|
266 |
! |
|
267 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
268 |
source |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
269 |
"return the source of the change; |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
270 |
either the original source or a synthesized" |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
271 |
|
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
272 |
|src| |
1196 | 273 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
274 |
(src := source) isNil ifTrue:[ |
1196 | 275 |
src := self definitionString |
276 |
]. |
|
277 |
^ src |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
278 |
|
2900
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
279 |
"Modified: / 10-08-2012 / 11:53:54 / cg" |
1196 | 280 |
! |
281 |
||
282 |
superClassName |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
283 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
284 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
285 |
nm := superClassName. |
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
286 |
nm isNil ifTrue:[^ 'nil']. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
287 |
"/ convert VW namespace syntax |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
288 |
(nm includes:$.) ifTrue:[ |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
289 |
^ nm copyReplaceAll:$. withAll:'::'. |
1473
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 |
^ nm |
1427 | 292 |
! |
293 |
||
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
294 |
superClassName:aString |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
295 |
superClassName := aString. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
296 |
self assert:(aString notNil). |
2207 | 297 |
self invalidateSource. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
298 |
! |
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 |
superClassNameWithoutMyNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
301 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
302 |
|
1956 | 303 |
superClassName isNil ifTrue:[^ 'nil']. |
304 |
||
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
305 |
nm := self cutMyNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
306 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
307 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
308 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
309 |
^ nm |
1956 | 310 |
|
311 |
"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
|
312 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
313 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
314 |
superClassNameWithoutNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
315 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
316 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
317 |
nm := self cutNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
318 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
319 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
320 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
321 |
^ nm |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
322 |
! ! |
911 | 323 |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
324 |
!ClassDefinitionChange methodsFor:'applying'! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
325 |
|
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
326 |
apply |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
327 |
|changeClass sourceWithNamespace| |
3111 | 328 |
|
2425 | 329 |
superClassName isNil ifTrue:[ |
3446 | 330 |
self setupFromSource. |
331 |
]. |
|
332 |
"Some classes have nil superclass (such as Object)..." |
|
333 |
superClassName notNil ifTrue:[ |
|
334 |
(Smalltalk classNamed:superClassName) isNil ifTrue:[ |
|
335 |
Class undeclared:superClassName |
|
3111 | 336 |
]. |
2425 | 337 |
]. |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
338 |
|
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
339 |
"/ here, using the current namespace as provided by the query or the override, |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
340 |
"/ generate a class definition with full names (i.e. incl. ns prefix). |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
341 |
sourceWithNamespace := self source. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
342 |
"/ as the namespace is already in the definition string, make sure that the namespace is not |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
343 |
"/ added twice, by anwering Smalltalk now!! |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
344 |
Class nameSpaceQuerySignal |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
345 |
answer:Smalltalk |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
346 |
do:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
347 |
Parser evaluate:sourceWithNamespace. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
348 |
]. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
349 |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
350 |
package notNil ifTrue:[ |
3111 | 351 |
changeClass := self changeClass. |
352 |
changeClass notNil ifTrue:[ |
|
353 |
changeClass setPackage:package. |
|
354 |
]. |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
355 |
]. |
2368 | 356 |
|
357 |
" |
|
2425 | 358 |
(ClassDefinitionChange className: #TestB source: 'TestA subclass: #TestB |
359 |
instanceVariableNames:'''' |
|
360 |
classVariableNames:'''' |
|
361 |
poolDictionaries:'''' |
|
362 |
category:''* remove me *''') |
|
363 |
apply |
|
2368 | 364 |
" |
365 |
||
2554 | 366 |
"Modified: / 06-10-2011 / 17:01:58 / cg" |
3446 | 367 |
"Modified: / 10-06-2013 / 17:12:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
368 |
! ! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
369 |
|
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
370 |
!ClassDefinitionChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
371 |
|
3210
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
372 |
isConflict |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
373 |
"true if this change is different than what is already in the image |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
374 |
(i.e. it overwrites some existing code)" |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
375 |
|
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
376 |
|cls| |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
377 |
|
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
378 |
(cls := self changeClass) isNil ifTrue:[^ false]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
379 |
cls superclass name ~= superClassName ifTrue:[ ^ true ]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
380 |
cls instanceVariableString ~= instanceVariableNames ifTrue:[ ^ true ]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
381 |
cls classVariableString ~= classVariableNames ifTrue:[ ^ true ]. |
3485
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
382 |
cls class instanceVariableString ~= (classInstanceVariableNames ? '') ifTrue:[ ^ true ]. |
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
383 |
cls poolDictionaries ~= poolDictionaries ifTrue:[ ^ true ]. |
3210
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
384 |
cls category ~= category ifTrue:[ ^ true ]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
385 |
cls isPrivate ifTrue:[ |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
386 |
cls owningClass name ~= owningClassName ifTrue:[ ^ true ]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
387 |
]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
388 |
cls definitionSelector ~= self definitionSelector ifTrue:[ ^ true ]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
389 |
^ false |
3485
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
390 |
|
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
391 |
"Modified: / 12-02-2014 / 20:25:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3210
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
392 |
! |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
393 |
|
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
394 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
395 |
"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
|
396 |
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
|
397 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
398 |
changeB isClassDefinitionChange ifFalse:[^ false]. |
3205 | 399 |
^ self className = changeB className. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
400 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
401 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
402 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
403 |
"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
|
404 |
|
798 | 405 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
406 |
^ self sameSourceAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
407 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
408 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
409 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
410 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
411 |
|
2410 | 412 |
!ClassDefinitionChange methodsFor:'converting'! |
413 |
||
414 |
asAntiChange |
|
415 |
||
416 |
^ClassRemoveChange className: self className |
|
417 |
||
418 |
"Created: / 02-11-2009 / 11:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
419 |
! ! |
|
420 |
||
962 | 421 |
!ClassDefinitionChange methodsFor:'printing & storing'! |
787 | 422 |
|
1196 | 423 |
definitionString |
3446 | 424 |
| ns | |
425 |
||
426 |
||
427 |
ns := self nameSpaceName. |
|
428 |
ns isEmptyOrNil ifTrue:[ |
|
429 |
^ self definitionStringInNamespace: ns. |
|
430 |
]. |
|
431 |
^String streamContents:[:s| |
|
432 |
"/ owningClassName isNil ifTrue:[ |
|
433 |
s nextPutAll: '"{ NameSpace: '; nextPutAll: ns; nextPutAll: ' }"'. |
|
434 |
s cr; cr. |
|
435 |
"/ ]. |
|
436 |
s nextPutAll: (self definitionStringInNamespace: ns). |
|
437 |
] |
|
438 |
||
439 |
"Modified: / 13-11-2013 / 17:40:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
440 |
! |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
441 |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
442 |
definitionStringInNamespace: nsOrNil |
3446 | 443 |
| classNameUsed superClassNameUsed selPart ownerNameUsed classNameSymbolString | |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
444 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
445 |
objectType == #variable ifTrue:[ |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
446 |
"/ a visualWorks static variable definition change. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
447 |
"/ kludge to be here - should be a separate StaticVariableDefinitionChange |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
448 |
^ String streamContents:[:stream | |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
449 |
nsOrNil notNil ifTrue:[ |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
450 |
stream nextPutAll:((nsOrNil asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
451 |
] ifFalse:[ |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
452 |
self halt:'can this happen ?'. |
2834 | 453 |
stream nextPutAll:'Smalltalk' |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
454 |
]. |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
455 |
|
1196 | 456 |
stream |
457 |
nextPutAll:' addClassVarName:'; |
|
1318 | 458 |
nextPutAll:className asString storeString |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
459 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
460 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
461 |
|
2554 | 462 |
superClassNameUsed := self superClassName. |
3446 | 463 |
"Strip of namespace" |
464 |
nsOrNil notNil ifTrue:[ |
|
465 |
(superClassNameUsed startsWith: nsOrNil) ifTrue:[ |
|
466 |
superClassNameUsed := superClassNameUsed copyFrom: nsOrNil size + 3 |
|
467 |
]. |
|
468 |
]. |
|
469 |
||
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
470 |
"/ careful with private classes: the definition MUST give the |
3446 | 471 |
"/ local name as argument, not the full name |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
472 |
self isPrivateClassDefinitionChange ifTrue:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
473 |
classNameUsed := self localClassName. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
474 |
] ifFalse:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
475 |
classNameUsed := className. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
476 |
]. |
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
477 |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
478 |
"/ selPart is the subclass:/variableSubclass/variableByteSubclass:/... - part |
2834 | 479 |
selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:') |
480 |
keywords first. |
|
2554 | 481 |
|
3446 | 482 |
(classNameUsed first isLetter not or:[classNameUsed contains:[:c | c isLetterOrDigit not and:[c ~~ $_]]]) ifTrue:[ |
483 |
classNameSymbolString := classNameUsed asSymbol storeString |
|
484 |
] ifFalse:[ |
|
485 |
classNameSymbolString := '#' , classNameUsed. |
|
486 |
]. |
|
487 |
||
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
488 |
^ String streamContents:[:stream | |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
489 |
stream |
2554 | 490 |
nextPutAll:superClassNameUsed; |
2834 | 491 |
nextPutAll:' ',selPart; |
3446 | 492 |
nextPutLine: classNameSymbolString; |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
493 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
494 |
nextPutAll:'instanceVariableNames:'; |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
495 |
nextPutLine:(instanceVariableNames ? '') storeString; |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
496 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
497 |
nextPutAll:'classVariableNames:'; |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
498 |
nextPutLine:(classVariableNames ? '') storeString; |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
499 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
500 |
nextPutAll:'poolDictionaries:'; |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
501 |
nextPutLine:(poolDictionaries ? '') storeString. |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
502 |
self isPrivateClassDefinitionChange ifTrue:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
503 |
ownerNameUsed := self owningClassName. |
3446 | 504 |
(nsOrNil isNil or:[nsOrNil ~~ nameSpaceName]) ifTrue:[ |
505 |
(nsOrNil ? nameSpaceName) notNil ifTrue:[ |
|
506 |
ownerNameUsed := (nsOrNil ? nameSpaceName),'::',ownerNameUsed. |
|
507 |
]. |
|
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
508 |
]. |
2831 | 509 |
stream |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
510 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
511 |
nextPutAll:'privateIn:'; |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
512 |
nextPutAll:ownerNameUsed |
2831 | 513 |
] ifFalse:[ |
514 |
stream |
|
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
515 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
516 |
nextPutAll:'category:'; |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
517 |
nextPutAll:(category ? '') asString storeString |
2831 | 518 |
]. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
519 |
] |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
520 |
|
2834 | 521 |
"Modified: / 13-06-2012 / 13:01:58 / cg" |
3446 | 522 |
"Modified: / 13-11-2013 / 17:13:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1196 | 523 |
! |
524 |
||
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
525 |
definitionStringWithoutNamespace |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
526 |
"cg - huh - who needs that? (the definitionString already does NOT include the classes namespace)" |
2876 | 527 |
|
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 |
||
772 | 622 |
!ClassDefinitionChange methodsFor:'queries'! |
623 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
624 |
definitionSelector |
1854 | 625 |
definitionSelector isNil ifTrue:[ |
626 |
self setupFromSource. |
|
3485
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
627 |
definitionSelector isNil ifTrue:[ |
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
628 |
definitionSelector := #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
629 |
]. |
1854 | 630 |
]. |
631 |
^ definitionSelector |
|
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
632 |
|
1854 | 633 |
"Modified: / 11-10-2006 / 14:11:44 / cg" |
3485
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
634 |
"Modified: / 12-02-2014 / 20:25:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
635 |
! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
636 |
|
2833 | 637 |
definitionSelector:aSelector |
638 |
definitionSelector := aSelector |
|
639 |
||
640 |
"Created: / 13-06-2012 / 12:45:02 / cg" |
|
641 |
! |
|
642 |
||
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
643 |
fullOwningClassName |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
644 |
"the owner's name, including its namespace" |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
645 |
|
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
646 |
|nm ns| |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
647 |
|
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
648 |
nm := self owningClassName. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
649 |
nm isNil ifTrue:[^ nil]. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
650 |
|
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
651 |
(ns := self nameSpaceOverride) notNil ifTrue:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
652 |
^ ns,'::',nm |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
653 |
]. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
654 |
^ nm |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
655 |
! |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
656 |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
657 |
owningClassName |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
658 |
"the owner's name, excluding the namespace" |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
659 |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
660 |
self isPrivateClassDefinitionChange ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
661 |
owningClassName isNil ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
662 |
self setupFromSource. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
663 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
664 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
665 |
^ owningClassName |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
666 |
|
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
667 |
"Created: / 12-10-2006 / 23:07:25 / cg" |
2289 | 668 |
! |
669 |
||
670 |
owningClassName:aStringOrSymbol |
|
671 |
owningClassName := aStringOrSymbol |
|
672 |
||
673 |
"Created: / 30-08-2010 / 13:55:37 / cg" |
|
772 | 674 |
! ! |
675 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
676 |
!ClassDefinitionChange methodsFor:'special'! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
677 |
|
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
678 |
installAsAutoloadedClassIfPublicWithFilename:aFilenameString |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
679 |
"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
|
680 |
Skip private classes. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
681 |
Enter class file name as abbreviation" |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
682 |
|
1904 | 683 |
|parseTree sel cat clsName cls catIdx pkg| |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
684 |
|
2289 | 685 |
private == true ifTrue:[^ self]. |
686 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
687 |
parseTree := Parser parseExpression:self source. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
688 |
parseTree isMessage ifFalse:[ |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
689 |
self error:'bad change source'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
690 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
691 |
|
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
692 |
sel := parseTree selector. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
693 |
(sel endsWith:':privateIn:') ifTrue:[^ self]. |
1418 | 694 |
|
3402
d13a0331a314
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
695 |
catIdx := sel keywords indexOf:'category:'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
696 |
catIdx ~~ 0 ifTrue:[ |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
697 |
cat := (parseTree args at:catIdx) evaluate. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
698 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
699 |
|
3223
c3c37b9ce3f1
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
700 |
clsName := self fullClassName "className" asSymbol. |
1802 | 701 |
cls := Smalltalk at:clsName. |
1904 | 702 |
|
703 |
pkg := package ? Project current package. |
|
704 |
||
1802 | 705 |
(cls isNil |
706 |
or:[cls isBehavior not |
|
707 |
or:[cls isLoaded not]]) ifTrue:[ |
|
1904 | 708 |
|autoloadedClass| |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
709 |
|
1836 | 710 |
autoloadedClass := Smalltalk |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
711 |
installAutoloadedClassNamed:clsName |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
712 |
category:cat |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
713 |
package:pkg |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
714 |
revision:nil. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
715 |
aFilenameString notNil ifTrue:[ |
1836 | 716 |
autoloadedClass setClassFilename:aFilenameString. |
717 |
"/ 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
|
718 |
] |
1904 | 719 |
] ifFalse:[ |
720 |
cls notNil ifTrue:[ |
|
721 |
cls isBehavior ifTrue:[ |
|
722 |
cls package ~= pkg ifTrue:[ |
|
3380 | 723 |
Transcript showCR:('Autoloaded class: %1 (%4) not installed (package would change from %2 to %3)' |
724 |
bindWith:clsName with:cls package with:pkg with:aFilenameString). |
|
1904 | 725 |
] |
726 |
]. |
|
727 |
]. |
|
728 |
]. |
|
1836 | 729 |
|
2402
f6799fe6acc4
changed: #installAsAutoloadedClassIfPublicWithFilename:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
730 |
"Modified: / 03-07-2011 / 18:34:05 / cg" |
1854 | 731 |
! |
732 |
||
2207 | 733 |
invalidateSource |
734 |
"internal - flush the sourceString if it got invalidated due to a |
|
735 |
className, superclassName, etc... change" |
|
736 |
||
737 |
source := nil. |
|
738 |
! |
|
739 |
||
1854 | 740 |
setupFromSource |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
741 |
"Extract data from class definition string in source. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
742 |
WARNING: This overwrites values in instvars!!" |
1854 | 743 |
|
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
744 |
|parseTree catIdx poolIdx instVarIdx classVarIdx | |
1854 | 745 |
|
746 |
source notNil ifTrue:[ |
|
747 |
parseTree := Parser parseExpression:source. |
|
1878 | 748 |
(parseTree notNil and:[parseTree isMessage]) ifFalse:[ |
1887 | 749 |
self error:'bad change source' mayProceed:true. |
750 |
^ self |
|
1854 | 751 |
]. |
752 |
||
753 |
definitionSelector := parseTree selector. |
|
754 |
||
755 |
private := (definitionSelector endsWith:':privateIn:'). |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
756 |
private ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
757 |
owningClassName := parseTree args last name. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
758 |
]. |
1854 | 759 |
|
760 |
catIdx := definitionSelector keywords indexOf:'category:'. |
|
761 |
catIdx ~~ 0 ifTrue:[ |
|
762 |
category := (parseTree args at:catIdx) evaluate. |
|
763 |
]. |
|
2368 | 764 |
|
2832 | 765 |
poolIdx := definitionSelector keywords indexOf:'poolDictionaries:'. |
766 |
poolIdx ~~ 0 ifTrue:[ |
|
767 |
poolDictionaries := (parseTree args at:poolIdx) evaluate. |
|
768 |
]. |
|
769 |
||
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
770 |
instVarIdx := definitionSelector keywords indexOf:'instanceVariableNames:'. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
771 |
instVarIdx ~~ 0 ifTrue:[ |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
772 |
instanceVariableNames := (parseTree args at:instVarIdx) value. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
773 |
]. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
774 |
|
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
775 |
classVarIdx := definitionSelector keywords indexOf:'classVariableNames:'. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
776 |
classVarIdx ~~ 0 ifTrue:[ |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
777 |
classVariableNames := (parseTree args at:classVarIdx) value. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
778 |
]. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
779 |
|
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
780 |
|
3446 | 781 |
"Care about nil superclasss (that's valid for certain |
782 |
classes like Object, ProtoObject or custom proxies" |
|
783 |
parseTree receiver isVariable ifTrue:[ |
|
784 |
superClassName := parseTree receiver name. |
|
785 |
] ifFalse:[ |
|
786 |
parseTree receiver isConstant ifTrue:[ |
|
787 |
superClassName := parseTree receiver value. |
|
788 |
superClassName notNil ifTrue:[ |
|
789 |
self error: 'Invalid superclass - can be either a class or nil' |
|
790 |
] |
|
791 |
] |
|
792 |
]. |
|
1854 | 793 |
]. |
794 |
||
795 |
"Created: / 11-10-2006 / 14:10:02 / cg" |
|
2832 | 796 |
"Modified: / 13-06-2012 / 12:25:10 / cg" |
3446 | 797 |
"Modified: / 10-06-2013 / 17:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
798 |
! ! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
799 |
|
3491
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
800 |
!ClassDefinitionChange methodsFor:'testing'! |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
801 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
802 |
isClassDefinitionChange |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
803 |
^ true |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
804 |
! |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
805 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
806 |
isOrContainsClassDefinitionChange |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
807 |
^ true |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
808 |
! |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
809 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
810 |
isPrivateClassDefinitionChange |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
811 |
"compute lazily; remember in private" |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
812 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
813 |
private isNil ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
814 |
(className includes:$:) ifFalse:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
815 |
"/ cannot be private |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
816 |
private := false |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
817 |
] ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
818 |
source isNil ifTrue:[^ false ]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
819 |
(source includesString:'private') ifFalse:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
820 |
private := false. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
821 |
] ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
822 |
"/ (self changeClass notNil |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
823 |
"/ and:[self changeClass isLoaded not]) ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
824 |
"/ "/ cannot be private |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
825 |
"/ private := false |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
826 |
"/ ] ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
827 |
self setupFromSource. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
828 |
"/ ]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
829 |
]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
830 |
]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
831 |
]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
832 |
^ private |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
833 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
834 |
"Created: / 11-10-2006 / 14:19:03 / cg" |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
835 |
"Modified: / 16-11-2006 / 16:34:19 / cg" |
3689
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
836 |
! |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
837 |
|
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
838 |
isVariable |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
839 |
indexedType notNil ifTrue:[ |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
840 |
self halt. |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
841 |
^ true. |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
842 |
]. |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
843 |
^ false. |
3491
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
844 |
! ! |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
845 |
|
2614
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
846 |
!ClassDefinitionChange methodsFor:'visiting'! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
847 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
848 |
acceptChangeVisitor:aVisitor |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
849 |
^ aVisitor visitClassDefinitionChange:self. |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
850 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
851 |
"Created: / 25-11-2011 / 17:13:13 / cg" |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
852 |
! ! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
853 |
|
100 | 854 |
!ClassDefinitionChange class methodsFor:'documentation'! |
855 |
||
2518 | 856 |
version |
3689
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
857 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.91 2014-12-23 22:51:35 cg Exp $' |
3223
c3c37b9ce3f1
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
858 |
! |
c3c37b9ce3f1
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
859 |
|
c3c37b9ce3f1
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
860 |
version_CVS |
3689
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
861 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.91 2014-12-23 22:51:35 cg Exp $' |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
862 |
! |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
863 |
|
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
864 |
version_HG |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
865 |
|
3270
b986056e7fe8
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3245
diff
changeset
|
866 |
^ '$Changeset: <not expanded> $' |
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
867 |
! |
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
868 |
|
2368 | 869 |
version_SVN |
3689
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
870 |
^ '$Id: ClassDefinitionChange.st,v 1.91 2014-12-23 22:51:35 cg Exp $' |
100 | 871 |
! ! |
3111 | 872 |