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