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