author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 30 Jan 2013 11:20:55 +0000 | |
branch | jv |
changeset 3123 | f2d7f70fdb0a |
parent 3122 | 91c582043a51 |
parent 3121 | 19723298dd2c |
child 3128 | 87750af738dc |
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 |
|
0 | 14 |
ClassChange subclass:#MethodChange |
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
15 |
instanceVariableNames:'selector methodCategory privacy previousVersion' |
2509 | 16 |
classVariableNames:'LastReplacementClass' |
235 | 17 |
poolDictionaries:'' |
18 |
category:'System-Changes' |
|
0 | 19 |
! |
20 |
||
1325 | 21 |
MethodChange subclass:#NamedMethodChange |
22 |
instanceVariableNames:'changeName' |
|
23 |
classVariableNames:'' |
|
24 |
poolDictionaries:'' |
|
25 |
privateIn:MethodChange |
|
26 |
! |
|
27 |
||
25 | 28 |
!MethodChange class methodsFor:'documentation'! |
29 |
||
30 |
copyright |
|
31 |
" |
|
32 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
33 |
All Rights Reserved |
|
10 | 34 |
|
25 | 35 |
This software is furnished under a license and may be used |
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
43 |
||
45 | 44 |
documentation |
45 |
" |
|
46 |
instances represent method-changes (as done in the browser). |
|
47 |
They are typically held in a ChangeSet. |
|
235 | 48 |
|
49 |
[author:] |
|
50 |
Claus Gittinger |
|
45 | 51 |
" |
25 | 52 |
! ! |
10 | 53 |
|
0 | 54 |
!MethodChange class methodsFor:'instance creation'! |
55 |
||
2119 | 56 |
class:cls selector:sel category:cat |
57 |
^ self basicNew class:cls selector:sel category:cat |
|
58 |
||
59 |
||
60 |
! |
|
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 |
||
2119 | 66 |
className:clsName selector:sel category:cat |
67 |
^ self basicNew className:clsName selector:sel category:cat |
|
68 |
||
69 |
"Created: / 12-11-2006 / 15:54:25 / cg" |
|
70 |
! |
|
71 |
||
1073 | 72 |
className:clsName selector:sel source:src category:cat |
73 |
^ self basicNew className:clsName selector:sel source:src category:cat |
|
0 | 74 |
! ! |
75 |
||
76 |
!MethodChange methodsFor:'accessing'! |
|
77 |
||
1073 | 78 |
category |
79 |
^ methodCategory |
|
80 |
! |
|
81 |
||
911 | 82 |
category: aCategory |
83 |
methodCategory := aCategory |
|
84 |
||
85 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
86 |
! |
|
87 |
||
852 | 88 |
changeMethod |
89 |
|cls| |
|
90 |
||
91 |
cls := self changeClass. |
|
92 |
cls isNil ifTrue:[^ nil]. |
|
93 |
^ cls compiledMethodAt:selector |
|
94 |
||
95 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
96 |
! |
|
97 |
||
850 | 98 |
changeSelector |
99 |
^ selector |
|
100 |
||
101 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
102 |
! |
|
103 |
||
102
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
104 |
class:cls selector:sel source:src category:cat |
1288 | 105 |
self className:(cls name) selector:sel source:src category:cat |
648 | 106 |
! |
107 |
||
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
108 |
classIsJava |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
109 |
"Returns true, if this change is for Java class (i.e., if it is for |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
110 |
Smalltalk method that extends Java class)" |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
111 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
112 |
^ classIsJava |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
113 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
114 |
"Modified (comment): / 29-01-2013 / 14:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
115 |
! |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
116 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
117 |
classIsJava:aBoolean |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
118 |
"Sets whether this change is for Java class (i.e., if it is for |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
119 |
Smalltalk method that extends Java class)" |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
120 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
121 |
classIsJava := aBoolean. |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
122 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
123 |
"Modified (comment): / 29-01-2013 / 14:11:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
124 |
! |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
125 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
126 |
className |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
127 |
^classIsJava ifTrue:[ |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
128 |
className |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
129 |
] ifFalse:[ |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
130 |
super className |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
131 |
] |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
132 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
133 |
"Created: / 29-01-2013 / 14:21:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3122
91c582043a51
Added support for writing extensions files as sources. Added version_HG to classes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
134 |
"Modified: / 30-01-2013 / 10:00:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
135 |
! |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
136 |
|
654 | 137 |
className:clsName selector:sel source:src category:cat |
1288 | 138 |
self className:clsName selector:sel source:src category:cat privacy:nil |
654 | 139 |
! |
140 |
||
141 |
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
|
142 |
self assert:(src isString). |
b976e8e2874e
comment/format in: #selector:
Claus Gittinger <cg@exept.de>
parents:
2257
diff
changeset
|
143 |
self assert:(sel isString or:[sel isSymbol]). |
1288 | 144 |
|
654 | 145 |
className := clsName. |
146 |
selector := sel. |
|
147 |
source := src. |
|
148 |
methodCategory := cat. |
|
149 |
privacy := priv. |
|
150 |
||
151 |
"Created: / 16.2.1998 / 12:29:49 / cg" |
|
152 |
"Modified: / 16.2.1998 / 14:28:12 / cg" |
|
153 |
! |
|
154 |
||
2369 | 155 |
delta |
2503 | 156 |
"/ obsolete: please use deltaDetail |
2369 | 157 |
|
158 |
| mth | |
|
159 |
||
160 |
self isMethodCodeChange ifFalse:[^super delta]. |
|
161 |
mth := self changeMethod. |
|
2625 | 162 |
mth isNil ifTrue:[^#+]. |
2369 | 163 |
^(self class isSource: self source sameSourceAs: mth source) |
164 |
ifTrue:[#=] |
|
165 |
ifFalse:[#~] |
|
2503 | 166 |
|
2625 | 167 |
"Modified: / 18-11-2011 / 14:48:50 / cg" |
2503 | 168 |
! |
169 |
||
170 |
deltaDetail |
|
171 |
"Returns a delta to the current state as a ChangeDelta object" |
|
172 |
||
173 |
| mth mySource imageSource| |
|
174 |
||
175 |
self isMethodCodeChange ifFalse:[^super deltaDetail]. |
|
176 |
mth := self changeMethod. |
|
177 |
mth isNil ifTrue:[^ ChangeDeltaInformation added ]. |
|
178 |
mySource := self source. |
|
179 |
imageSource := mth source. |
|
180 |
^(self class isSource: mySource sameSourceAs: imageSource) |
|
181 |
ifTrue:[ ChangeDeltaInformation identical ] |
|
182 |
ifFalse:[ ChangeDeltaInformation different ] |
|
183 |
||
184 |
"Created: / 31-08-2011 / 10:27:58 / cg" |
|
2369 | 185 |
! |
186 |
||
2470 | 187 |
imageSource |
3065 | 188 |
"return the source for the in-image version of the method" |
2470 | 189 |
|
190 |
| mth | |
|
191 |
||
3065 | 192 |
self isMethodCodeChange ifFalse:[^ super imageSource]. |
2470 | 193 |
mth := self changeMethod. |
3065 | 194 |
^ mth isNil |
195 |
ifTrue: [nil] |
|
196 |
ifFalse:[mth source] |
|
2470 | 197 |
|
198 |
"Created: / 19-07-2011 / 12:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3065 | 199 |
"Modified (format): / 25-07-2012 / 17:37:52 / cg" |
2470 | 200 |
! |
201 |
||
652 | 202 |
methodCategory |
1234 | 203 |
|
652 | 204 |
^ methodCategory |
205 |
||
206 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
207 |
! |
|
208 |
||
1234 | 209 |
previousPackage |
210 |
| isNewMethod | |
|
211 |
isNewMethod := self previousVersion isNil. |
|
212 |
isNewMethod ifFalse:[ |
|
213 |
^ self previousVersion package. |
|
214 |
]. |
|
215 |
||
216 |
^ nil |
|
217 |
! |
|
218 |
||
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
219 |
previousVersion |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
220 |
"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
|
221 |
|
1073 | 222 |
^ previousVersion |
223 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
224 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
225 |
previousVersion:something |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
226 |
"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
|
227 |
|
1073 | 228 |
previousVersion := something. |
229 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
230 |
|
1234 | 231 |
previousVersionSource |
232 |
"return the value of the instance variable 'previousVersion' (automatically generated)" |
|
233 |
||
234 |
previousVersion isNil ifTrue:[^ nil]. |
|
235 |
^ previousVersion source |
|
236 |
! |
|
237 |
||
3031
66f3216e3ea5
Fixes to fileout changeset in St/X class source format.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
238 |
privacy |
66f3216e3ea5
Fixes to fileout changeset in St/X class source format.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
239 |
|
66f3216e3ea5
Fixes to fileout changeset in St/X class source format.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
240 |
^privacy ? #public |
66f3216e3ea5
Fixes to fileout changeset in St/X class source format.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
241 |
|
66f3216e3ea5
Fixes to fileout changeset in St/X class source format.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
242 |
"Created: / 19-03-2012 / 18:16:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
66f3216e3ea5
Fixes to fileout changeset in St/X class source format.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
243 |
! |
66f3216e3ea5
Fixes to fileout changeset in St/X class source format.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3012
diff
changeset
|
244 |
|
648 | 245 |
selector |
246 |
^ selector |
|
247 |
||
248 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
911 | 249 |
! |
250 |
||
251 |
selector:aSymbol |
|
2257 | 252 |
self assert:(aSymbol isSymbol). |
253 |
||
911 | 254 |
selector := aSymbol |
255 |
||
256 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
0 | 257 |
! ! |
258 |
||
849 | 259 |
!MethodChange methodsFor:'applying'! |
260 |
||
261 |
apply |
|
262 |
"apply the change" |
|
263 |
||
2512 | 264 |
|class replacementClassName suggestion| |
1322 | 265 |
|
2020
5b3af99a4829
changed #apply: use #applyChange
Stefan Vogel <sv@exept.de>
parents:
1845
diff
changeset
|
266 |
class := self changeClass. |
1196 | 267 |
class isNil ifTrue:[ |
2512 | 268 |
"/ try the same replacement class again |
269 |
(LastReplacementClass notEmptyOrNil |
|
270 |
and:[ (class := Smalltalk classNamed:LastReplacementClass) notNil |
|
271 |
and:[ |
|
272 |
(className endsWith:' class') ifTrue:[ |
|
273 |
class := class theMetaclass |
|
274 |
] ifFalse:[ |
|
275 |
class := class theNonMetaclass |
|
276 |
]. |
|
277 |
class nameWithoutPrefix = className |
|
278 |
]]) |
|
279 |
ifFalse:[ |
|
280 |
"/ try a replacement class in the same namespace again |
|
281 |
suggestion := LastReplacementClass. |
|
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 |
|
295 |
request:('Cannot apply change for missing class: %1\\Use replacement class (or press cancel)' bindWith:className) withCRs |
|
296 |
initialAnswer:suggestion. |
|
2516
a1fdfc5e22cd
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2512
diff
changeset
|
297 |
replacementClassName isNil ifTrue:[ AbortSignal raise ]. |
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 |
]. |
|
304 |
(className endsWith:' class') ifTrue:[ |
|
305 |
class := class theMetaclass |
|
306 |
] ifFalse:[ |
|
307 |
class := class theNonMetaclass |
|
308 |
]. |
|
309 |
LastReplacementClass := replacementClassName |
|
310 |
] |
|
311 |
] |
|
1196 | 312 |
]. |
849 | 313 |
class compile:source classified:methodCategory logged:true. |
2509 | 314 |
|
2516
a1fdfc5e22cd
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2512
diff
changeset
|
315 |
"Modified: / 07-09-2011 / 21:09:19 / cg" |
849 | 316 |
! ! |
317 |
||
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
318 |
!MethodChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
319 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
320 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
321 |
"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
|
322 |
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
|
323 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
324 |
"/ 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
|
325 |
changeB isMethodChange ifFalse:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
326 |
|
1199 | 327 |
selector ~= changeB selector ifTrue:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
328 |
className ~= changeB className ifTrue:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
329 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
330 |
^ true |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
331 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
332 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
333 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
334 |
"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
|
335 |
|
798 | 336 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
1509 | 337 |
(self sameSourceAs:changeB) ifTrue:[^ true]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
338 |
|
1509 | 339 |
^ false. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
340 |
|
1509 | 341 |
"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
|
342 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
343 |
|
1325 | 344 |
!MethodChange methodsFor:'converting'! |
345 |
||
346 |
asNamedMethodChange |
|
347 |
^ NamedMethodChange fromMethodChange:self |
|
348 |
! ! |
|
349 |
||
2369 | 350 |
!MethodChange methodsFor:'fileout'! |
351 |
||
352 |
basicFileOutOn: aStream |
|
353 |
||
354 |
|cat | |
|
355 |
||
356 |
self isMethodCodeChange ifFalse:[^super basicFileOutOn: aStream]. |
|
357 |
||
358 |
||
359 |
||
360 |
aStream nextPutChunkSeparator. |
|
361 |
self className printOn:aStream. |
|
362 |
"/ self printClassNameOn:aStream. |
|
363 |
||
364 |
(privacy ? #public) ~~ #public ifTrue:[ |
|
365 |
aStream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'. |
|
366 |
] ifFalse:[ |
|
367 |
aStream nextPutAll:' methodsFor:'. |
|
368 |
]. |
|
369 |
||
370 |
cat := methodCategory ? ''. |
|
371 |
aStream nextPutAll:cat asString storeString. |
|
372 |
aStream nextPutChunkSeparator; cr; cr. |
|
373 |
||
374 |
source := self source. |
|
375 |
source isNil ifTrue:[ |
|
376 |
ClassDescription fileOutErrorSignal |
|
377 |
raiseRequestWith:self |
|
378 |
errorString:(' - no source for method: ' , |
|
379 |
self className , '>>' , selector). |
|
380 |
||
381 |
] ifFalse:[ |
|
382 |
aStream nextChunkPut:source. |
|
383 |
]. |
|
384 |
aStream space. |
|
385 |
aStream nextPutChunkSeparator. |
|
386 |
aStream cr; cr |
|
387 |
||
388 |
"Modified: / 05-12-2009 / 12:38:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
389 |
! ! |
|
390 |
||
963 | 391 |
!MethodChange methodsFor:'printing & storing'! |
0 | 392 |
|
7 | 393 |
printOn:aStream |
800 | 394 |
"append a user printed representation of the receiver to aStream. |
395 |
The format is suitable for a human - not meant to be read back." |
|
396 |
||
2170 | 397 |
aStream |
398 |
nextPutAll:(self className ? 'unnamed'); |
|
399 |
nextPutAll:'>>'; |
|
400 |
nextPutAll:(selector ? '?'); |
|
401 |
nextPutAll:' {'; |
|
402 |
nextPutAll:(methodCategory ? '?'); |
|
403 |
nextPutAll:'}' |
|
1512 | 404 |
|
1833
cf60e3c0087e
care for bad (nil) methodCategory
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
405 |
"Modified: / 04-10-2006 / 16:46:01 / cg" |
2170 | 406 |
"Modified: / 07-11-2008 / 08:29:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
779 | 407 |
! |
408 |
||
896 | 409 |
printWithoutClassNameOn:aStream |
410 |
(className endsWith:' class') ifTrue:[ |
|
411 |
aStream nextPutAll:'class ' |
|
412 |
]. |
|
413 |
aStream nextPutAll:selector |
|
414 |
! |
|
415 |
||
416 |
printWithoutOwningClassOn:aStream |
|
2022
a498c70c0aac
changed #printWithoutOwningClassOn:
Claus Gittinger <cg@exept.de>
parents:
2020
diff
changeset
|
417 |
self breakPoint:#cg. |
779 | 418 |
(className endsWith:' class') ifTrue:[ |
419 |
aStream nextPutAll:'class ' |
|
420 |
]. |
|
421 |
aStream nextPutAll:selector |
|
1845 | 422 |
! |
423 |
||
424 |
sourceForMethod |
|
2157 | 425 |
^ '(' , className , ' compiledMethodAt:' , selector asSymbol storeString, ')' |
1845 | 426 |
|
427 |
"Created: / 09-10-2006 / 13:58:09 / cg" |
|
0 | 428 |
! ! |
235 | 429 |
|
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
430 |
|
2130 | 431 |
!MethodChange methodsFor:'testing'! |
652 | 432 |
|
433 |
isMethodChange |
|
2130 | 434 |
"true if this is a method related change" |
435 |
||
652 | 436 |
^ true |
437 |
||
438 |
"Created: / 7.2.1998 / 19:26:59 / cg" |
|
2130 | 439 |
! |
440 |
||
3074
e38a06f751a5
Some more testing methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3069
diff
changeset
|
441 |
isMethodChangeForCopyrightMethod |
e38a06f751a5
Some more testing methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3069
diff
changeset
|
442 |
^self isMethodCodeChange and: [ self isForMeta and: [ self selector == #copyright ] ] |
e38a06f751a5
Some more testing methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3069
diff
changeset
|
443 |
|
e38a06f751a5
Some more testing methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3069
diff
changeset
|
444 |
"Created: / 01-08-2012 / 16:33:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e38a06f751a5
Some more testing methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3069
diff
changeset
|
445 |
! |
e38a06f751a5
Some more testing methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3069
diff
changeset
|
446 |
|
3095 | 447 |
isMethodChangeForExtensionsVersionMethod |
448 |
"true if this is a change for an extensionsVersion method" |
|
449 |
||
450 |
^ self isMethodCodeChange |
|
451 |
and:[ AbstractSourceCodeManager isExtensionsVersionMethodSelector:self selector ] |
|
452 |
! |
|
453 |
||
2187 | 454 |
isMethodChangeForVersionMethod |
3095 | 455 |
"true if this is a change for a version method" |
456 |
||
2187 | 457 |
^ self isMethodCodeChange |
458 |
and:[ AbstractSourceCodeManager isVersionMethodSelector:self selector ] |
|
459 |
! |
|
460 |
||
2130 | 461 |
isMethodCodeChange |
462 |
"true if this is a method's code change (not package, category etc.)" |
|
463 |
||
2260 | 464 |
^ true |
652 | 465 |
! ! |
466 |
||
2616
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
467 |
!MethodChange methodsFor:'visiting'! |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
468 |
|
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
469 |
acceptChangeVisitor:aVisitor |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
470 |
^ aVisitor visitMethodChange:self. |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
471 |
|
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
472 |
"Created: / 25-11-2011 / 17:13:50 / cg" |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
473 |
! ! |
0eba26a9f6af
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2516
diff
changeset
|
474 |
|
1325 | 475 |
!MethodChange::NamedMethodChange class methodsFor:'instance creation'! |
476 |
||
477 |
fromMethodChange:aMethodChange |
|
478 |
^ self new cloneInstanceVariablesFrom:aMethodChange |
|
479 |
! ! |
|
480 |
||
481 |
!MethodChange::NamedMethodChange methodsFor:'accessing'! |
|
482 |
||
483 |
changeName:something |
|
484 |
changeName := something. |
|
485 |
! ! |
|
486 |
||
487 |
!MethodChange::NamedMethodChange methodsFor:'printing & storing'! |
|
488 |
||
489 |
printOn:aStream |
|
490 |
changeName notNil ifTrue:[ |
|
491 |
changeName printOn:aStream. |
|
492 |
^ self. |
|
493 |
]. |
|
494 |
super printOn:aStream |
|
495 |
! ! |
|
496 |
||
235 | 497 |
!MethodChange class methodsFor:'documentation'! |
498 |
||
3069 | 499 |
version |
3095 | 500 |
^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.68 2012/10/30 14:25:11 cg Exp $' |
501 |
! |
|
502 |
||
503 |
version_CVS |
|
3123 | 504 |
^ 'Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.68 2012/10/30 14:25:11 cg Exp ' |
2187 | 505 |
! |
506 |
||
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
507 |
version_HG |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
508 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
509 |
^ '$Changeset: <not expanded> $' |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
510 |
! |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
511 |
|
2369 | 512 |
version_SVN |
3123 | 513 |
^ 'Id: MethodChange.st 1981 2012-11-30 17:20:01Z vranyj1 ' |
3012 | 514 |
! ! |
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3095
diff
changeset
|
515 |