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