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