author | Claus Gittinger <cg@exept.de> |
Sun, 07 Jul 2019 23:42:57 +0200 | |
changeset 4453 | 5e6ad8c5a97e |
parent 4268 | 84291a251c17 |
permissions | -rw-r--r-- |
25 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
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 |
" |
|
957 | 12 |
"{ Package: 'stx:libbasic3' }" |
13 |
||
3984 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
15 | 16 |
MethodChange subclass:#MethodCategoryChange |
2873 | 17 |
instanceVariableNames:'origin' |
235 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'System-Changes' |
|
15 | 21 |
! |
22 |
||
25 | 23 |
!MethodCategoryChange class methodsFor:'documentation'! |
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
45 | 39 |
documentation |
40 |
" |
|
41 |
instances represent method-category changes (as done in the browser). |
|
42 |
They are typically held in a ChangeSet. |
|
235 | 43 |
|
2873 | 44 |
Change origin. |
45 |
||
46 |
When a changeset diff is generated, two MethodChanges that |
|
47 |
represent the same method (code is the same) might differ only in |
|
48 |
category/ Such changes are transformed to MethodCategoruChanges. |
|
49 |
In that case, origin keeps the reference to original MethodChange. |
|
50 |
||
235 | 51 |
[author:] |
52 |
Claus Gittinger |
|
2873 | 53 |
Jan Vrany |
54 |
||
55 |
[instance variables:] |
|
56 |
origin <MethodChange> Change that cause this category |
|
57 |
change to be created. See comment. |
|
58 |
||
59 |
||
45 | 60 |
" |
25 | 61 |
! ! |
62 |
||
3984 | 63 |
!MethodCategoryChange class methodsFor:'instance creation'! |
64 |
||
65 |
class:cls selector:sel category:cat |
|
66 |
^ self basicNew class:cls selector:sel category:cat |
|
67 |
||
68 |
||
3986 | 69 |
! |
3984 | 70 |
|
3986 | 71 |
className:clsName selector:sel category:cat |
72 |
^ self basicNew className:clsName selector:sel category:cat |
|
2873 | 73 |
|
3986 | 74 |
"Created: / 12-11-2006 / 15:54:25 / cg" |
2873 | 75 |
! ! |
76 |
||
15 | 77 |
!MethodCategoryChange methodsFor:'accessing'! |
78 |
||
79 |
class:cls selector:sel category:cat |
|
1902
20db5f942dbd
changed #class:selector:category:
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
80 |
self className:cls name selector:sel category:cat |
15 | 81 |
|
1902
20db5f942dbd
changed #class:selector:category:
Claus Gittinger <cg@exept.de>
parents:
1846
diff
changeset
|
82 |
"Modified: / 12-11-2006 / 15:55:11 / cg" |
85 | 83 |
! |
84 |
||
654 | 85 |
className:clsName selector:sel category:cat |
86 |
className := clsName. |
|
87 |
selector := sel. |
|
852 | 88 |
methodCategory := cat |
654 | 89 |
|
90 |
"Created: / 16.2.1998 / 14:14:16 / cg" |
|
91 |
! |
|
92 |
||
2873 | 93 |
origin |
94 |
^ origin |
|
95 |
! |
|
96 |
||
97 |
origin:aMethodChange |
|
98 |
origin := aMethodChange. |
|
99 |
! |
|
100 |
||
1052 | 101 |
prettyPrintedSource |
1846 | 102 |
^ self sourceForMethod, Character cr |
1052 | 103 |
, ' category:' , methodCategory storeString |
1846 | 104 |
|
105 |
"Modified: / 09-10-2006 / 13:59:15 / cg" |
|
1052 | 106 |
! |
107 |
||
85 | 108 |
source |
1846 | 109 |
^ self sourceForMethod , ' category:' , methodCategory storeString |
852 | 110 |
|
1846 | 111 |
"Modified: / 09-10-2006 / 13:59:10 / cg" |
2873 | 112 |
! |
113 |
||
114 |
source: aString |
|
115 |
| expr | |
|
116 |
||
117 |
expr := Parser parseExpression: aString onError: [ self error: 'Invalid source']. |
|
118 |
expr isMessage ifFalse:[ self error: 'Invalid source' ]. |
|
119 |
expr selector == #'category:' ifFalse:[ self error: 'Invalid source' ]. |
|
120 |
methodCategory := expr arguments first value. |
|
121 |
||
122 |
"Created: / 20-03-2012 / 22:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
852 | 123 |
! ! |
124 |
||
125 |
!MethodCategoryChange methodsFor:'applying'! |
|
126 |
||
127 |
apply |
|
128 |
"apply the change" |
|
85 | 129 |
|
1915
d23534c8ab03
the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
130 |
|mthd| |
852 | 131 |
|
132 |
mthd := self changeMethod. |
|
1915
d23534c8ab03
the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
133 |
mthd category:methodCategory asSymbol. |
852 | 134 |
|
1915
d23534c8ab03
the method does the change-file-update; NOT me
Claus Gittinger <cg@exept.de>
parents:
1902
diff
changeset
|
135 |
"Modified: / 23-11-2006 / 16:59:09 / cg" |
15 | 136 |
! ! |
137 |
||
4268 | 138 |
!MethodCategoryChange methodsFor:'fileout'! |
139 |
||
140 |
fileOutOn: aStream |
|
141 |
selector isNil ifTrue:[ |
|
142 |
Transcript show:'missing selector in method category change: '. |
|
143 |
Transcript showCR:self. |
|
144 |
^ self |
|
145 |
]. |
|
146 |
self removed ifFalse:[self basicFileOutOn: aStream] |
|
147 |
||
148 |
"Created: / 30-11-2017 / 13:02:57 / cg" |
|
149 |
! ! |
|
150 |
||
2131 | 151 |
!MethodCategoryChange methodsFor:'testing'! |
964
64282b5e5c48
added #isMEthodCategoryChange
Claus Gittinger <cg@exept.de>
parents:
957
diff
changeset
|
152 |
|
64282b5e5c48
added #isMEthodCategoryChange
Claus Gittinger <cg@exept.de>
parents:
957
diff
changeset
|
153 |
isMethodCategoryChange |
64282b5e5c48
added #isMEthodCategoryChange
Claus Gittinger <cg@exept.de>
parents:
957
diff
changeset
|
154 |
^ true |
2263 | 155 |
! |
156 |
||
157 |
isMethodCodeChange |
|
158 |
"true if this is a method's code change (not package, category etc.)" |
|
159 |
||
160 |
^ false |
|
964
64282b5e5c48
added #isMEthodCategoryChange
Claus Gittinger <cg@exept.de>
parents:
957
diff
changeset
|
161 |
! ! |
64282b5e5c48
added #isMEthodCategoryChange
Claus Gittinger <cg@exept.de>
parents:
957
diff
changeset
|
162 |
|
2622
853e24f6b303
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
163 |
!MethodCategoryChange methodsFor:'visiting'! |
853e24f6b303
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
164 |
|
853e24f6b303
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
165 |
acceptChangeVisitor:aVisitor |
853e24f6b303
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
166 |
^ aVisitor visitMethodCategoryChange:self. |
853e24f6b303
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
167 |
|
853e24f6b303
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
168 |
"Created: / 25-11-2011 / 17:13:58 / cg" |
853e24f6b303
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
169 |
! ! |
853e24f6b303
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2263
diff
changeset
|
170 |
|
235 | 171 |
!MethodCategoryChange class methodsFor:'documentation'! |
172 |
||
173 |
version |
|
3984 | 174 |
^ '$Header$' |
2263 | 175 |
! |
176 |
||
3986 | 177 |
version_CVS |
178 |
^ '$Header$' |
|
179 |
! |
|
180 |
||
2873 | 181 |
version_SVN |
3984 | 182 |
^ '$Id$' |
235 | 183 |
! ! |
3984 | 184 |