author | Stefan Vogel <sv@exept.de> |
Wed, 10 Apr 2013 10:58:10 +0200 | |
changeset 3205 | 5d3a00da5f5a |
parent 3203 | 2639572248b5 |
child 3210 | ab1729c084da |
permissions | -rw-r--r-- |
3 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
85 | 3 |
All Rights Reserved |
3 | 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 |
||
0 | 14 |
ClassChange subclass:#ClassDefinitionChange |
2316 | 15 |
instanceVariableNames:'objectType superClassName classType indexedType otherParameters |
16 |
instanceVariableNames classVariableNames |
|
1854 | 17 |
classInstanceVariableNames poolDictionaries category private |
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
18 |
definitionSelector owningClassName' |
235 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'System-Changes' |
|
0 | 22 |
! |
23 |
||
9 | 24 |
!ClassDefinitionChange class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
38 | 29 |
All Rights Reserved |
9 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
1162 | 42 |
instances represent class definition-changes. |
43 |
They are typically held in a ChangeSet. |
|
235 | 44 |
|
45 |
[author:] |
|
46 |
Claus Gittinger |
|
9 | 47 |
" |
100 | 48 |
! ! |
49 |
||
2876 | 50 |
!ClassDefinitionChange class methodsFor:'others'! |
51 |
||
52 |
version_CVS |
|
3205 | 53 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.78 2013-04-10 08:58:10 stefan Exp $' |
2876 | 54 |
! ! |
55 |
||
911 | 56 |
!ClassDefinitionChange methodsFor:'accessing'! |
57 |
||
1434 | 58 |
basicSuperClassName |
59 |
^ superClassName |
|
60 |
! |
|
61 |
||
1427 | 62 |
category |
1854 | 63 |
category isNil ifTrue:[ |
64 |
self setupFromSource. |
|
65 |
]. |
|
1427 | 66 |
^ category |
1854 | 67 |
|
68 |
"Modified: / 11-10-2006 / 14:12:01 / cg" |
|
1427 | 69 |
! |
70 |
||
1178 | 71 |
category:something |
72 |
category := something. |
|
73 |
! |
|
74 |
||
1427 | 75 |
classInstanceVariableNames |
76 |
^ classInstanceVariableNames |
|
77 |
! |
|
78 |
||
79 |
classInstanceVariableNames:something |
|
80 |
classInstanceVariableNames := something. |
|
81 |
! |
|
82 |
||
83 |
classVariableNames |
|
84 |
^ classVariableNames |
|
85 |
! |
|
86 |
||
87 |
classVariableNames:something |
|
88 |
classVariableNames := something. |
|
89 |
! |
|
90 |
||
2368 | 91 |
delta |
3139
c6eb068647cc
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3111
diff
changeset
|
92 |
| class | |
2368 | 93 |
|
94 |
class := self changeClass. |
|
95 |
class ifNil:[^#+]. |
|
3139
c6eb068647cc
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3111
diff
changeset
|
96 |
|
2504 | 97 |
^(self class isSource: self source sameSourceAs: class definitionWithoutPackage "definition") |
2368 | 98 |
ifTrue:[#=] |
99 |
ifFalse:[#~] |
|
2504 | 100 |
|
101 |
"Modified: / 31-08-2011 / 09:26:48 / cg" |
|
102 |
! |
|
103 |
||
104 |
deltaDetail |
|
105 |
"Returns a delta to the current state as a ChangeDelta object" |
|
106 |
||
2690 | 107 |
| class mySource imageSource myTree imageTree same | |
2504 | 108 |
|
109 |
class := self changeClass. |
|
110 |
class isNil ifTrue:[^ ChangeDeltaInformation added ]. |
|
2753 | 111 |
class isLoaded ifFalse:[^ ChangeDeltaInformation different ]. |
2504 | 112 |
mySource := self source. |
113 |
imageSource := class definitionWithoutPackage "definition". |
|
2690 | 114 |
same := (mySource = imageSource). |
115 |
same ifFalse:[ |
|
116 |
same := (self class isSource: mySource sameSourceAs: imageSource ). |
|
117 |
same ifFalse:[ |
|
118 |
"/ care for formatting (tabs, indentation etc.) |
|
119 |
myTree := RBParser parseExpression:mySource. |
|
120 |
imageTree := RBParser parseExpression:imageSource. |
|
121 |
same := (myTree = imageTree). |
|
122 |
same ifFalse:[ |
|
123 |
"/ some classDefinition strings contain sn |
|
124 |
"/ instVarName string like 'foo bar ' instead of 'foo bar' (i.e. added a space)... |
|
125 |
((myTree receiver = imageTree receiver) |
|
126 |
and:[ (myTree selector = imageTree selector) |
|
127 |
and:[ ('*ubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' match: myTree selector) |
|
128 |
and:[ (myTree arguments at:1) = (imageTree arguments at:1) |
|
129 |
||
130 |
and:[ (2 to:5) conform:[:i | |
|
131 |
((myTree arguments at:i) isLiteral |
|
132 |
and:[ (imageTree arguments at:i) isLiteral |
|
133 |
and:[ (myTree arguments at:i) value asString withoutSeparators |
|
134 |
= (imageTree arguments at:i) value asString withoutSeparators ]]) ] |
|
135 |
||
136 |
]]]]) |
|
137 |
ifTrue:[ |
|
138 |
same := true |
|
139 |
] |
|
140 |
]. |
|
141 |
] |
|
142 |
]. |
|
143 |
||
144 |
^ same |
|
2504 | 145 |
ifTrue:[ ChangeDeltaInformation identical ] |
146 |
ifFalse:[ ChangeDeltaInformation different ] |
|
147 |
||
148 |
"Created: / 31-08-2011 / 10:26:42 / cg" |
|
2753 | 149 |
"Modified: / 24-01-2012 / 22:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2368 | 150 |
! |
151 |
||
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
152 |
imageSource |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
153 |
"return the source for the in-image version of the method" |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
154 |
|
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
155 |
| cls | |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
156 |
|
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
157 |
cls := self changeClass. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
158 |
cls isNil ifTrue:[ ^ nil ]. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
159 |
^ cls definitionWithoutPackage |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
160 |
! |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
161 |
|
1427 | 162 |
instanceVariableNames |
163 |
^ instanceVariableNames |
|
164 |
! |
|
165 |
||
166 |
instanceVariableNames:something |
|
167 |
instanceVariableNames := something. |
|
168 |
! |
|
169 |
||
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
170 |
localClassName |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
171 |
"for private classes, this returns the name relative to its owner; |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
172 |
for non-private ones, this is the regular name. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
173 |
Notice that className always returns the full name (incl. any owner prefix)" |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
174 |
|
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
175 |
self isPrivateClassDefinitionChange ifFalse:[^ self className]. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
176 |
(className startsWith:(owningClassName,'::')) ifTrue:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
177 |
^ className copyFrom:(owningClassName size + 2 + 1). |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
178 |
] ifFalse:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
179 |
"/ should not happen |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
180 |
^ self className |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
181 |
] |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
182 |
! |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
183 |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
184 |
nameSpaceName |
1318 | 185 |
objectType == #variable ifTrue:[ |
186 |
^ nil |
|
187 |
]. |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
188 |
^ self cutNameSpaceOf:(self nameSpaceOverride ? super nameSpaceName) |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
189 |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
190 |
"Modified: / 07-09-2011 / 20:47:14 / cg" |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
191 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
192 |
|
1196 | 193 |
nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg |
1854 | 194 |
"this instance setup message is used when reading from a VW-xml change file. |
195 |
Support for this is not yet complete." |
|
196 |
||
197 |
|indexedType imports| |
|
1196 | 198 |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
199 |
nameSpaceOverride := aNameSpaceName. |
911 | 200 |
classType := aClassType. |
1196 | 201 |
otherParameters := Dictionary new addAll:otherParametersArg; yourself. |
202 |
||
203 |
superClassName := otherParameters at:#superclass: ifAbsent:nil. |
|
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
204 |
self assert:(superClassName notNil). |
1196 | 205 |
superClassName notNil ifTrue:[ |
206 |
superClassName := superClassName pathString. |
|
207 |
]. |
|
208 |
indexedType := otherParameters at:#indexedType: ifAbsent:nil. |
|
209 |
private := otherParameters at:#private: ifAbsent:nil. |
|
210 |
instanceVariableNames := otherParameters at:#instanceVariableNames: ifAbsent:nil. |
|
211 |
classInstanceVariableNames := otherParameters at:#classInstanceVariableNames: ifAbsent:nil. |
|
212 |
imports := otherParameters at:#imports: ifAbsent:nil. |
|
213 |
category := otherParameters at:#category: ifAbsent:nil. |
|
1854 | 214 |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
215 |
"Modified: / 15-06-2010 / 14:50:35 / cg" |
911 | 216 |
! |
217 |
||
218 |
objectType |
|
219 |
"return the value of the instance variable 'objectType' (automatically generated)" |
|
220 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
221 |
^ objectType |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
222 |
! |
911 | 223 |
|
224 |
objectType:something |
|
225 |
"set the value of the instance variable 'objectType' (automatically generated)" |
|
226 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
227 |
objectType := something. |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
228 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
229 |
|
1427 | 230 |
poolDictionaries |
2832 | 231 |
poolDictionaries isNil ifTrue:[ |
232 |
self setupFromSource. |
|
233 |
]. |
|
1427 | 234 |
^ poolDictionaries |
2832 | 235 |
|
236 |
"Modified: / 13-06-2012 / 12:23:41 / cg" |
|
1427 | 237 |
! |
238 |
||
239 |
poolDictionaries:something |
|
240 |
poolDictionaries := something. |
|
241 |
! |
|
242 |
||
2289 | 243 |
private:aBoolean |
244 |
private := aBoolean. |
|
245 |
||
246 |
"Created: / 30-08-2010 / 13:56:11 / cg" |
|
247 |
! |
|
248 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
249 |
source |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
250 |
"return the source of the change" |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
251 |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
252 |
|src ns| |
1196 | 253 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
254 |
(src := source) isNil ifTrue:[ |
1196 | 255 |
src := self definitionString |
256 |
]. |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
257 |
|
2900
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
258 |
"/ ouch - already done in definitionString !!!!!! |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
259 |
"/ (ns := self nameSpaceOverride) notNil ifTrue:[ |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
260 |
"/ (className startsWith:(ns,'::')) ifFalse:[ |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
261 |
"/ ^ '"{ NameSpace: ' , ns , ' }"' , |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
262 |
"/ Character cr, Character cr , |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
263 |
"/ src string |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
264 |
"/ ]. |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
265 |
"/ ]. |
1196 | 266 |
^ src |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
267 |
|
2900
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
268 |
"Modified: / 10-08-2012 / 11:53:54 / cg" |
1196 | 269 |
! |
270 |
||
271 |
superClassName |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
272 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
273 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
274 |
nm := superClassName. |
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
275 |
nm isNil ifTrue:[^ 'nil']. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
276 |
"/ convert VW namespace syntax |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
277 |
(nm includes:$.) ifTrue:[ |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
278 |
^ nm copyReplaceAll:$. withAll:'::'. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
279 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
280 |
^ nm |
1427 | 281 |
! |
282 |
||
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
283 |
superClassName:aString |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
284 |
superClassName := aString. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
285 |
self assert:(aString notNil). |
2207 | 286 |
self invalidateSource. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
287 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
288 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
289 |
superClassNameWithoutMyNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
290 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
291 |
|
1956 | 292 |
superClassName isNil ifTrue:[^ 'nil']. |
293 |
||
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
294 |
nm := self cutMyNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
295 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
296 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
297 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
298 |
^ nm |
1956 | 299 |
|
300 |
"Modified: / 03-03-2007 / 13:09:07 / cg" |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
301 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
302 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
303 |
superClassNameWithoutNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
304 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
305 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
306 |
nm := self cutNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
307 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
308 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
309 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
310 |
^ nm |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
311 |
! ! |
911 | 312 |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
313 |
!ClassDefinitionChange methodsFor:'applying'! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
314 |
|
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
315 |
apply |
3111 | 316 |
|changeClass| |
317 |
||
2425 | 318 |
superClassName isNil ifTrue:[ |
319 |
self setupFromSource |
|
3111 | 320 |
superClassName isNil ifTrue:[ |
321 |
self error:'Should not happen' |
|
322 |
]. |
|
2425 | 323 |
]. |
324 |
(Smalltalk classNamed:superClassName) isNil ifTrue:[ |
|
325 |
Class undeclared:superClassName |
|
326 |
]. |
|
3111 | 327 |
Parser evaluate:self source. |
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
328 |
package notNil ifTrue:[ |
3111 | 329 |
changeClass := self changeClass. |
330 |
changeClass notNil ifTrue:[ |
|
331 |
changeClass setPackage:package. |
|
332 |
]. |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
333 |
]. |
2368 | 334 |
|
335 |
" |
|
2425 | 336 |
(ClassDefinitionChange className: #TestB source: 'TestA subclass: #TestB |
337 |
instanceVariableNames:'''' |
|
338 |
classVariableNames:'''' |
|
339 |
poolDictionaries:'''' |
|
340 |
category:''* remove me *''') |
|
341 |
apply |
|
2368 | 342 |
" |
343 |
||
344 |
"Modified: / 08-11-2010 / 16:10:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2554 | 345 |
"Modified: / 06-10-2011 / 17:01:58 / cg" |
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
346 |
! ! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
347 |
|
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
348 |
!ClassDefinitionChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
349 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
350 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
351 |
"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:
772
diff
changeset
|
352 |
thingy as the receiver (i.e. same method, same definition etc.)." |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
353 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
354 |
changeB isClassDefinitionChange ifFalse:[^ false]. |
3205 | 355 |
^ self className = changeB className. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
356 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
357 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
358 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
359 |
"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:
772
diff
changeset
|
360 |
|
798 | 361 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
362 |
^ self sameSourceAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
363 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
364 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
365 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
366 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
367 |
|
2410 | 368 |
!ClassDefinitionChange methodsFor:'converting'! |
369 |
||
370 |
asAntiChange |
|
371 |
||
372 |
^ClassRemoveChange className: self className |
|
373 |
||
374 |
"Created: / 02-11-2009 / 11:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
375 |
! ! |
|
376 |
||
962 | 377 |
!ClassDefinitionChange methodsFor:'printing & storing'! |
787 | 378 |
|
1196 | 379 |
definitionString |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
380 |
^ self definitionStringInNamespace: (self nameSpaceOverride) |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
381 |
! |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
382 |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
383 |
definitionStringInNamespace: nsOrNil |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
384 |
|classNameUsed superClassNameUsed selPart| |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
385 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
386 |
objectType == #variable ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
387 |
^ String streamContents:[:stream | |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
388 |
nsOrNil notNil ifTrue:[ |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
389 |
stream nextPutAll:((nsOrNil asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
390 |
] ifFalse:[ |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
391 |
self halt:'can this happen ?'. |
2834 | 392 |
stream nextPutAll:'Smalltalk' |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
393 |
]. |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
394 |
|
1196 | 395 |
stream |
396 |
nextPutAll:' addClassVarName:'; |
|
1318 | 397 |
nextPutAll:className asString storeString |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
398 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
399 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
400 |
|
2554 | 401 |
superClassNameUsed := self superClassName. |
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
402 |
"/ careful with private classes: the definition MUST give the |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
403 |
"/ local name as argument, not the full name |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
404 |
classNameUsed := self localClassName. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
405 |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
406 |
"/ selPart is the subclass:/variableSubclass/variableByteSubclass:/... - part |
2834 | 407 |
selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:') |
408 |
keywords first. |
|
2554 | 409 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
410 |
^ String streamContents:[:stream | |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
411 |
stream |
2554 | 412 |
nextPutAll:superClassNameUsed; |
2834 | 413 |
nextPutAll:' ',selPart; |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
414 |
nextPutLine: classNameUsed asSymbol storeString; |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
415 |
nextPutAll:' instanceVariableNames: '; |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
416 |
nextPutLine:(instanceVariableNames ? '') storeString; |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
417 |
nextPutAll:' classVariableNames: '; |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
418 |
nextPutLine:(classVariableNames ? '') storeString; |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
419 |
nextPutAll:' poolDictionaries: '; |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
420 |
nextPutLine:(poolDictionaries ? '') storeString. |
2831 | 421 |
private == true ifTrue:[ |
422 |
stream |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
423 |
nextPutAll:' privateIn: '; |
2831 | 424 |
nextPutAll:(self owningClassName) |
425 |
] ifFalse:[ |
|
426 |
stream |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
427 |
nextPutAll:' category: '; |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
428 |
nextPutAll:(category ? '') asString storeString |
2831 | 429 |
]. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
430 |
] |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
431 |
|
2834 | 432 |
"Modified: / 13-06-2012 / 13:01:58 / cg" |
1196 | 433 |
! |
434 |
||
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
435 |
definitionStringWithoutNamespace |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
436 |
"cg - huh - who needs that? (the definitionString already does NOT include the classes namespace)" |
2876 | 437 |
|
438 |
|ns classNameUsed superClassNameUsed| |
|
439 |
||
440 |
ns := self nameSpaceOverride. |
|
441 |
||
442 |
objectType == #variable ifTrue:[ |
|
443 |
^ String streamContents:[:stream | |
|
444 |
ns notNil ifTrue:[ |
|
445 |
stream |
|
446 |
nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
447 |
] ifFalse:[ |
|
448 |
self halt:'can this happen ?'. |
|
449 |
stream |
|
450 |
nextPutAll:'Smalltalk' |
|
451 |
]. |
|
452 |
||
453 |
stream |
|
454 |
nextPutAll:' addClassVarName:'; |
|
455 |
nextPutAll:className asString storeString |
|
456 |
]. |
|
457 |
]. |
|
458 |
||
459 |
superClassNameUsed := self superClassName. |
|
460 |
classNameUsed := self classNameWithoutNamespace. |
|
461 |
||
462 |
^ String streamContents:[:stream | |
|
463 |
self isPrivateClassDefinitionChange ifFalse:[ |
|
464 |
stream |
|
465 |
nextPutAll:superClassNameUsed; |
|
466 |
nextPutAll:' subclass:'; |
|
467 |
nextPutAll: classNameUsed asSymbol storeString |
|
468 |
; |
|
469 |
cr; |
|
470 |
tab; |
|
471 |
nextPutAll:'instanceVariableNames:'; |
|
472 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
473 |
cr; |
|
474 |
tab; |
|
475 |
nextPutAll:'classVariableNames:'; |
|
476 |
nextPutAll:(classVariableNames ? '') storeString; |
|
477 |
cr; |
|
478 |
tab; |
|
479 |
nextPutAll:'poolDictionaries:'; |
|
480 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
481 |
cr; |
|
482 |
tab; |
|
483 |
nextPutAll:'category:'; |
|
484 |
nextPutAll:(category ? '') storeString; |
|
485 |
cr |
|
486 |
] ifTrue:[ |
|
487 |
stream |
|
488 |
nextPutAll:superClassNameUsed; |
|
489 |
nextPutAll:' subclass:'; |
|
490 |
nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString |
|
491 |
; |
|
492 |
cr; |
|
493 |
tab; |
|
494 |
nextPutAll:'instanceVariableNames:'; |
|
495 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
496 |
cr; |
|
497 |
tab; |
|
498 |
nextPutAll:'classVariableNames:'; |
|
499 |
nextPutAll:(classVariableNames ? '') storeString; |
|
500 |
cr; |
|
501 |
tab; |
|
502 |
nextPutAll:'poolDictionaries:'; |
|
503 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
504 |
cr; |
|
505 |
tab; |
|
506 |
nextPutAll:'privateIn:'; |
|
507 |
nextPutAll: |
|
508 |
((ns := self nameSpaceName) isNil |
|
509 |
ifTrue:[owningClassName] |
|
510 |
ifFalse:[owningClassName copyFrom: ns size + 3]); |
|
511 |
cr |
|
512 |
] |
|
513 |
] |
|
514 |
||
515 |
"Modified: / 06-10-2011 / 17:02:05 / cg" |
|
516 |
"Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
517 |
! |
|
518 |
||
1101 | 519 |
printOn:aStream |
1866 | 520 |
aStream |
521 |
nextPutAll:className; nextPutAll:' {definition}' |
|
522 |
||
523 |
"Modified: / 12-10-2006 / 17:48:28 / cg" |
|
1101 | 524 |
! |
525 |
||
896 | 526 |
printWithoutClassNameOn:aStream |
787 | 527 |
aStream nextPutAll:('definition of ' , className) |
528 |
||
529 |
||
530 |
! ! |
|
531 |
||
772 | 532 |
!ClassDefinitionChange methodsFor:'queries'! |
533 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
534 |
definitionSelector |
1854 | 535 |
definitionSelector isNil ifTrue:[ |
536 |
self setupFromSource. |
|
537 |
]. |
|
538 |
^ definitionSelector |
|
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
539 |
|
1854 | 540 |
"Modified: / 11-10-2006 / 14:11:44 / cg" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
541 |
! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
542 |
|
2833 | 543 |
definitionSelector:aSelector |
544 |
definitionSelector := aSelector |
|
545 |
||
546 |
"Created: / 13-06-2012 / 12:45:02 / cg" |
|
547 |
! |
|
548 |
||
772 | 549 |
isClassDefinitionChange |
550 |
^ true |
|
1854 | 551 |
! |
552 |
||
553 |
isPrivateClassDefinitionChange |
|
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
554 |
"compute lazily; remember in private" |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
555 |
|
1854 | 556 |
private isNil ifTrue:[ |
1904 | 557 |
(className includes:$:) ifFalse:[ |
558 |
"/ cannot be private |
|
559 |
private := false |
|
560 |
] ifTrue:[ |
|
1909
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
561 |
source isNil ifTrue:[^ false ]. |
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
562 |
(source includesString:'private') ifFalse:[ |
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
563 |
private := false. |
1904 | 564 |
] ifTrue:[ |
1916 | 565 |
"/ (self changeClass notNil |
566 |
"/ and:[self changeClass isLoaded not]) ifTrue:[ |
|
567 |
"/ "/ cannot be private |
|
568 |
"/ private := false |
|
569 |
"/ ] ifTrue:[ |
|
1909
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
570 |
self setupFromSource. |
1916 | 571 |
"/ ]. |
1904 | 572 |
]. |
573 |
]. |
|
1854 | 574 |
]. |
575 |
^ private |
|
576 |
||
577 |
"Created: / 11-10-2006 / 14:19:03 / cg" |
|
1909
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
578 |
"Modified: / 16-11-2006 / 16:34:19 / cg" |
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
579 |
! |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
580 |
|
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
581 |
owningClassName |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
582 |
self isPrivateClassDefinitionChange ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
583 |
owningClassName isNil ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
584 |
self setupFromSource. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
585 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
586 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
587 |
^ owningClassName |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
588 |
|
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
589 |
"Created: / 12-10-2006 / 23:07:25 / cg" |
2289 | 590 |
! |
591 |
||
592 |
owningClassName:aStringOrSymbol |
|
593 |
owningClassName := aStringOrSymbol |
|
594 |
||
595 |
"Created: / 30-08-2010 / 13:55:37 / cg" |
|
772 | 596 |
! ! |
597 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
598 |
!ClassDefinitionChange methodsFor:'special'! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
599 |
|
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
600 |
installAsAutoloadedClassIfPublicWithFilename:aFilenameString |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
601 |
"install the class defined by this change as autoloaded. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
602 |
Skip private classes. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
603 |
Enter class file name as abbreviation" |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
604 |
|
1904 | 605 |
|parseTree sel cat clsName cls catIdx pkg| |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
606 |
|
2289 | 607 |
private == true ifTrue:[^ self]. |
608 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
609 |
parseTree := Parser parseExpression:self source. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
610 |
parseTree isMessage ifFalse:[ |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
611 |
self error:'bad change source'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
612 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
613 |
|
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
614 |
sel := parseTree selector. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
615 |
(sel endsWith:':privateIn:') ifTrue:[^ self]. |
1418 | 616 |
|
2402
f6799fe6acc4
changed: #installAsAutoloadedClassIfPublicWithFilename:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
617 |
catIdx := sel asSymbol keywords indexOf:'category:'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
618 |
catIdx ~~ 0 ifTrue:[ |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
619 |
cat := (parseTree args at:catIdx) evaluate. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
620 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
621 |
|
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
622 |
clsName := self className asSymbol. |
1802 | 623 |
cls := Smalltalk at:clsName. |
1904 | 624 |
|
625 |
pkg := package ? Project current package. |
|
626 |
||
1802 | 627 |
(cls isNil |
628 |
or:[cls isBehavior not |
|
629 |
or:[cls isLoaded not]]) ifTrue:[ |
|
1904 | 630 |
|autoloadedClass| |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
631 |
|
1836 | 632 |
autoloadedClass := Smalltalk |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
633 |
installAutoloadedClassNamed:clsName |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
634 |
category:cat |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
635 |
package:pkg |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
636 |
revision:nil. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
637 |
aFilenameString notNil ifTrue:[ |
1836 | 638 |
autoloadedClass setClassFilename:aFilenameString. |
639 |
"/ Smalltalk setFilename:aFilenameString forClass:clsName package:pkg. |
|
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
640 |
] |
1904 | 641 |
] ifFalse:[ |
642 |
cls notNil ifTrue:[ |
|
643 |
cls isBehavior ifTrue:[ |
|
644 |
cls package ~= pkg ifTrue:[ |
|
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
645 |
Transcript showCR:('Autoloaded class: %1 not installed (package would change from %2 to %3)' |
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
646 |
bindWith:clsName with:cls package with:pkg). |
1904 | 647 |
] |
648 |
]. |
|
649 |
]. |
|
650 |
]. |
|
1836 | 651 |
|
2402
f6799fe6acc4
changed: #installAsAutoloadedClassIfPublicWithFilename:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
652 |
"Modified: / 03-07-2011 / 18:34:05 / cg" |
1854 | 653 |
! |
654 |
||
2207 | 655 |
invalidateSource |
656 |
"internal - flush the sourceString if it got invalidated due to a |
|
657 |
className, superclassName, etc... change" |
|
658 |
||
659 |
source := nil. |
|
660 |
! |
|
661 |
||
1854 | 662 |
setupFromSource |
663 |
"extract privacy, category and selector from the source" |
|
664 |
||
2832 | 665 |
|parseTree catIdx poolIdx| |
1854 | 666 |
|
667 |
source notNil ifTrue:[ |
|
668 |
parseTree := Parser parseExpression:source. |
|
1878 | 669 |
(parseTree notNil and:[parseTree isMessage]) ifFalse:[ |
1887 | 670 |
self error:'bad change source' mayProceed:true. |
671 |
^ self |
|
1854 | 672 |
]. |
673 |
||
674 |
definitionSelector := parseTree selector. |
|
675 |
||
676 |
private := (definitionSelector endsWith:':privateIn:'). |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
677 |
private ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
678 |
owningClassName := parseTree args last name. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
679 |
]. |
1854 | 680 |
|
681 |
catIdx := definitionSelector keywords indexOf:'category:'. |
|
682 |
catIdx ~~ 0 ifTrue:[ |
|
683 |
category := (parseTree args at:catIdx) evaluate. |
|
684 |
]. |
|
2368 | 685 |
|
2832 | 686 |
poolIdx := definitionSelector keywords indexOf:'poolDictionaries:'. |
687 |
poolIdx ~~ 0 ifTrue:[ |
|
688 |
poolDictionaries := (parseTree args at:poolIdx) evaluate. |
|
689 |
]. |
|
690 |
||
2368 | 691 |
superClassName := parseTree receiver name. |
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
692 |
self assert:(superClassName notNil). |
1854 | 693 |
]. |
694 |
||
695 |
"Created: / 11-10-2006 / 14:10:02 / cg" |
|
2368 | 696 |
"Modified: / 08-11-2010 / 13:47:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2832 | 697 |
"Modified: / 13-06-2012 / 12:25:10 / cg" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
698 |
! ! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
699 |
|
2614
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
700 |
!ClassDefinitionChange methodsFor:'visiting'! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
701 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
702 |
acceptChangeVisitor:aVisitor |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
703 |
^ aVisitor visitClassDefinitionChange:self. |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
704 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
705 |
"Created: / 25-11-2011 / 17:13:13 / cg" |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
706 |
! ! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
707 |
|
100 | 708 |
!ClassDefinitionChange class methodsFor:'documentation'! |
709 |
||
2518 | 710 |
version |
3205 | 711 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.78 2013-04-10 08:58:10 stefan Exp $' |
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
712 |
! |
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
713 |
|
2368 | 714 |
version_SVN |
2876 | 715 |
^ '§Id:: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1 §' |
100 | 716 |
! ! |
3111 | 717 |