author | Claus Gittinger <cg@exept.de> |
Thu, 05 Mar 2020 11:17:28 +0100 | |
changeset 4561 | eace75531554 |
parent 4526 | f87aa4714f76 |
permissions | -rw-r--r-- |
4526 | 1 |
"{ Encoding: utf8 }" |
2 |
||
4 | 3 |
" |
4 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
25 | 5 |
All Rights Reserved |
4 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
14 |
"{ Package: 'stx:libbasic3' }" |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
15 |
|
3774 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
0 | 18 |
ClassChange subclass:#MethodChange |
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
19 |
instanceVariableNames:'selector methodCategory privacy previousVersion' |
2509 | 20 |
classVariableNames:'LastReplacementClass' |
235 | 21 |
poolDictionaries:'' |
22 |
category:'System-Changes' |
|
0 | 23 |
! |
24 |
||
1325 | 25 |
MethodChange subclass:#NamedMethodChange |
26 |
instanceVariableNames:'changeName' |
|
27 |
classVariableNames:'' |
|
28 |
poolDictionaries:'' |
|
29 |
privateIn:MethodChange |
|
30 |
! |
|
31 |
||
25 | 32 |
!MethodChange class methodsFor:'documentation'! |
33 |
||
34 |
copyright |
|
35 |
" |
|
36 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
37 |
All Rights Reserved |
|
10 | 38 |
|
25 | 39 |
This software is furnished under a license and may be used |
40 |
only in accordance with the terms of that license and with the |
|
41 |
inclusion of the above copyright notice. This software may not |
|
42 |
be provided or otherwise made available to, or used by, any |
|
43 |
other person. No title to or ownership of the software is |
|
44 |
hereby transferred. |
|
45 |
" |
|
46 |
! |
|
47 |
||
45 | 48 |
documentation |
49 |
" |
|
50 |
instances represent method-changes (as done in the browser). |
|
51 |
They are typically held in a ChangeSet. |
|
235 | 52 |
|
53 |
[author:] |
|
54 |
Claus Gittinger |
|
45 | 55 |
" |
25 | 56 |
! ! |
10 | 57 |
|
0 | 58 |
!MethodChange class methodsFor:'instance creation'! |
59 |
||
102
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
60 |
class:cls selector:sel source:src category:cat |
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
61 |
^ self basicNew class:cls selector:sel source:src category:cat |
1073 | 62 |
! |
63 |
||
64 |
className:clsName selector:sel source:src category:cat |
|
65 |
^ self basicNew className:clsName selector:sel source:src category:cat |
|
0 | 66 |
! ! |
67 |
||
68 |
!MethodChange methodsFor:'accessing'! |
|
69 |
||
1073 | 70 |
category |
71 |
^ methodCategory |
|
72 |
! |
|
73 |
||
911 | 74 |
category: aCategory |
75 |
methodCategory := aCategory |
|
76 |
||
77 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
78 |
! |
|
79 |
||
852 | 80 |
changeMethod |
81 |
|cls| |
|
82 |
||
83 |
cls := self changeClass. |
|
3902 | 84 |
(cls isNil or:[selector isNil]) ifTrue:[^ nil]. |
3560 | 85 |
^ cls compiledMethodAt:selector asSymbol |
852 | 86 |
|
87 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
88 |
! |
|
89 |
||
850 | 90 |
changeSelector |
91 |
^ selector |
|
92 |
||
93 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
94 |
! |
|
95 |
||
3989 | 96 |
class:cls selector:sel source:src category:cat |
4526 | 97 |
|classNameWithoutNamespace| |
98 |
||
99 |
classNameWithoutNamespace := cls nameWithoutNameSpacePrefix. |
|
100 |
(cls name = classNameWithoutNamespace) ifFalse:[ |
|
101 |
"/ split the name |
|
102 |
self nameSpaceName:(cls topNameSpace name). |
|
103 |
]. |
|
104 |
self className:classNameWithoutNamespace selector:sel source:src category:cat |
|
648 | 105 |
! |
106 |
||
3443 | 107 |
classIsJava |
108 |
"Returns true, if this change is for Java class (i.e., if it is for |
|
109 |
Smalltalk method that extends Java class)" |
|
110 |
||
111 |
^ classIsJava |
|
112 |
||
113 |
"Modified (comment): / 29-01-2013 / 14:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
114 |
! |
|
115 |
||
116 |
classIsJava:aBoolean |
|
117 |
"Sets whether this change is for Java class (i.e., if it is for |
|
118 |
Smalltalk method that extends Java class)" |
|
119 |
||
120 |
classIsJava := aBoolean. |
|
121 |
||
122 |
"Modified (comment): / 29-01-2013 / 14:11:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
123 |
! |
|
124 |
||
125 |
className |
|
3995 | 126 |
classIsJava == true ifTrue:[ ^ className]. |
127 |
^ super className |
|
3443 | 128 |
|
129 |
"Created: / 29-01-2013 / 14:21:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
130 |
"Modified: / 30-01-2013 / 10:00:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
131 |
! |
|
132 |
||
654 | 133 |
className:clsName selector:sel source:src category:cat |
1288 | 134 |
self className:clsName selector:sel source:src category:cat privacy:nil |
654 | 135 |
! |
136 |
||
137 |
className:clsName selector:sel source:src category:cat privacy:priv |
|
2258
b976e8e2874e
comment/format in: #selector:
Claus Gittinger <cg@exept.de>
parents:
2257
diff
changeset
|
138 |
self assert:(src isString). |
b976e8e2874e
comment/format in: #selector:
Claus Gittinger <cg@exept.de>
parents:
2257
diff
changeset
|
139 |
self assert:(sel isString or:[sel isSymbol]). |
1288 | 140 |
|
654 | 141 |
className := clsName. |
142 |
selector := sel. |
|
143 |
source := src. |
|
144 |
methodCategory := cat. |
|
145 |
privacy := priv. |
|
146 |
||
147 |
"Created: / 16.2.1998 / 12:29:49 / cg" |
|
148 |
"Modified: / 16.2.1998 / 14:28:12 / cg" |
|
149 |
! |
|
150 |
||
2369 | 151 |
delta |
2503 | 152 |
"/ obsolete: please use deltaDetail |
2369 | 153 |
|
154 |
| mth | |
|
155 |
||
156 |
self isMethodCodeChange ifFalse:[^super delta]. |
|
157 |
mth := self changeMethod. |
|
2625 | 158 |
mth isNil ifTrue:[^#+]. |
2369 | 159 |
^(self class isSource: self source sameSourceAs: mth source) |
160 |
ifTrue:[#=] |
|
161 |
ifFalse:[#~] |
|
2503 | 162 |
|
2625 | 163 |
"Modified: / 18-11-2011 / 14:48:50 / cg" |
2503 | 164 |
! |
165 |
||
166 |
deltaDetail |
|
167 |
"Returns a delta to the current state as a ChangeDelta object" |
|
168 |
||
169 |
| mth mySource imageSource| |
|
170 |
||
171 |
self isMethodCodeChange ifFalse:[^super deltaDetail]. |
|
172 |
mth := self changeMethod. |
|
173 |
mth isNil ifTrue:[^ ChangeDeltaInformation added ]. |
|
174 |
mySource := self source. |
|
175 |
imageSource := mth source. |
|
3138 | 176 |
|
177 |
(self class isSource: mySource sameSourceAs: imageSource) ifTrue:[ |
|
178 |
^ ChangeDeltaInformation identical |
|
179 |
]. |
|
180 |
^ ChangeDeltaInformation different |
|
2503 | 181 |
|
182 |
"Created: / 31-08-2011 / 10:27:58 / cg" |
|
2369 | 183 |
! |
184 |
||
2470 | 185 |
imageSource |
2846
221a345239fb
comment/format in: #imageSource
Claus Gittinger <cg@exept.de>
parents:
2625
diff
changeset
|
186 |
"return the source for the in-image version of the method" |
2470 | 187 |
|
188 |
| mth | |
|
189 |
||
2846
221a345239fb
comment/format in: #imageSource
Claus Gittinger <cg@exept.de>
parents:
2625
diff
changeset
|
190 |
self isMethodCodeChange ifFalse:[^ super imageSource]. |
2470 | 191 |
mth := self changeMethod. |
2846
221a345239fb
comment/format in: #imageSource
Claus Gittinger <cg@exept.de>
parents:
2625
diff
changeset
|
192 |
^ mth isNil |
221a345239fb
comment/format in: #imageSource
Claus Gittinger <cg@exept.de>
parents:
2625
diff
changeset
|
193 |
ifTrue: [nil] |
221a345239fb
comment/format in: #imageSource
Claus Gittinger <cg@exept.de>
parents:
2625
diff
changeset
|
194 |
ifFalse:[mth source] |
2470 | 195 |
|
196 |
"Created: / 19-07-2011 / 12:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2846
221a345239fb
comment/format in: #imageSource
Claus Gittinger <cg@exept.de>
parents:
2625
diff
changeset
|
197 |
"Modified (format): / 25-07-2012 / 17:37:52 / cg" |
2470 | 198 |
! |
199 |
||
652 | 200 |
methodCategory |
1234 | 201 |
|
652 | 202 |
^ methodCategory |
203 |
||
204 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
205 |
! |
|
206 |
||
1234 | 207 |
previousPackage |
208 |
| isNewMethod | |
|
209 |
isNewMethod := self previousVersion isNil. |
|
210 |
isNewMethod ifFalse:[ |
|
211 |
^ self previousVersion package. |
|
212 |
]. |
|
213 |
||
214 |
^ nil |
|
215 |
! |
|
216 |
||
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
217 |
previousVersion |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
218 |
"return the value of the instance variable 'previousVersion' (automatically generated)" |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
219 |
|
1073 | 220 |
^ previousVersion |
221 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
222 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
223 |
previousVersion:something |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
224 |
"set the value of the instance variable 'previousVersion' (automatically generated)" |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
225 |
|
1073 | 226 |
previousVersion := something. |
227 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
228 |
|
1234 | 229 |
previousVersionSource |
230 |
"return the value of the instance variable 'previousVersion' (automatically generated)" |
|
231 |
||
232 |
previousVersion isNil ifTrue:[^ nil]. |
|
233 |
^ previousVersion source |
|
234 |
! |
|
235 |
||
2872 | 236 |
privacy |
237 |
||
238 |
^privacy ? #public |
|
239 |
||
240 |
"Created: / 19-03-2012 / 18:16:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
241 |
! |
|
242 |
||
648 | 243 |
selector |
244 |
^ selector |
|
245 |
||
246 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
911 | 247 |
! |
248 |
||
249 |
selector:aSymbol |
|
2257 | 250 |
self assert:(aSymbol isSymbol). |
251 |
||
911 | 252 |
selector := aSymbol |
253 |
||
254 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
0 | 255 |
! ! |
256 |
||
849 | 257 |
!MethodChange methodsFor:'applying'! |
258 |
||
259 |
apply |
|
260 |
"apply the change" |
|
261 |
||
3774 | 262 |
|class replacementClassName suggestion oldMethodOrNil oldPackage |
263 |
newPackage newMethod defClass| |
|
1322 | 264 |
|
2020
5b3af99a4829
changed #apply: use #applyChange
Stefan Vogel <sv@exept.de>
parents:
1845
diff
changeset
|
265 |
class := self changeClass. |
1196 | 266 |
class isNil ifTrue:[ |
2512 | 267 |
"/ try the same replacement class again |
268 |
(LastReplacementClass notEmptyOrNil |
|
269 |
and:[ (class := Smalltalk classNamed:LastReplacementClass) notNil |
|
270 |
and:[ |
|
271 |
(className endsWith:' class') ifTrue:[ |
|
272 |
class := class theMetaclass |
|
273 |
] ifFalse:[ |
|
274 |
class := class theNonMetaclass |
|
275 |
]. |
|
276 |
class nameWithoutPrefix = className |
|
277 |
]]) |
|
278 |
ifFalse:[ |
|
279 |
"/ try a replacement class in the same namespace again |
|
3835 | 280 |
(className includesString:'::') ifTrue:[ |
281 |
suggestion := className copyFrom:(className lastIndexOf:$:)+1. |
|
282 |
(Smalltalk classNamed:suggestion) isBehavior ifFalse:[ |
|
283 |
suggestion := nil. |
|
284 |
]. |
|
285 |
]. |
|
286 |
suggestion := suggestion ? LastReplacementClass. |
|
287 |
||
2512 | 288 |
(class notNil |
289 |
and:[ (class := class nameSpace classNamed:className) notNil |
|
290 |
and:[ |
|
291 |
(className endsWith:' class') ifTrue:[ |
|
292 |
class := class theMetaclass |
|
293 |
] ifFalse:[ |
|
294 |
class := class theNonMetaclass |
|
295 |
]. |
|
296 |
class nameWithoutPrefix = className |
|
297 |
]]) |
|
298 |
ifFalse:[ |
|
4121 | 299 |
|action resources| |
2516
a1fdfc5e22cd
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2512
diff
changeset
|
300 |
|
4121 | 301 |
resources := self class projectDefinitionClass classResources. |
302 |
||
303 |
"/ ask for a repair action |
|
304 |
action := OptionBox |
|
305 |
request:(resources stringWithCRs:'Cannot apply change for missing class: %1\\Please choose a repair action:\- choose a replacement class\- define a dummy class\- skip this change\- cancel the load operation' |
|
306 |
with:className) |
|
307 |
buttonLabels:(resources array:#('Replace...' 'Create New...' 'Skip' 'Cancel')) |
|
308 |
values:#(replace create skip cancel). |
|
309 |
action == #skip ifTrue:[^ self]. |
|
310 |
action == #cancel ifTrue:[ AbortOperationRequest raise]. |
|
311 |
action == #replace ifTrue:[ |
|
312 |
replacementClassName := Dialog |
|
313 |
requestClassName:(resources |
|
314 |
string:'Replacement class for "%1"?' |
|
315 |
with:className) |
|
316 |
initialAnswer:suggestion. |
|
317 |
] ifFalse:[ |
|
318 |
replacementClassName := Dialog |
|
319 |
requestClassName:(resources |
|
320 |
stringWithCRs:'Create dummy class for "%1"?\(will be created in Namespace "%2")' |
|
321 |
with:className with:(Class nameSpaceQuerySignal query ? Smalltalk) name) |
|
4242 | 322 |
initialAnswer:(suggestion ? className). |
4121 | 323 |
]. |
324 |
replacementClassName isEmptyOrNil ifTrue:[ AbortOperationRequest raise ]. |
|
325 |
||
326 |
action == #create ifTrue:[ |
|
327 |
Object |
|
328 |
subclass:(replacementClassName asSymbol) |
|
329 |
instanceVariableNames:'' |
|
330 |
classVariableNames:'' |
|
331 |
poolDictionaries:'' |
|
332 |
category:'* dummy for porting *' |
|
333 |
]. |
|
334 |
class := Smalltalk classNamed:replacementClassName. |
|
335 |
class isNil ifTrue:[ |
|
336 |
class := (Class nameSpaceQuerySignal query ? Smalltalk) classNamed:replacementClassName. |
|
337 |
class isNil ifTrue:[ |
|
338 |
self error:(resources string:'Cannot apply change for missing class: %1' with:replacementClassName) mayProceed:true. |
|
339 |
^ self |
|
340 |
]. |
|
2512 | 341 |
]. |
3835 | 342 |
"/ (className endsWith:' class') ifTrue:[ |
343 |
"/ class := class theMetaclass |
|
344 |
"/ ] ifFalse:[ |
|
345 |
"/ class := class theNonMetaclass |
|
346 |
"/ ]. |
|
4121 | 347 |
|
348 |
LastReplacementClass := replacementClassName. |
|
2512 | 349 |
] |
350 |
] |
|
1196 | 351 |
]. |
3214 | 352 |
|
3533
cccb70e595fb
Fixes setting package when applying MethodChange.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3519
diff
changeset
|
353 |
newPackage := package notNil ifTrue:[package] ifFalse:[Class packageQuerySignal query]. |
cccb70e595fb
Fixes setting package when applying MethodChange.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3519
diff
changeset
|
354 |
|
3214 | 355 |
"/ if overwriting an existing method from another package, |
356 |
"/ put the existing method into the packagessafe |
|
357 |
oldMethodOrNil := class compiledMethodAt:selector. |
|
358 |
oldMethodOrNil notNil ifTrue:[ |
|
359 |
oldPackage := oldMethodOrNil package. |
|
360 |
(newPackage notNil and:[newPackage ~= oldPackage]) ifTrue:[ |
|
361 |
defClass := oldPackage asPackageId projectDefinitionClass. |
|
362 |
defClass notNil ifTrue:[ |
|
363 |
defClass rememberOverwrittenMethod:oldMethodOrNil inClass:class. |
|
364 |
] |
|
365 |
]. |
|
366 |
]. |
|
367 |
||
3774 | 368 |
newMethod := class compile:source classified:methodCategory logged:true. |
369 |
newMethod notNil ifTrue:[ |
|
370 |
newMethod package: newPackage. |
|
371 |
]. |
|
2509 | 372 |
|
3533
cccb70e595fb
Fixes setting package when applying MethodChange.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3519
diff
changeset
|
373 |
"Modified: / 29-03-2014 / 23:29:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4242 | 374 |
"Modified: / 18-06-2017 / 14:15:29 / cg" |
849 | 375 |
! ! |
376 |
||
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
377 |
!MethodChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
378 |
|
3213 | 379 |
isConflict |
380 |
"true if this change is different than what is already in the image |
|
381 |
(i.e. it overwrites some existing code)" |
|
382 |
||
383 |
|cls mthd| |
|
384 |
||
385 |
(cls := self changeClass) isNil ifTrue:[^ false]. |
|
386 |
(mthd := cls compiledMethodAt:selector) isNil ifTrue:[^ false]. |
|
387 |
^ mthd category ~= methodCategory |
|
388 |
or:[ mthd source ~= self source ] |
|
389 |
! |
|
390 |
||
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
391 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
392 |
"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:
779
diff
changeset
|
393 |
thingy as the receiver (i.e. same method, same definition etc.)." |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
394 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
395 |
"/ I am a methodChange - B must be as well. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
396 |
changeB isMethodChange ifFalse:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
397 |
|
1199 | 398 |
selector ~= changeB selector ifTrue:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
399 |
className ~= changeB className ifTrue:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
400 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
401 |
^ true |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
402 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
403 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
404 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
405 |
"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:
779
diff
changeset
|
406 |
|
798 | 407 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
1509 | 408 |
(self sameSourceAs:changeB) ifTrue:[^ true]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
409 |
|
1509 | 410 |
^ false. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
411 |
|
1509 | 412 |
"Modified: / 25-07-2006 / 11:23:27 / cg" |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
413 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
414 |
|
1325 | 415 |
!MethodChange methodsFor:'converting'! |
416 |
||
417 |
asNamedMethodChange |
|
418 |
^ NamedMethodChange fromMethodChange:self |
|
419 |
! ! |
|
420 |
||
2369 | 421 |
!MethodChange methodsFor:'fileout'! |
422 |
||
423 |
basicFileOutOn: aStream |
|
424 |
||
425 |
|cat | |
|
426 |
||
427 |
self isMethodCodeChange ifFalse:[^super basicFileOutOn: aStream]. |
|
428 |
||
429 |
aStream nextPutChunkSeparator. |
|
3519 | 430 |
nameSpaceName notEmptyOrNil ifTrue:[ |
431 |
nameSpaceName printOn:aStream. |
|
432 |
aStream nextPutAll:'::'. |
|
433 |
]. |
|
2369 | 434 |
self className printOn:aStream. |
435 |
"/ self printClassNameOn:aStream. |
|
436 |
||
437 |
(privacy ? #public) ~~ #public ifTrue:[ |
|
438 |
aStream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'. |
|
439 |
] ifFalse:[ |
|
440 |
aStream nextPutAll:' methodsFor:'. |
|
441 |
]. |
|
442 |
||
443 |
cat := methodCategory ? ''. |
|
444 |
aStream nextPutAll:cat asString storeString. |
|
445 |
aStream nextPutChunkSeparator; cr; cr. |
|
446 |
||
447 |
source := self source. |
|
448 |
source isNil ifTrue:[ |
|
449 |
ClassDescription fileOutErrorSignal |
|
450 |
raiseRequestWith:self |
|
451 |
errorString:(' - no source for method: ' , |
|
452 |
self className , '>>' , selector). |
|
453 |
||
454 |
] ifFalse:[ |
|
455 |
aStream nextChunkPut:source. |
|
456 |
]. |
|
457 |
aStream space. |
|
458 |
aStream nextPutChunkSeparator. |
|
459 |
aStream cr; cr |
|
460 |
||
461 |
"Modified: / 05-12-2009 / 12:38:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
462 |
! ! |
|
463 |
||
963 | 464 |
!MethodChange methodsFor:'printing & storing'! |
0 | 465 |
|
7 | 466 |
printOn:aStream |
800 | 467 |
"append a user printed representation of the receiver to aStream. |
468 |
The format is suitable for a human - not meant to be read back." |
|
469 |
||
2170 | 470 |
aStream |
3835 | 471 |
nextPutAll:(self fullClassName ? 'unnamed'); |
3179 | 472 |
nextPutAll:' >> '; |
473 |
nextPutAll:(selector ? '?'); |
|
474 |
nextPutAll:' {'; |
|
475 |
nextPutAll:(methodCategory ? '?'); |
|
476 |
nextPutAll:'}' |
|
1512 | 477 |
|
1833
cf60e3c0087e
care for bad (nil) methodCategory
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
478 |
"Modified: / 04-10-2006 / 16:46:01 / cg" |
2170 | 479 |
"Modified: / 07-11-2008 / 08:29:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
779 | 480 |
! |
481 |
||
896 | 482 |
printWithoutClassNameOn:aStream |
483 |
(className endsWith:' class') ifTrue:[ |
|
484 |
aStream nextPutAll:'class ' |
|
485 |
]. |
|
486 |
aStream nextPutAll:selector |
|
487 |
! |
|
488 |
||
489 |
printWithoutOwningClassOn:aStream |
|
2022
a498c70c0aac
changed #printWithoutOwningClassOn:
Claus Gittinger <cg@exept.de>
parents:
2020
diff
changeset
|
490 |
self breakPoint:#cg. |
779 | 491 |
(className endsWith:' class') ifTrue:[ |
492 |
aStream nextPutAll:'class ' |
|
493 |
]. |
|
494 |
aStream nextPutAll:selector |
|
1845 | 495 |
! |
496 |
||
497 |
sourceForMethod |
|
2157 | 498 |
^ '(' , className , ' compiledMethodAt:' , selector asSymbol storeString, ')' |
1845 | 499 |
|
500 |
"Created: / 09-10-2006 / 13:58:09 / cg" |
|
0 | 501 |
! ! |
235 | 502 |
|
2130 | 503 |
!MethodChange methodsFor:'testing'! |
652 | 504 |
|
505 |
isMethodChange |
|
2130 | 506 |
"true if this is a method related change" |
507 |
||
652 | 508 |
^ true |
509 |
||
510 |
"Created: / 7.2.1998 / 19:26:59 / cg" |
|
2130 | 511 |
! |
512 |
||
3443 | 513 |
isMethodChangeForCopyrightMethod |
514 |
^self isMethodCodeChange and: [ self isForMeta and: [ self selector == #copyright ] ] |
|
515 |
||
516 |
"Created: / 01-08-2012 / 16:33:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
517 |
! |
|
518 |
||
2942
635660203429
added: #isMethodChangeForExtensionsVersionMethod
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
519 |
isMethodChangeForExtensionsVersionMethod |
2944 | 520 |
"true if this is a change for an extensionsVersion method" |
521 |
||
2942
635660203429
added: #isMethodChangeForExtensionsVersionMethod
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
522 |
^ self isMethodCodeChange |
635660203429
added: #isMethodChangeForExtensionsVersionMethod
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
523 |
and:[ AbstractSourceCodeManager isExtensionsVersionMethodSelector:self selector ] |
635660203429
added: #isMethodChangeForExtensionsVersionMethod
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
524 |
! |
635660203429
added: #isMethodChangeForExtensionsVersionMethod
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
525 |
|
2187 | 526 |
isMethodChangeForVersionMethod |
2944 | 527 |
"true if this is a change for a version method" |
528 |
||
2187 | 529 |
^ self isMethodCodeChange |
530 |
and:[ AbstractSourceCodeManager isVersionMethodSelector:self selector ] |
|
531 |
! |
|
532 |
||
2130 | 533 |
isMethodCodeChange |
534 |
"true if this is a method's code change (not package, category etc.)" |
|
535 |
||
2260 | 536 |
^ true |
652 | 537 |
! ! |
538 |
||
2616
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
539 |
!MethodChange methodsFor:'visiting'! |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
540 |
|
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
541 |
acceptChangeVisitor:aVisitor |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
542 |
^ aVisitor visitMethodChange:self. |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
543 |
|
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
544 |
"Created: / 25-11-2011 / 17:13:50 / cg" |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
545 |
! ! |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
546 |
|
1325 | 547 |
!MethodChange::NamedMethodChange class methodsFor:'instance creation'! |
548 |
||
549 |
fromMethodChange:aMethodChange |
|
550 |
^ self new cloneInstanceVariablesFrom:aMethodChange |
|
551 |
! ! |
|
552 |
||
553 |
!MethodChange::NamedMethodChange methodsFor:'accessing'! |
|
554 |
||
555 |
changeName:something |
|
556 |
changeName := something. |
|
557 |
! ! |
|
558 |
||
559 |
!MethodChange::NamedMethodChange methodsFor:'printing & storing'! |
|
560 |
||
561 |
printOn:aStream |
|
562 |
changeName notNil ifTrue:[ |
|
563 |
changeName printOn:aStream. |
|
564 |
^ self. |
|
565 |
]. |
|
566 |
super printOn:aStream |
|
567 |
! ! |
|
568 |
||
235 | 569 |
!MethodChange class methodsFor:'documentation'! |
570 |
||
2944 | 571 |
version |
3902 | 572 |
^ '$Header$' |
2944 | 573 |
! |
574 |
||
575 |
version_CVS |
|
3902 | 576 |
^ '$Header$' |
2944 | 577 |
! |
578 |
||
2369 | 579 |
version_SVN |
3902 | 580 |
^ '$Id$' |
235 | 581 |
! ! |
3138 | 582 |