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