author | Claus Gittinger <cg@exept.de> |
Fri, 31 Jan 2003 15:12:58 +0100 | |
changeset 1199 | 53f7de3f5c9b |
parent 1196 | 928f537ddeac |
child 1234 | 2edbb63a70b7 |
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 |
0 | 87 |
className := cls name. |
88 |
selector := sel. |
|
102
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
89 |
source := src. |
3f85fe87cc58
include category in methodChanges
Claus Gittinger <cg@exept.de>
parents:
85
diff
changeset
|
90 |
methodCategory := cat |
648 | 91 |
! |
92 |
||
654 | 93 |
className:clsName selector:sel source:src category:cat |
94 |
className := clsName. |
|
95 |
selector := sel. |
|
96 |
source := src. |
|
97 |
methodCategory := cat |
|
98 |
||
99 |
"Created: / 16.2.1998 / 12:29:49 / cg" |
|
100 |
! |
|
101 |
||
102 |
className:clsName selector:sel source:src category:cat privacy:priv |
|
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 |
114 |
^ methodCategory |
|
115 |
||
116 |
"Created: / 7.2.1998 / 19:47:53 / cg" |
|
117 |
! |
|
118 |
||
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
119 |
previousVersion |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
120 |
"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
|
121 |
|
1073 | 122 |
^ previousVersion |
123 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
124 |
|
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
125 |
previousVersion:something |
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
126 |
"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
|
127 |
|
1073 | 128 |
previousVersion := something. |
129 |
! |
|
956
0c6c209df4e9
keep previousVersion of method in changeSet
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
130 |
|
648 | 131 |
selector |
132 |
^ selector |
|
133 |
||
134 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
911 | 135 |
! |
136 |
||
137 |
selector:aSymbol |
|
138 |
selector := aSymbol |
|
139 |
||
140 |
"Created: / 6.2.1998 / 13:29:25 / cg" |
|
0 | 141 |
! ! |
142 |
||
849 | 143 |
!MethodChange methodsFor:'applying'! |
144 |
||
145 |
apply |
|
146 |
"apply the change" |
|
147 |
||
148 |
|class| |
|
149 |
||
1196 | 150 |
class := Smalltalk classNamed:self className. |
151 |
class isNil ifTrue:[ |
|
152 |
class := Parser evaluate:self className |
|
153 |
]. |
|
849 | 154 |
class compile:source classified:methodCategory logged:true. |
155 |
! ! |
|
156 |
||
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
157 |
!MethodChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
158 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
159 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
160 |
"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
|
161 |
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
|
162 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
163 |
"/ 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
|
164 |
changeB isMethodChange ifFalse:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
165 |
|
1199 | 166 |
selector ~= changeB selector ifTrue:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
167 |
className ~= changeB className ifTrue:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
168 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
169 |
^ true |
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 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
172 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
173 |
"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
|
174 |
|
798 | 175 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
176 |
^ self sameSourceAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
177 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
178 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
179 |
|
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 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
182 |
|
963 | 183 |
!MethodChange methodsFor:'printing & storing'! |
0 | 184 |
|
7 | 185 |
printOn:aStream |
800 | 186 |
"append a user printed representation of the receiver to aStream. |
187 |
The format is suitable for a human - not meant to be read back." |
|
188 |
||
1196 | 189 |
aStream nextPutAll:self className; |
800 | 190 |
space; |
191 |
nextPutAll:selector |
|
779 | 192 |
! |
193 |
||
896 | 194 |
printWithoutClassNameOn:aStream |
195 |
(className endsWith:' class') ifTrue:[ |
|
196 |
aStream nextPutAll:'class ' |
|
197 |
]. |
|
198 |
aStream nextPutAll:selector |
|
199 |
! |
|
200 |
||
201 |
printWithoutOwningClassOn:aStream |
|
202 |
self halt. |
|
779 | 203 |
(className endsWith:' class') ifTrue:[ |
204 |
aStream nextPutAll:'class ' |
|
205 |
]. |
|
206 |
aStream nextPutAll:selector |
|
0 | 207 |
! ! |
235 | 208 |
|
652 | 209 |
!MethodChange methodsFor:'queries'! |
210 |
||
211 |
isMethodChange |
|
212 |
^ true |
|
213 |
||
214 |
"Created: / 7.2.1998 / 19:26:59 / cg" |
|
215 |
! ! |
|
216 |
||
235 | 217 |
!MethodChange class methodsFor:'documentation'! |
218 |
||
219 |
version |
|
1199 | 220 |
^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.30 2003-01-31 14:12:58 cg Exp $' |
235 | 221 |
! ! |