author | Claus Gittinger <cg@exept.de> |
Wed, 04 Oct 2006 17:29:29 +0200 | |
changeset 1833 | cf60e3c0087e |
parent 1512 | 2a7a41afb1e2 |
child 1845 | 6fdd21eba549 |
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 |
||
1322 | 166 |
|className class| |
167 |
||
168 |
className := self className. |
|
1296
60bdb70db933
handle Ns.Class syntax (vw fileIn)
Claus Gittinger <cg@exept.de>
parents:
1288
diff
changeset
|
169 |
|
1322 | 170 |
class := Smalltalk classNamed:className. |
1196 | 171 |
class isNil ifTrue:[ |
1487 | 172 |
class := Parser evaluate:className. |
173 |
class isNil ifTrue:[ |
|
174 |
(className startsWith:'Root::') ifTrue:[ |
|
175 |
className := className copyFrom:7. |
|
176 |
class := Smalltalk classNamed:className. |
|
177 |
class isNil ifTrue:[ |
|
178 |
class := Parser evaluate:className |
|
179 |
] |
|
180 |
] ifFalse:[ |
|
181 |
(className startsWith:'Core.') ifTrue:[ |
|
182 |
className := className copyFrom:6. |
|
183 |
class := Smalltalk classNamed:className. |
|
184 |
class isNil ifTrue:[ |
|
185 |
class := Parser evaluate:className |
|
186 |
] |
|
187 |
]. |
|
188 |
]. |
|
189 |
class isNil ifTrue:[ |
|
190 |
(className startsWith:'Smalltalk.') ifTrue:[ |
|
191 |
className := className copyFrom:11. |
|
192 |
class := Smalltalk classNamed:className. |
|
193 |
class isNil ifTrue:[ |
|
194 |
class := Parser evaluate:className |
|
195 |
] |
|
196 |
]. |
|
197 |
]. |
|
198 |
class := Parser evaluate:className. |
|
199 |
class isNil ifTrue:[ |
|
200 |
self error:('Cannot apply change for missing class: ' , className). |
|
201 |
]. |
|
202 |
]. |
|
1196 | 203 |
]. |
849 | 204 |
class compile:source classified:methodCategory logged:true. |
205 |
! ! |
|
206 |
||
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
207 |
!MethodChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
208 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
209 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
210 |
"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
|
211 |
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
|
212 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
213 |
"/ 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
|
214 |
changeB isMethodChange ifFalse:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
215 |
|
1199 | 216 |
selector ~= changeB selector ifTrue:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
217 |
className ~= changeB className ifTrue:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
218 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
219 |
^ true |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
220 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
221 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
222 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
223 |
"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
|
224 |
|
798 | 225 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
1509 | 226 |
(self sameSourceAs:changeB) ifTrue:[^ true]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
227 |
|
1509 | 228 |
^ false. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
229 |
|
1509 | 230 |
"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
|
231 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
232 |
|
1325 | 233 |
!MethodChange methodsFor:'converting'! |
234 |
||
235 |
asNamedMethodChange |
|
236 |
^ NamedMethodChange fromMethodChange:self |
|
237 |
! ! |
|
238 |
||
963 | 239 |
!MethodChange methodsFor:'printing & storing'! |
0 | 240 |
|
7 | 241 |
printOn:aStream |
800 | 242 |
"append a user printed representation of the receiver to aStream. |
243 |
The format is suitable for a human - not meant to be read back." |
|
244 |
||
1325 | 245 |
aStream |
1512 | 246 |
nextPutAll:(self className ? 'unnamed'); |
1325 | 247 |
space; |
1474
08052118490e
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1468
diff
changeset
|
248 |
nextPutAll:(selector ? '?'); |
1394 | 249 |
nextPutAll:' {'; |
1833
cf60e3c0087e
care for bad (nil) methodCategory
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
250 |
nextPutAll:(methodCategory ? '?'); |
1512 | 251 |
nextPutAll:'}' |
252 |
||
1833
cf60e3c0087e
care for bad (nil) methodCategory
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
253 |
"Modified: / 04-10-2006 / 16:46:01 / cg" |
779 | 254 |
! |
255 |
||
896 | 256 |
printWithoutClassNameOn:aStream |
257 |
(className endsWith:' class') ifTrue:[ |
|
258 |
aStream nextPutAll:'class ' |
|
259 |
]. |
|
260 |
aStream nextPutAll:selector |
|
261 |
! |
|
262 |
||
263 |
printWithoutOwningClassOn:aStream |
|
264 |
self halt. |
|
779 | 265 |
(className endsWith:' class') ifTrue:[ |
266 |
aStream nextPutAll:'class ' |
|
267 |
]. |
|
268 |
aStream nextPutAll:selector |
|
0 | 269 |
! ! |
235 | 270 |
|
652 | 271 |
!MethodChange methodsFor:'queries'! |
272 |
||
273 |
isMethodChange |
|
274 |
^ true |
|
275 |
||
276 |
"Created: / 7.2.1998 / 19:26:59 / cg" |
|
277 |
! ! |
|
278 |
||
1325 | 279 |
!MethodChange::NamedMethodChange class methodsFor:'instance creation'! |
280 |
||
281 |
fromMethodChange:aMethodChange |
|
282 |
^ self new cloneInstanceVariablesFrom:aMethodChange |
|
283 |
! ! |
|
284 |
||
285 |
!MethodChange::NamedMethodChange methodsFor:'accessing'! |
|
286 |
||
287 |
changeName:something |
|
288 |
changeName := something. |
|
289 |
! ! |
|
290 |
||
291 |
!MethodChange::NamedMethodChange methodsFor:'printing & storing'! |
|
292 |
||
293 |
printOn:aStream |
|
294 |
changeName notNil ifTrue:[ |
|
295 |
changeName printOn:aStream. |
|
296 |
^ self. |
|
297 |
]. |
|
298 |
super printOn:aStream |
|
299 |
! ! |
|
300 |
||
235 | 301 |
!MethodChange class methodsFor:'documentation'! |
302 |
||
303 |
version |
|
1833
cf60e3c0087e
care for bad (nil) methodCategory
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
304 |
^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.43 2006-10-04 15:29:29 cg Exp $' |
235 | 305 |
! ! |