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