author | Stefan Vogel <sv@exept.de> |
Mon, 20 Oct 2008 12:43:51 +0200 | |
changeset 2020 | 5b3af99a4829 |
parent 1845 | 6fdd21eba549 |
child 2022 | a498c70c0aac |
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 |
||
102
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
56 |
class:cls selector:sel source:src category:cat |
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
57 |
^ self basicNew class:cls selector:sel source:src category:cat |
1073 | 58 |
! |
59 |
||
60 |
className:clsName selector:sel source:src category:cat |
|
61 |
^ self basicNew className:clsName selector:sel source:src category:cat |
|
0 | 62 |
! ! |
63 |
||
64 |
!MethodChange methodsFor:'accessing'! |
|
65 |
||
1073 | 66 |
category |
67 |
^ methodCategory |
|
68 |
! |
|
69 |
||
911 | 70 |
category: aCategory |
71 |
methodCategory := aCategory |
|
72 |
||
73 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
74 |
! |
|
75 |
||
852 | 76 |
changeMethod |
77 |
|cls| |
|
78 |
||
79 |
cls := self changeClass. |
|
80 |
cls isNil ifTrue:[^ nil]. |
|
81 |
^ cls compiledMethodAt:selector |
|
82 |
||
83 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
84 |
! |
|
85 |
||
850 | 86 |
changeSelector |
87 |
^ selector |
|
88 |
||
89 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
90 |
! |
|
91 |
||
102
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
92 |
class:cls selector:sel source:src category:cat |
1288 | 93 |
self className:(cls name) selector:sel source:src category:cat |
648 | 94 |
! |
95 |
||
654 | 96 |
className:clsName selector:sel source:src category:cat |
1288 | 97 |
self className:clsName selector:sel source:src category:cat privacy:nil |
654 | 98 |
! |
99 |
||
100 |
className:clsName selector:sel source:src category:cat privacy:priv |
|
1468 | 101 |
self assert:(src isString). |
1288 | 102 |
|
654 | 103 |
className := clsName. |
104 |
selector := sel. |
|
105 |
source := src. |
|
106 |
methodCategory := cat. |
|
107 |
privacy := priv. |
|
108 |
||
109 |
"Created: / 16.2.1998 / 12:29:49 / cg" |
|
110 |
"Modified: / 16.2.1998 / 14:28:12 / cg" |
|
111 |
! |
|
112 |
||
652 | 113 |
methodCategory |
1234 | 114 |
|
652 | 115 |
^ methodCategory |
116 |
||
117 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
118 |
! |
|
119 |
||
1234 | 120 |
previousPackage |
121 |
| isNewMethod | |
|
122 |
isNewMethod := self previousVersion isNil. |
|
123 |
isNewMethod ifFalse:[ |
|
124 |
^ self previousVersion package. |
|
125 |
]. |
|
126 |
||
127 |
^ nil |
|
128 |
! |
|
129 |
||
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
130 |
previousVersion |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
131 |
"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
|
132 |
|
1073 | 133 |
^ previousVersion |
134 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
135 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
136 |
previousVersion:something |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
137 |
"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
|
138 |
|
1073 | 139 |
previousVersion := something. |
140 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
141 |
|
1234 | 142 |
previousVersionSource |
143 |
"return the value of the instance variable 'previousVersion' (automatically generated)" |
|
144 |
||
145 |
previousVersion isNil ifTrue:[^ nil]. |
|
146 |
^ previousVersion source |
|
147 |
! |
|
148 |
||
648 | 149 |
selector |
150 |
^ selector |
|
151 |
||
152 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
911 | 153 |
! |
154 |
||
155 |
selector:aSymbol |
|
156 |
selector := aSymbol |
|
157 |
||
158 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
0 | 159 |
! ! |
160 |
||
849 | 161 |
!MethodChange methodsFor:'applying'! |
162 |
||
163 |
apply |
|
164 |
"apply the change" |
|
165 |
||
2020
5b3af99a4829
changed #apply: use #applyChange
Stefan Vogel <sv@exept.de>
parents:
1845
diff
changeset
|
166 |
|class| |
1322 | 167 |
|
2020
5b3af99a4829
changed #apply: use #applyChange
Stefan Vogel <sv@exept.de>
parents:
1845
diff
changeset
|
168 |
class := self changeClass. |
1196 | 169 |
class isNil ifTrue:[ |
2020
5b3af99a4829
changed #apply: use #applyChange
Stefan Vogel <sv@exept.de>
parents:
1845
diff
changeset
|
170 |
self error:('Cannot apply change for missing class: ' , className). |
1196 | 171 |
]. |
849 | 172 |
class compile:source classified:methodCategory logged:true. |
173 |
! ! |
|
174 |
||
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
175 |
!MethodChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
176 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
177 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
178 |
"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
|
179 |
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
|
180 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
181 |
"/ 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
|
182 |
changeB isMethodChange ifFalse:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
183 |
|
1199 | 184 |
selector ~= changeB selector ifTrue:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
185 |
className ~= changeB className ifTrue:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
186 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
187 |
^ true |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
188 |
! |
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 |
sameAs: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 the same change as the receiver." |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
192 |
|
798 | 193 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
1509 | 194 |
(self sameSourceAs:changeB) ifTrue:[^ true]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
195 |
|
1509 | 196 |
^ false. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
197 |
|
1509 | 198 |
"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
|
199 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
200 |
|
1325 | 201 |
!MethodChange methodsFor:'converting'! |
202 |
||
203 |
asNamedMethodChange |
|
204 |
^ NamedMethodChange fromMethodChange:self |
|
205 |
! ! |
|
206 |
||
963 | 207 |
!MethodChange methodsFor:'printing & storing'! |
0 | 208 |
|
7 | 209 |
printOn:aStream |
800 | 210 |
"append a user printed representation of the receiver to aStream. |
211 |
The format is suitable for a human - not meant to be read back." |
|
212 |
||
1325 | 213 |
aStream |
1512 | 214 |
nextPutAll:(self className ? 'unnamed'); |
1325 | 215 |
space; |
1474
08052118490e
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1468
diff
changeset
|
216 |
nextPutAll:(selector ? '?'); |
1394 | 217 |
nextPutAll:' {'; |
1833
cf60e3c0087e
care for bad (nil) methodCategory
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
218 |
nextPutAll:(methodCategory ? '?'); |
1512 | 219 |
nextPutAll:'}' |
220 |
||
1833
cf60e3c0087e
care for bad (nil) methodCategory
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
221 |
"Modified: / 04-10-2006 / 16:46:01 / cg" |
779 | 222 |
! |
223 |
||
896 | 224 |
printWithoutClassNameOn:aStream |
225 |
(className endsWith:' class') ifTrue:[ |
|
226 |
aStream nextPutAll:'class ' |
|
227 |
]. |
|
228 |
aStream nextPutAll:selector |
|
229 |
! |
|
230 |
||
231 |
printWithoutOwningClassOn:aStream |
|
232 |
self halt. |
|
779 | 233 |
(className endsWith:' class') ifTrue:[ |
234 |
aStream nextPutAll:'class ' |
|
235 |
]. |
|
236 |
aStream nextPutAll:selector |
|
1845 | 237 |
! |
238 |
||
239 |
sourceForMethod |
|
240 |
^ '(' , className , ' compiledMethodAt:#' , selector storeString, ')' |
|
241 |
||
242 |
"Created: / 09-10-2006 / 13:58:09 / cg" |
|
0 | 243 |
! ! |
235 | 244 |
|
652 | 245 |
!MethodChange methodsFor:'queries'! |
246 |
||
247 |
isMethodChange |
|
248 |
^ true |
|
249 |
||
250 |
"Created: / 7.2.1998 / 19:26:59 / cg" |
|
251 |
! ! |
|
252 |
||
1325 | 253 |
!MethodChange::NamedMethodChange class methodsFor:'instance creation'! |
254 |
||
255 |
fromMethodChange:aMethodChange |
|
256 |
^ self new cloneInstanceVariablesFrom:aMethodChange |
|
257 |
! ! |
|
258 |
||
259 |
!MethodChange::NamedMethodChange methodsFor:'accessing'! |
|
260 |
||
261 |
changeName:something |
|
262 |
changeName := something. |
|
263 |
! ! |
|
264 |
||
265 |
!MethodChange::NamedMethodChange methodsFor:'printing & storing'! |
|
266 |
||
267 |
printOn:aStream |
|
268 |
changeName notNil ifTrue:[ |
|
269 |
changeName printOn:aStream. |
|
270 |
^ self. |
|
271 |
]. |
|
272 |
super printOn:aStream |
|
273 |
! ! |
|
274 |
||
235 | 275 |
!MethodChange class methodsFor:'documentation'! |
276 |
||
277 |
version |
|
2020
5b3af99a4829
changed #apply: use #applyChange
Stefan Vogel <sv@exept.de>
parents:
1845
diff
changeset
|
278 |
^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.45 2008-10-20 10:43:51 stefan Exp $' |
235 | 279 |
! ! |