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