author | Claus Gittinger <cg@exept.de> |
Fri, 12 Sep 2003 22:56:42 +0200 | |
changeset 1325 | b874a070362e |
parent 1322 | 8ff0023c7694 |
child 1394 | 392398eeac68 |
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 |
" |
|
0 | 12 |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
13 |
"{ Package: 'stx:libbasic3' }" |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
14 |
|
0 | 15 |
ClassChange subclass:#MethodChange |
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
16 |
instanceVariableNames:'selector methodCategory privacy previousVersion' |
235 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'System-Changes' |
|
0 | 20 |
! |
21 |
||
1325 | 22 |
MethodChange subclass:#NamedMethodChange |
23 |
instanceVariableNames:'changeName' |
|
24 |
classVariableNames:'' |
|
25 |
poolDictionaries:'' |
|
26 |
privateIn:MethodChange |
|
27 |
! |
|
28 |
||
25 | 29 |
!MethodChange class methodsFor:'documentation'! |
30 |
||
31 |
copyright |
|
32 |
" |
|
33 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
34 |
All Rights Reserved |
|
10 | 35 |
|
25 | 36 |
This software is furnished under a license and may be used |
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
44 |
||
45 | 45 |
documentation |
46 |
" |
|
47 |
instances represent method-changes (as done in the browser). |
|
48 |
They are typically held in a ChangeSet. |
|
235 | 49 |
|
50 |
[author:] |
|
51 |
Claus Gittinger |
|
45 | 52 |
" |
25 | 53 |
! ! |
10 | 54 |
|
0 | 55 |
!MethodChange class methodsFor:'instance creation'! |
56 |
||
102
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
57 |
class:cls selector:sel source:src category:cat |
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
58 |
^ self basicNew class:cls selector:sel source:src category:cat |
1073 | 59 |
! |
60 |
||
61 |
className:clsName selector:sel source:src category:cat |
|
62 |
^ self basicNew className:clsName selector:sel source:src category:cat |
|
0 | 63 |
! ! |
64 |
||
65 |
!MethodChange methodsFor:'accessing'! |
|
66 |
||
1073 | 67 |
category |
68 |
^ methodCategory |
|
69 |
! |
|
70 |
||
911 | 71 |
category: aCategory |
72 |
methodCategory := aCategory |
|
73 |
||
74 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
75 |
! |
|
76 |
||
852 | 77 |
changeMethod |
78 |
|cls| |
|
79 |
||
80 |
cls := self changeClass. |
|
81 |
cls isNil ifTrue:[^ nil]. |
|
82 |
^ cls compiledMethodAt:selector |
|
83 |
||
84 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
85 |
! |
|
86 |
||
850 | 87 |
changeSelector |
88 |
^ selector |
|
89 |
||
90 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
91 |
! |
|
92 |
||
102
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
93 |
class:cls selector:sel source:src category:cat |
1288 | 94 |
self className:(cls name) selector:sel source:src category:cat |
648 | 95 |
! |
96 |
||
654 | 97 |
className:clsName selector:sel source:src category:cat |
1288 | 98 |
self className:clsName selector:sel source:src category:cat privacy:nil |
654 | 99 |
! |
100 |
||
101 |
className:clsName selector:sel source:src category:cat privacy:priv |
|
1288 | 102 |
src isString ifFalse:[self halt]. |
103 |
||
654 | 104 |
className := clsName. |
105 |
selector := sel. |
|
106 |
source := src. |
|
107 |
methodCategory := cat. |
|
108 |
privacy := priv. |
|
109 |
||
110 |
"Created: / 16.2.1998 / 12:29:49 / cg" |
|
111 |
"Modified: / 16.2.1998 / 14:28:12 / cg" |
|
112 |
! |
|
113 |
||
652 | 114 |
methodCategory |
1234 | 115 |
|
652 | 116 |
^ methodCategory |
117 |
||
118 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
119 |
! |
|
120 |
||
1234 | 121 |
previousPackage |
122 |
| isNewMethod | |
|
123 |
isNewMethod := self previousVersion isNil. |
|
124 |
isNewMethod ifFalse:[ |
|
125 |
^ self previousVersion package. |
|
126 |
]. |
|
127 |
||
128 |
^ nil |
|
129 |
! |
|
130 |
||
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
131 |
previousVersion |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
132 |
"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
|
133 |
|
1073 | 134 |
^ previousVersion |
135 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
136 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
137 |
previousVersion:something |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
138 |
"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
|
139 |
|
1073 | 140 |
previousVersion := something. |
141 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
142 |
|
1234 | 143 |
previousVersionSource |
144 |
"return the value of the instance variable 'previousVersion' (automatically generated)" |
|
145 |
||
146 |
previousVersion isNil ifTrue:[^ nil]. |
|
147 |
^ previousVersion source |
|
148 |
! |
|
149 |
||
648 | 150 |
selector |
151 |
^ selector |
|
152 |
||
153 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
911 | 154 |
! |
155 |
||
156 |
selector:aSymbol |
|
157 |
selector := aSymbol |
|
158 |
||
159 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
0 | 160 |
! ! |
161 |
||
849 | 162 |
!MethodChange methodsFor:'applying'! |
163 |
||
164 |
apply |
|
165 |
"apply the change" |
|
166 |
||
1322 | 167 |
|className class| |
168 |
||
169 |
className := self className. |
|
1296
60bdb70db933
handle Ns.Class syntax (vw fileIn)
Claus Gittinger <cg@exept.de>
parents:
1288
diff
changeset
|
170 |
|
1322 | 171 |
class := Smalltalk classNamed:className. |
1196 | 172 |
class isNil ifTrue:[ |
1322 | 173 |
class := Parser evaluate:className |
1296
60bdb70db933
handle Ns.Class syntax (vw fileIn)
Claus Gittinger <cg@exept.de>
parents:
1288
diff
changeset
|
174 |
]. |
60bdb70db933
handle Ns.Class syntax (vw fileIn)
Claus Gittinger <cg@exept.de>
parents:
1288
diff
changeset
|
175 |
class isNil ifTrue:[ |
1322 | 176 |
self error:('Cannot apply change for missing class: ' , className). |
1196 | 177 |
]. |
849 | 178 |
class compile:source classified:methodCategory logged:true. |
179 |
! ! |
|
180 |
||
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
181 |
!MethodChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
182 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
183 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
184 |
"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
|
185 |
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
|
186 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
187 |
"/ 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
|
188 |
changeB isMethodChange ifFalse:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
189 |
|
1199 | 190 |
selector ~= changeB selector ifTrue:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
191 |
className ~= changeB className ifTrue:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
192 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
193 |
^ true |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
194 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
195 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
196 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
197 |
"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
|
198 |
|
798 | 199 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
200 |
^ self sameSourceAs:changeB |
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 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
204 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
205 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
206 |
|
1325 | 207 |
!MethodChange methodsFor:'converting'! |
208 |
||
209 |
asNamedMethodChange |
|
210 |
^ NamedMethodChange fromMethodChange:self |
|
211 |
! ! |
|
212 |
||
963 | 213 |
!MethodChange methodsFor:'printing & storing'! |
0 | 214 |
|
7 | 215 |
printOn:aStream |
800 | 216 |
"append a user printed representation of the receiver to aStream. |
217 |
The format is suitable for a human - not meant to be read back." |
|
218 |
||
1325 | 219 |
aStream |
220 |
nextPutAll:self className; |
|
221 |
space; |
|
222 |
nextPutAll:selector |
|
779 | 223 |
! |
224 |
||
896 | 225 |
printWithoutClassNameOn:aStream |
226 |
(className endsWith:' class') ifTrue:[ |
|
227 |
aStream nextPutAll:'class ' |
|
228 |
]. |
|
229 |
aStream nextPutAll:selector |
|
230 |
! |
|
231 |
||
232 |
printWithoutOwningClassOn:aStream |
|
233 |
self halt. |
|
779 | 234 |
(className endsWith:' class') ifTrue:[ |
235 |
aStream nextPutAll:'class ' |
|
236 |
]. |
|
237 |
aStream nextPutAll:selector |
|
0 | 238 |
! ! |
235 | 239 |
|
652 | 240 |
!MethodChange methodsFor:'queries'! |
241 |
||
242 |
isMethodChange |
|
243 |
^ true |
|
244 |
||
245 |
"Created: / 7.2.1998 / 19:26:59 / cg" |
|
246 |
! ! |
|
247 |
||
1325 | 248 |
!MethodChange::NamedMethodChange class methodsFor:'instance creation'! |
249 |
||
250 |
fromMethodChange:aMethodChange |
|
251 |
^ self new cloneInstanceVariablesFrom:aMethodChange |
|
252 |
! ! |
|
253 |
||
254 |
!MethodChange::NamedMethodChange methodsFor:'accessing'! |
|
255 |
||
256 |
changeName:something |
|
257 |
changeName := something. |
|
258 |
! ! |
|
259 |
||
260 |
!MethodChange::NamedMethodChange methodsFor:'printing & storing'! |
|
261 |
||
262 |
printOn:aStream |
|
263 |
changeName notNil ifTrue:[ |
|
264 |
changeName printOn:aStream. |
|
265 |
^ self. |
|
266 |
]. |
|
267 |
super printOn:aStream |
|
268 |
! ! |
|
269 |
||
235 | 270 |
!MethodChange class methodsFor:'documentation'! |
271 |
||
272 |
version |
|
1325 | 273 |
^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.36 2003-09-12 20:56:42 cg Exp $' |
235 | 274 |
! ! |