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