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