author | fm |
Wed, 07 Oct 2009 14:15:20 +0200 | |
changeset 2187 | b36325e3df21 |
parent 2170 | 3357cc27387c |
child 2257 | 808be4648d12 |
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' |
235 | 16 |
classVariableNames:'' |
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 |
||
654 | 108 |
className:clsName selector:sel source:src category:cat |
1288 | 109 |
self className:clsName selector:sel source:src category:cat privacy:nil |
654 | 110 |
! |
111 |
||
112 |
className:clsName selector:sel source:src category:cat privacy:priv |
|
1468 | 113 |
self assert:(src isString). |
1288 | 114 |
|
654 | 115 |
className := clsName. |
116 |
selector := sel. |
|
117 |
source := src. |
|
118 |
methodCategory := cat. |
|
119 |
privacy := priv. |
|
120 |
||
121 |
"Created: / 16.2.1998 / 12:29:49 / cg" |
|
122 |
"Modified: / 16.2.1998 / 14:28:12 / cg" |
|
123 |
! |
|
124 |
||
652 | 125 |
methodCategory |
1234 | 126 |
|
652 | 127 |
^ methodCategory |
128 |
||
129 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
130 |
! |
|
131 |
||
1234 | 132 |
previousPackage |
133 |
| isNewMethod | |
|
134 |
isNewMethod := self previousVersion isNil. |
|
135 |
isNewMethod ifFalse:[ |
|
136 |
^ self previousVersion package. |
|
137 |
]. |
|
138 |
||
139 |
^ nil |
|
140 |
! |
|
141 |
||
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
142 |
previousVersion |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
143 |
"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
|
144 |
|
1073 | 145 |
^ previousVersion |
146 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
147 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
148 |
previousVersion:something |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
149 |
"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
|
150 |
|
1073 | 151 |
previousVersion := something. |
152 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
153 |
|
1234 | 154 |
previousVersionSource |
155 |
"return the value of the instance variable 'previousVersion' (automatically generated)" |
|
156 |
||
157 |
previousVersion isNil ifTrue:[^ nil]. |
|
158 |
^ previousVersion source |
|
159 |
! |
|
160 |
||
648 | 161 |
selector |
162 |
^ selector |
|
163 |
||
164 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
911 | 165 |
! |
166 |
||
167 |
selector:aSymbol |
|
168 |
selector := aSymbol |
|
169 |
||
170 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
0 | 171 |
! ! |
172 |
||
849 | 173 |
!MethodChange methodsFor:'applying'! |
174 |
||
175 |
apply |
|
176 |
"apply the change" |
|
177 |
||
2020
5b3af99a4829
changed #apply: use #applyChange
Stefan Vogel <sv@exept.de>
parents:
1845
diff
changeset
|
178 |
|class| |
1322 | 179 |
|
2020
5b3af99a4829
changed #apply: use #applyChange
Stefan Vogel <sv@exept.de>
parents:
1845
diff
changeset
|
180 |
class := self changeClass. |
1196 | 181 |
class isNil ifTrue:[ |
2077 | 182 |
self error:('Cannot apply change for missing class: ' , className) mayProceed:true. |
183 |
^ self |
|
1196 | 184 |
]. |
849 | 185 |
class compile:source classified:methodCategory logged:true. |
186 |
! ! |
|
187 |
||
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
188 |
!MethodChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
189 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
190 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
191 |
"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
|
192 |
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
|
193 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
194 |
"/ 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
|
195 |
changeB isMethodChange ifFalse:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
196 |
|
1199 | 197 |
selector ~= changeB selector ifTrue:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
198 |
className ~= changeB className ifTrue:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
199 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
200 |
^ true |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
201 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
202 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
203 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
204 |
"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
|
205 |
|
798 | 206 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
1509 | 207 |
(self sameSourceAs:changeB) ifTrue:[^ true]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
208 |
|
1509 | 209 |
^ false. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
210 |
|
1509 | 211 |
"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
|
212 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
213 |
|
1325 | 214 |
!MethodChange methodsFor:'converting'! |
215 |
||
216 |
asNamedMethodChange |
|
217 |
^ NamedMethodChange fromMethodChange:self |
|
218 |
! ! |
|
219 |
||
963 | 220 |
!MethodChange methodsFor:'printing & storing'! |
0 | 221 |
|
7 | 222 |
printOn:aStream |
800 | 223 |
"append a user printed representation of the receiver to aStream. |
224 |
The format is suitable for a human - not meant to be read back." |
|
225 |
||
2170 | 226 |
aStream |
227 |
nextPutAll:(self className ? 'unnamed'); |
|
228 |
nextPutAll:'>>'; |
|
229 |
nextPutAll:(selector ? '?'); |
|
230 |
nextPutAll:' {'; |
|
231 |
nextPutAll:(methodCategory ? '?'); |
|
232 |
nextPutAll:'}' |
|
1512 | 233 |
|
1833
cf60e3c0087e
care for bad (nil) methodCategory
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
234 |
"Modified: / 04-10-2006 / 16:46:01 / cg" |
2170 | 235 |
"Modified: / 07-11-2008 / 08:29:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
779 | 236 |
! |
237 |
||
896 | 238 |
printWithoutClassNameOn:aStream |
239 |
(className endsWith:' class') ifTrue:[ |
|
240 |
aStream nextPutAll:'class ' |
|
241 |
]. |
|
242 |
aStream nextPutAll:selector |
|
243 |
! |
|
244 |
||
245 |
printWithoutOwningClassOn:aStream |
|
2022
a498c70c0aac
changed #printWithoutOwningClassOn:
Claus Gittinger <cg@exept.de>
parents:
2020
diff
changeset
|
246 |
self breakPoint:#cg. |
779 | 247 |
(className endsWith:' class') ifTrue:[ |
248 |
aStream nextPutAll:'class ' |
|
249 |
]. |
|
250 |
aStream nextPutAll:selector |
|
1845 | 251 |
! |
252 |
||
253 |
sourceForMethod |
|
2157 | 254 |
^ '(' , className , ' compiledMethodAt:' , selector asSymbol storeString, ')' |
1845 | 255 |
|
256 |
"Created: / 09-10-2006 / 13:58:09 / cg" |
|
0 | 257 |
! ! |
235 | 258 |
|
2130 | 259 |
!MethodChange methodsFor:'testing'! |
652 | 260 |
|
261 |
isMethodChange |
|
2130 | 262 |
"true if this is a method related change" |
263 |
||
652 | 264 |
^ true |
265 |
||
266 |
"Created: / 7.2.1998 / 19:26:59 / cg" |
|
2130 | 267 |
! |
268 |
||
2187 | 269 |
isMethodChangeForVersionMethod |
270 |
^ self isMethodCodeChange |
|
271 |
and:[ AbstractSourceCodeManager isVersionMethodSelector:self selector ] |
|
272 |
! |
|
273 |
||
2130 | 274 |
isMethodCodeChange |
275 |
"true if this is a method's code change (not package, category etc.)" |
|
276 |
||
277 |
^ self class == MethodChange |
|
652 | 278 |
! ! |
279 |
||
1325 | 280 |
!MethodChange::NamedMethodChange class methodsFor:'instance creation'! |
281 |
||
282 |
fromMethodChange:aMethodChange |
|
283 |
^ self new cloneInstanceVariablesFrom:aMethodChange |
|
284 |
! ! |
|
285 |
||
286 |
!MethodChange::NamedMethodChange methodsFor:'accessing'! |
|
287 |
||
288 |
changeName:something |
|
289 |
changeName := something. |
|
290 |
! ! |
|
291 |
||
292 |
!MethodChange::NamedMethodChange methodsFor:'printing & storing'! |
|
293 |
||
294 |
printOn:aStream |
|
295 |
changeName notNil ifTrue:[ |
|
296 |
changeName printOn:aStream. |
|
297 |
^ self. |
|
298 |
]. |
|
299 |
super printOn:aStream |
|
300 |
! ! |
|
301 |
||
235 | 302 |
!MethodChange class methodsFor:'documentation'! |
303 |
||
304 |
version |
|
2187 | 305 |
^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.52 2009-10-07 12:15:20 fm Exp $' |
306 |
! |
|
307 |
||
308 |
version_CVS |
|
309 |
^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.52 2009-10-07 12:15:20 fm Exp $' |
|
235 | 310 |
! ! |