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