author | Claus Gittinger <cg@exept.de> |
Wed, 27 Mar 2013 19:18:21 +0100 | |
changeset 3150 | 10fa70a50dfa |
parent 3139 | c6eb068647cc |
child 3158 | f8c56a311307 |
child 3163 | 16fdcb5a998b |
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 |
|
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
53 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.75 2013-03-27 18:18:21 cg 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 |
||
1427 | 152 |
instanceVariableNames |
153 |
^ instanceVariableNames |
|
154 |
! |
|
155 |
||
156 |
instanceVariableNames:something |
|
157 |
instanceVariableNames := something. |
|
158 |
! |
|
159 |
||
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
160 |
localClassName |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
161 |
"for private classes, this returns the name relative to its owner; |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
162 |
for non-private ones, this is the regular name. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
163 |
Notice that className always returns the full name (incl. any owner prefix)" |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
164 |
|
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
165 |
self isPrivateClassDefinitionChange ifFalse:[^ self className]. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
166 |
(className startsWith:(owningClassName,'::')) ifTrue:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
167 |
^ className copyFrom:(owningClassName size + 2 + 1). |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
168 |
] ifFalse:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
169 |
"/ should not happen |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
170 |
^ self className |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
171 |
] |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
172 |
! |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
173 |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
174 |
nameSpaceName |
1318 | 175 |
objectType == #variable ifTrue:[ |
176 |
^ nil |
|
177 |
]. |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
178 |
^ 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
|
179 |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
180 |
"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
|
181 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
182 |
|
1196 | 183 |
nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg |
1854 | 184 |
"this instance setup message is used when reading from a VW-xml change file. |
185 |
Support for this is not yet complete." |
|
186 |
||
187 |
|indexedType imports| |
|
1196 | 188 |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
189 |
nameSpaceOverride := aNameSpaceName. |
911 | 190 |
classType := aClassType. |
1196 | 191 |
otherParameters := Dictionary new addAll:otherParametersArg; yourself. |
192 |
||
193 |
superClassName := otherParameters at:#superclass: ifAbsent:nil. |
|
194 |
superClassName notNil ifTrue:[ |
|
195 |
superClassName := superClassName pathString. |
|
196 |
]. |
|
197 |
indexedType := otherParameters at:#indexedType: ifAbsent:nil. |
|
198 |
private := otherParameters at:#private: ifAbsent:nil. |
|
199 |
instanceVariableNames := otherParameters at:#instanceVariableNames: ifAbsent:nil. |
|
200 |
classInstanceVariableNames := otherParameters at:#classInstanceVariableNames: ifAbsent:nil. |
|
201 |
imports := otherParameters at:#imports: ifAbsent:nil. |
|
202 |
category := otherParameters at:#category: ifAbsent:nil. |
|
1854 | 203 |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
204 |
"Modified: / 15-06-2010 / 14:50:35 / cg" |
911 | 205 |
! |
206 |
||
207 |
objectType |
|
208 |
"return the value of the instance variable 'objectType' (automatically generated)" |
|
209 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
210 |
^ objectType |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
211 |
! |
911 | 212 |
|
213 |
objectType:something |
|
214 |
"set the value of the instance variable 'objectType' (automatically generated)" |
|
215 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
216 |
objectType := something. |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
217 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
218 |
|
1427 | 219 |
poolDictionaries |
2832 | 220 |
poolDictionaries isNil ifTrue:[ |
221 |
self setupFromSource. |
|
222 |
]. |
|
1427 | 223 |
^ poolDictionaries |
2832 | 224 |
|
225 |
"Modified: / 13-06-2012 / 12:23:41 / cg" |
|
1427 | 226 |
! |
227 |
||
228 |
poolDictionaries:something |
|
229 |
poolDictionaries := something. |
|
230 |
! |
|
231 |
||
2289 | 232 |
private:aBoolean |
233 |
private := aBoolean. |
|
234 |
||
235 |
"Created: / 30-08-2010 / 13:56:11 / cg" |
|
236 |
! |
|
237 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
238 |
source |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
239 |
"return the source of the change" |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
240 |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
241 |
|src ns| |
1196 | 242 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
243 |
(src := source) isNil ifTrue:[ |
1196 | 244 |
src := self definitionString |
245 |
]. |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
246 |
|
2900
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
247 |
"/ ouch - already done in definitionString !!!!!! |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
248 |
"/ (ns := self nameSpaceOverride) notNil ifTrue:[ |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
249 |
"/ (className startsWith:(ns,'::')) ifFalse:[ |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
250 |
"/ ^ '"{ NameSpace: ' , ns , ' }"' , |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
251 |
"/ Character cr, Character cr , |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
252 |
"/ src string |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
253 |
"/ ]. |
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
254 |
"/ ]. |
1196 | 255 |
^ src |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
256 |
|
2900
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
257 |
"Modified: / 10-08-2012 / 11:53:54 / cg" |
1196 | 258 |
! |
259 |
||
260 |
superClassName |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
261 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
262 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
263 |
nm := superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
264 |
nm notNil ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
265 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
266 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
267 |
] |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
268 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
269 |
^ nm |
1427 | 270 |
! |
271 |
||
272 |
superClassName:something |
|
273 |
superClassName := something. |
|
2207 | 274 |
self invalidateSource. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
275 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
276 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
277 |
superClassNameWithoutMyNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
278 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
279 |
|
1956 | 280 |
superClassName isNil ifTrue:[^ 'nil']. |
281 |
||
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
282 |
nm := self cutMyNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
283 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
284 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
285 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
286 |
^ nm |
1956 | 287 |
|
288 |
"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
|
289 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
290 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
291 |
superClassNameWithoutNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
292 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
293 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
294 |
nm := self cutNameSpaceOf: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 |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
299 |
! ! |
911 | 300 |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
301 |
!ClassDefinitionChange methodsFor:'applying'! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
302 |
|
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
303 |
apply |
3111 | 304 |
|changeClass| |
305 |
||
2425 | 306 |
superClassName isNil ifTrue:[ |
307 |
self setupFromSource |
|
3111 | 308 |
superClassName isNil ifTrue:[ |
309 |
self error:'Should not happen' |
|
310 |
]. |
|
2425 | 311 |
]. |
312 |
(Smalltalk classNamed:superClassName) isNil ifTrue:[ |
|
313 |
Class undeclared:superClassName |
|
314 |
]. |
|
3111 | 315 |
Parser evaluate:self source. |
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
316 |
package notNil ifTrue:[ |
3111 | 317 |
changeClass := self changeClass. |
318 |
changeClass notNil ifTrue:[ |
|
319 |
changeClass setPackage:package. |
|
320 |
]. |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
321 |
]. |
2368 | 322 |
|
323 |
" |
|
2425 | 324 |
(ClassDefinitionChange className: #TestB source: 'TestA subclass: #TestB |
325 |
instanceVariableNames:'''' |
|
326 |
classVariableNames:'''' |
|
327 |
poolDictionaries:'''' |
|
328 |
category:''* remove me *''') |
|
329 |
apply |
|
2368 | 330 |
" |
331 |
||
332 |
"Modified: / 08-11-2010 / 16:10:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2554 | 333 |
"Modified: / 06-10-2011 / 17:01:58 / cg" |
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
334 |
! ! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
335 |
|
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
336 |
!ClassDefinitionChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
337 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
338 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
339 |
"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
|
340 |
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
|
341 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
342 |
changeB isClassDefinitionChange ifFalse:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
343 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
344 |
className ~= changeB className ifTrue:[^ false]. |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
345 |
^ true |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
346 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
347 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
348 |
|
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 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
351 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
352 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
353 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
354 |
"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
|
355 |
|
798 | 356 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
357 |
^ self sameSourceAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
358 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
359 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
360 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
361 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
362 |
|
2410 | 363 |
!ClassDefinitionChange methodsFor:'converting'! |
364 |
||
365 |
asAntiChange |
|
366 |
||
367 |
^ClassRemoveChange className: self className |
|
368 |
||
369 |
"Created: / 02-11-2009 / 11:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
370 |
! ! |
|
371 |
||
962 | 372 |
!ClassDefinitionChange methodsFor:'printing & storing'! |
787 | 373 |
|
1196 | 374 |
definitionString |
2834 | 375 |
|ns classNameUsed superClassNameUsed selPart| |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
376 |
|
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
377 |
ns := self nameSpaceOverride. |
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
378 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
379 |
objectType == #variable ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
380 |
^ String streamContents:[:stream | |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
381 |
ns notNil ifTrue:[ |
2834 | 382 |
stream nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
383 |
] ifFalse:[ |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
384 |
self halt:'can this happen ?'. |
2834 | 385 |
stream nextPutAll:'Smalltalk' |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
386 |
]. |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
387 |
|
1196 | 388 |
stream |
389 |
nextPutAll:' addClassVarName:'; |
|
1318 | 390 |
nextPutAll:className asString storeString |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
391 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
392 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
393 |
|
2554 | 394 |
superClassNameUsed := self superClassName. |
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
395 |
"/ careful with private classes: the definition MUST give the |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
396 |
"/ local name as argument, not the full name |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
397 |
classNameUsed := self localClassName. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
398 |
|
2834 | 399 |
selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:') |
400 |
keywords first. |
|
2554 | 401 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
402 |
^ String streamContents:[:stream | |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
403 |
stream |
2554 | 404 |
nextPutAll:superClassNameUsed; |
2834 | 405 |
nextPutAll:' ',selPart; |
406 |
nextPutAll: classNameUsed asSymbol storeString; |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
407 |
cr; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
408 |
spaces:4; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
409 |
nextPutAll:'instanceVariableNames: '; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
410 |
nextPutAll:(instanceVariableNames ? '') storeString; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
411 |
cr; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
412 |
spaces:4; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
413 |
nextPutAll:'classVariableNames: '; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
414 |
nextPutAll:(classVariableNames ? '') storeString; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
415 |
cr; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
416 |
spaces:4; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
417 |
nextPutAll:'poolDictionaries: '; |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
418 |
nextPutAll:(poolDictionaries ? '') storeString; |
2831 | 419 |
cr. |
420 |
private == true ifTrue:[ |
|
421 |
stream |
|
422 |
spaces:4; |
|
423 |
nextPutAll:'privateIn: '; |
|
424 |
nextPutAll:(self owningClassName) |
|
425 |
] ifFalse:[ |
|
426 |
stream |
|
427 |
spaces:4; |
|
428 |
nextPutAll:'category: '; |
|
429 |
nextPutAll:(category ? '') storeString |
|
430 |
]. |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
431 |
] |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
432 |
|
2834 | 433 |
"Modified: / 13-06-2012 / 13:01:58 / cg" |
1196 | 434 |
! |
435 |
||
2876 | 436 |
definitionStringInNamespace: ns |
437 |
| classNameUsed superClassNameUsed | |
|
438 |
||
439 |
objectType == #variable ifTrue:[ |
|
440 |
^ String streamContents:[:stream | |
|
441 |
ns notNil ifTrue:[ |
|
442 |
stream |
|
443 |
nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
444 |
] ifFalse:[ |
|
445 |
self halt:'can this happen ?'. |
|
446 |
stream |
|
447 |
nextPutAll:'Smalltalk' |
|
448 |
]. |
|
449 |
||
450 |
stream |
|
451 |
nextPutAll:' addClassVarName:'; |
|
452 |
nextPutAll:className asString storeString |
|
453 |
]. |
|
454 |
]. |
|
455 |
||
456 |
superClassNameUsed := self superClassName. |
|
457 |
classNameUsed := self classNameWithoutNamespace. |
|
458 |
||
459 |
^ String streamContents:[:stream | |
|
460 |
self isPrivateClassDefinitionChange ifFalse:[ |
|
461 |
stream |
|
462 |
nextPutAll:superClassNameUsed; |
|
463 |
nextPutAll:' subclass:'; |
|
464 |
nextPutAll: classNameUsed asSymbol storeString |
|
465 |
; |
|
466 |
cr; |
|
467 |
tab; |
|
468 |
nextPutAll:'instanceVariableNames:'; |
|
469 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
470 |
cr; |
|
471 |
tab; |
|
472 |
nextPutAll:'classVariableNames:'; |
|
473 |
nextPutAll:(classVariableNames ? '') storeString; |
|
474 |
cr; |
|
475 |
tab; |
|
476 |
nextPutAll:'poolDictionaries:'; |
|
477 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
478 |
cr; |
|
479 |
tab; |
|
480 |
nextPutAll:'category:'; |
|
481 |
nextPutAll:(category ? '') storeString; |
|
482 |
cr |
|
483 |
] ifTrue:[ |
|
484 |
stream |
|
485 |
nextPutAll:superClassNameUsed; |
|
486 |
nextPutAll:' subclass:'; |
|
487 |
nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString |
|
488 |
; |
|
489 |
cr; |
|
490 |
tab; |
|
491 |
nextPutAll:'instanceVariableNames:'; |
|
492 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
493 |
cr; |
|
494 |
tab; |
|
495 |
nextPutAll:'classVariableNames:'; |
|
496 |
nextPutAll:(classVariableNames ? '') storeString; |
|
497 |
cr; |
|
498 |
tab; |
|
499 |
nextPutAll:'poolDictionaries:'; |
|
500 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
501 |
cr; |
|
502 |
tab; |
|
503 |
nextPutAll:'privateIn:'; |
|
504 |
nextPutAll: |
|
505 |
(ns isNil |
|
506 |
ifTrue:[owningClassName] |
|
507 |
ifFalse:[owningClassName copyFrom: ns size + 3]); |
|
508 |
cr |
|
509 |
] |
|
510 |
] |
|
511 |
||
512 |
"Modified: / 06-10-2011 / 17:02:05 / cg" |
|
513 |
"Created: / 20-03-2012 / 19:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
514 |
! |
|
515 |
||
516 |
definitionStringWithoutNamespace |
|
517 |
|ns classNameUsed superClassNameUsed| |
|
518 |
||
519 |
ns := self nameSpaceOverride. |
|
520 |
||
521 |
objectType == #variable ifTrue:[ |
|
522 |
^ String streamContents:[:stream | |
|
523 |
ns notNil ifTrue:[ |
|
524 |
stream |
|
525 |
nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
526 |
] ifFalse:[ |
|
527 |
self halt:'can this happen ?'. |
|
528 |
stream |
|
529 |
nextPutAll:'Smalltalk' |
|
530 |
]. |
|
531 |
||
532 |
stream |
|
533 |
nextPutAll:' addClassVarName:'; |
|
534 |
nextPutAll:className asString storeString |
|
535 |
]. |
|
536 |
]. |
|
537 |
||
538 |
superClassNameUsed := self superClassName. |
|
539 |
classNameUsed := self classNameWithoutNamespace. |
|
540 |
||
541 |
^ String streamContents:[:stream | |
|
542 |
self isPrivateClassDefinitionChange ifFalse:[ |
|
543 |
stream |
|
544 |
nextPutAll:superClassNameUsed; |
|
545 |
nextPutAll:' subclass:'; |
|
546 |
nextPutAll: classNameUsed asSymbol storeString |
|
547 |
; |
|
548 |
cr; |
|
549 |
tab; |
|
550 |
nextPutAll:'instanceVariableNames:'; |
|
551 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
552 |
cr; |
|
553 |
tab; |
|
554 |
nextPutAll:'classVariableNames:'; |
|
555 |
nextPutAll:(classVariableNames ? '') storeString; |
|
556 |
cr; |
|
557 |
tab; |
|
558 |
nextPutAll:'poolDictionaries:'; |
|
559 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
560 |
cr; |
|
561 |
tab; |
|
562 |
nextPutAll:'category:'; |
|
563 |
nextPutAll:(category ? '') storeString; |
|
564 |
cr |
|
565 |
] ifTrue:[ |
|
566 |
stream |
|
567 |
nextPutAll:superClassNameUsed; |
|
568 |
nextPutAll:' subclass:'; |
|
569 |
nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString |
|
570 |
; |
|
571 |
cr; |
|
572 |
tab; |
|
573 |
nextPutAll:'instanceVariableNames:'; |
|
574 |
nextPutAll:(instanceVariableNames ? '') storeString; |
|
575 |
cr; |
|
576 |
tab; |
|
577 |
nextPutAll:'classVariableNames:'; |
|
578 |
nextPutAll:(classVariableNames ? '') storeString; |
|
579 |
cr; |
|
580 |
tab; |
|
581 |
nextPutAll:'poolDictionaries:'; |
|
582 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
583 |
cr; |
|
584 |
tab; |
|
585 |
nextPutAll:'privateIn:'; |
|
586 |
nextPutAll: |
|
587 |
((ns := self nameSpaceName) isNil |
|
588 |
ifTrue:[owningClassName] |
|
589 |
ifFalse:[owningClassName copyFrom: ns size + 3]); |
|
590 |
cr |
|
591 |
] |
|
592 |
] |
|
593 |
||
594 |
"Modified: / 06-10-2011 / 17:02:05 / cg" |
|
595 |
"Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
596 |
! |
|
597 |
||
1101 | 598 |
printOn:aStream |
1866 | 599 |
aStream |
600 |
nextPutAll:className; nextPutAll:' {definition}' |
|
601 |
||
602 |
"Modified: / 12-10-2006 / 17:48:28 / cg" |
|
1101 | 603 |
! |
604 |
||
896 | 605 |
printWithoutClassNameOn:aStream |
787 | 606 |
aStream nextPutAll:('definition of ' , className) |
607 |
||
608 |
||
609 |
! ! |
|
610 |
||
772 | 611 |
!ClassDefinitionChange methodsFor:'queries'! |
612 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
613 |
definitionSelector |
1854 | 614 |
definitionSelector isNil ifTrue:[ |
615 |
self setupFromSource. |
|
616 |
]. |
|
617 |
^ definitionSelector |
|
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
618 |
|
1854 | 619 |
"Modified: / 11-10-2006 / 14:11:44 / cg" |
1134
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 |
|
2833 | 622 |
definitionSelector:aSelector |
623 |
definitionSelector := aSelector |
|
624 |
||
625 |
"Created: / 13-06-2012 / 12:45:02 / cg" |
|
626 |
! |
|
627 |
||
772 | 628 |
isClassDefinitionChange |
629 |
^ true |
|
1854 | 630 |
! |
631 |
||
632 |
isPrivateClassDefinitionChange |
|
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
633 |
"compute lazily; remember in private" |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
634 |
|
1854 | 635 |
private isNil ifTrue:[ |
1904 | 636 |
(className includes:$:) ifFalse:[ |
637 |
"/ cannot be private |
|
638 |
private := false |
|
639 |
] ifTrue:[ |
|
1909
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
640 |
source isNil ifTrue:[^ false ]. |
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
641 |
(source includesString:'private') ifFalse:[ |
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
642 |
private := false. |
1904 | 643 |
] ifTrue:[ |
1916 | 644 |
"/ (self changeClass notNil |
645 |
"/ and:[self changeClass isLoaded not]) ifTrue:[ |
|
646 |
"/ "/ cannot be private |
|
647 |
"/ private := false |
|
648 |
"/ ] ifTrue:[ |
|
1909
ec92c9dabf66
care for isPrivate query when no source is avail.
Claus Gittinger <cg@exept.de>
parents:
1904
diff
changeset
|
649 |
self setupFromSource. |
1916 | 650 |
"/ ]. |
1904 | 651 |
]. |
652 |
]. |
|
1854 | 653 |
]. |
654 |
^ private |
|
655 |
||
656 |
"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
|
657 |
"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
|
658 |
! |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
659 |
|
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
660 |
owningClassName |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
661 |
self isPrivateClassDefinitionChange ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
662 |
owningClassName isNil ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
663 |
self setupFromSource. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
664 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
665 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
666 |
^ owningClassName |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
667 |
|
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
668 |
"Created: / 12-10-2006 / 23:07:25 / cg" |
2289 | 669 |
! |
670 |
||
671 |
owningClassName:aStringOrSymbol |
|
672 |
owningClassName := aStringOrSymbol |
|
673 |
||
674 |
"Created: / 30-08-2010 / 13:55:37 / cg" |
|
772 | 675 |
! ! |
676 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
677 |
!ClassDefinitionChange methodsFor:'special'! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
678 |
|
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
679 |
installAsAutoloadedClassIfPublicWithFilename:aFilenameString |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
680 |
"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
|
681 |
Skip private classes. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
682 |
Enter class file name as abbreviation" |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
683 |
|
1904 | 684 |
|parseTree sel cat clsName cls catIdx pkg| |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
685 |
|
2289 | 686 |
private == true ifTrue:[^ self]. |
687 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
688 |
parseTree := Parser parseExpression:self source. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
689 |
parseTree isMessage ifFalse:[ |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
690 |
self error:'bad change source'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
691 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
692 |
|
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
693 |
sel := parseTree selector. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
694 |
(sel endsWith:':privateIn:') ifTrue:[^ self]. |
1418 | 695 |
|
2402
f6799fe6acc4
changed: #installAsAutoloadedClassIfPublicWithFilename:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
696 |
catIdx := sel asSymbol keywords indexOf:'category:'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
697 |
catIdx ~~ 0 ifTrue:[ |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
698 |
cat := (parseTree args at:catIdx) evaluate. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
699 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
700 |
|
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
701 |
clsName := self className asSymbol. |
1802 | 702 |
cls := Smalltalk at:clsName. |
1904 | 703 |
|
704 |
pkg := package ? Project current package. |
|
705 |
||
1802 | 706 |
(cls isNil |
707 |
or:[cls isBehavior not |
|
708 |
or:[cls isLoaded not]]) ifTrue:[ |
|
1904 | 709 |
|autoloadedClass| |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
710 |
|
1836 | 711 |
autoloadedClass := Smalltalk |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
712 |
installAutoloadedClassNamed:clsName |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
713 |
category:cat |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
714 |
package:pkg |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
715 |
revision:nil. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
716 |
aFilenameString notNil ifTrue:[ |
1836 | 717 |
autoloadedClass setClassFilename:aFilenameString. |
718 |
"/ 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
|
719 |
] |
1904 | 720 |
] ifFalse:[ |
721 |
cls notNil ifTrue:[ |
|
722 |
cls isBehavior ifTrue:[ |
|
723 |
cls package ~= pkg ifTrue:[ |
|
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
724 |
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
|
725 |
bindWith:clsName with:cls package with:pkg). |
1904 | 726 |
] |
727 |
]. |
|
728 |
]. |
|
729 |
]. |
|
1836 | 730 |
|
2402
f6799fe6acc4
changed: #installAsAutoloadedClassIfPublicWithFilename:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
731 |
"Modified: / 03-07-2011 / 18:34:05 / cg" |
1854 | 732 |
! |
733 |
||
2207 | 734 |
invalidateSource |
735 |
"internal - flush the sourceString if it got invalidated due to a |
|
736 |
className, superclassName, etc... change" |
|
737 |
||
738 |
source := nil. |
|
739 |
! |
|
740 |
||
1854 | 741 |
setupFromSource |
742 |
"extract privacy, category and selector from the source" |
|
743 |
||
2832 | 744 |
|parseTree catIdx poolIdx| |
1854 | 745 |
|
746 |
source notNil ifTrue:[ |
|
747 |
parseTree := Parser parseExpression:source. |
|
1878 | 748 |
(parseTree notNil and:[parseTree isMessage]) ifFalse:[ |
1887 | 749 |
self error:'bad change source' mayProceed:true. |
750 |
^ self |
|
1854 | 751 |
]. |
752 |
||
753 |
definitionSelector := parseTree selector. |
|
754 |
||
755 |
private := (definitionSelector endsWith:':privateIn:'). |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
756 |
private ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
757 |
owningClassName := parseTree args last name. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
758 |
]. |
1854 | 759 |
|
760 |
catIdx := definitionSelector keywords indexOf:'category:'. |
|
761 |
catIdx ~~ 0 ifTrue:[ |
|
762 |
category := (parseTree args at:catIdx) evaluate. |
|
763 |
]. |
|
2368 | 764 |
|
2832 | 765 |
poolIdx := definitionSelector keywords indexOf:'poolDictionaries:'. |
766 |
poolIdx ~~ 0 ifTrue:[ |
|
767 |
poolDictionaries := (parseTree args at:poolIdx) evaluate. |
|
768 |
]. |
|
769 |
||
2368 | 770 |
superClassName := parseTree receiver name. |
1854 | 771 |
]. |
772 |
||
773 |
"Created: / 11-10-2006 / 14:10:02 / cg" |
|
2368 | 774 |
"Modified: / 08-11-2010 / 13:47:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2832 | 775 |
"Modified: / 13-06-2012 / 12:25:10 / cg" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
776 |
! ! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
777 |
|
2614
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
778 |
!ClassDefinitionChange methodsFor:'visiting'! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
779 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
780 |
acceptChangeVisitor:aVisitor |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
781 |
^ aVisitor visitClassDefinitionChange:self. |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
782 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
783 |
"Created: / 25-11-2011 / 17:13:13 / cg" |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
784 |
! ! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
785 |
|
100 | 786 |
!ClassDefinitionChange class methodsFor:'documentation'! |
787 |
||
2518 | 788 |
version |
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
789 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.75 2013-03-27 18:18:21 cg Exp $' |
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
790 |
! |
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
791 |
|
2368 | 792 |
version_SVN |
2876 | 793 |
^ '§Id:: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1 §' |
100 | 794 |
! ! |
3111 | 795 |