author | Stefan Vogel <sv@exept.de> |
Tue, 03 Feb 2015 17:33:21 +0100 | |
changeset 3744 | ec7b4eee7628 |
parent 3694 | 401ad8b2ca8b |
child 3808 | c9927a70b702 |
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 |
||
3744 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
0 | 16 |
ClassChange subclass:#ClassDefinitionChange |
2316 | 17 |
instanceVariableNames:'objectType superClassName classType indexedType otherParameters |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
18 |
instanceVariableString classVariableString |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
19 |
classInstanceVariableString poolDictionaries category private |
3446 | 20 |
definitionSelector' |
235 | 21 |
classVariableNames:'' |
22 |
poolDictionaries:'' |
|
23 |
category:'System-Changes' |
|
0 | 24 |
! |
25 |
||
9 | 26 |
!ClassDefinitionChange class methodsFor:'documentation'! |
27 |
||
28 |
copyright |
|
29 |
" |
|
30 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
38 | 31 |
All Rights Reserved |
9 | 32 |
|
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
1162 | 44 |
instances represent class definition-changes. |
45 |
They are typically held in a ChangeSet. |
|
235 | 46 |
|
47 |
[author:] |
|
48 |
Claus Gittinger |
|
9 | 49 |
" |
100 | 50 |
! ! |
51 |
||
911 | 52 |
!ClassDefinitionChange methodsFor:'accessing'! |
53 |
||
1434 | 54 |
basicSuperClassName |
55 |
^ superClassName |
|
56 |
! |
|
57 |
||
1427 | 58 |
category |
1854 | 59 |
category isNil ifTrue:[ |
60 |
self setupFromSource. |
|
61 |
]. |
|
1427 | 62 |
^ category |
1854 | 63 |
|
64 |
"Modified: / 11-10-2006 / 14:12:01 / cg" |
|
1427 | 65 |
! |
66 |
||
1178 | 67 |
category:something |
68 |
category := something. |
|
69 |
! |
|
70 |
||
1427 | 71 |
classInstanceVariableNames |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
72 |
^ self classInstanceVariableString asCollectionOfWords |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
73 |
! |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
74 |
|
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
75 |
classInstanceVariableNames:aCollectionOfWords |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
76 |
self classInstanceVariableString:(aCollectionOfWords asStringWith:' '). |
1427 | 77 |
! |
78 |
||
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
79 |
classInstanceVariableString |
3744 | 80 |
^ classInstanceVariableString ? '' |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
81 |
! |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
82 |
|
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
83 |
classInstanceVariableString:aString |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
84 |
classInstanceVariableString := aString. |
1427 | 85 |
! |
86 |
||
87 |
classVariableNames |
|
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
88 |
^ self classVariableString asCollectionOfWords |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
89 |
! |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
90 |
|
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
91 |
classVariableNames:aCollectionOfWords |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
92 |
self classVariableString:(aCollectionOfWords asStringWith:' '). |
1427 | 93 |
! |
94 |
||
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
95 |
classVariableString |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
96 |
^ classVariableString |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
97 |
! |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
98 |
|
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
99 |
classVariableString:aString |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
100 |
classVariableString := aString. |
1427 | 101 |
! |
102 |
||
2368 | 103 |
delta |
3446 | 104 |
| changeClass changeSource imageSource | |
105 |
||
2368 | 106 |
|
3446 | 107 |
changeClass := self changeClass. |
108 |
changeClass isNil ifTrue:[^#+]. |
|
109 |
changeSource := self definitionString. |
|
110 |
imageSource := self isPrivateClassDefinitionChange |
|
111 |
ifTrue:[changeClass definition] |
|
112 |
ifFalse:[changeClass definitionWithoutPackage]. |
|
3139
c6eb068647cc
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3111
diff
changeset
|
113 |
|
3446 | 114 |
^ (self class isSource: changeSource |
115 |
sameSourceAs: imageSource) ifTrue:[ #= ] ifFalse:[ #~ ]. |
|
116 |
||
117 |
" |
|
118 |
Tools::TextDiff2Tool openOn: changeSource label: 'Change' and: imageSource label: 'Image' |
|
119 |
" |
|
2504 | 120 |
|
121 |
"Modified: / 31-08-2011 / 09:26:48 / cg" |
|
3446 | 122 |
"Modified: / 04-02-2014 / 20:30:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2504 | 123 |
! |
124 |
||
125 |
deltaDetail |
|
126 |
"Returns a delta to the current state as a ChangeDelta object" |
|
127 |
||
2690 | 128 |
| class mySource imageSource myTree imageTree same | |
2504 | 129 |
|
130 |
class := self changeClass. |
|
131 |
class isNil ifTrue:[^ ChangeDeltaInformation added ]. |
|
2753 | 132 |
class isLoaded ifFalse:[^ ChangeDeltaInformation different ]. |
2504 | 133 |
mySource := self source. |
134 |
imageSource := class definitionWithoutPackage "definition". |
|
2690 | 135 |
same := (mySource = imageSource). |
136 |
same ifFalse:[ |
|
137 |
same := (self class isSource: mySource sameSourceAs: imageSource ). |
|
138 |
same ifFalse:[ |
|
139 |
"/ care for formatting (tabs, indentation etc.) |
|
140 |
myTree := RBParser parseExpression:mySource. |
|
141 |
imageTree := RBParser parseExpression:imageSource. |
|
142 |
same := (myTree = imageTree). |
|
143 |
same ifFalse:[ |
|
3275
e525d31c2a9b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3270
diff
changeset
|
144 |
"/ some classDefinition strings may contain whitespace |
2690 | 145 |
"/ instVarName string like 'foo bar ' instead of 'foo bar' (i.e. added a space)... |
146 |
((myTree receiver = imageTree receiver) |
|
147 |
and:[ (myTree selector = imageTree selector) |
|
148 |
and:[ ('*ubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' match: myTree selector) |
|
149 |
and:[ (myTree arguments at:1) = (imageTree arguments at:1) |
|
150 |
||
151 |
and:[ (2 to:5) conform:[:i | |
|
152 |
((myTree arguments at:i) isLiteral |
|
153 |
and:[ (imageTree arguments at:i) isLiteral |
|
3275
e525d31c2a9b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3270
diff
changeset
|
154 |
and:[ (myTree arguments at:i) value asString asCollectionOfWords |
e525d31c2a9b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3270
diff
changeset
|
155 |
= (imageTree arguments at:i) value asString asCollectionOfWords ]]) ] |
2690 | 156 |
|
157 |
]]]]) |
|
158 |
ifTrue:[ |
|
159 |
same := true |
|
160 |
] |
|
161 |
]. |
|
162 |
] |
|
163 |
]. |
|
164 |
||
165 |
^ same |
|
2504 | 166 |
ifTrue:[ ChangeDeltaInformation identical ] |
167 |
ifFalse:[ ChangeDeltaInformation different ] |
|
168 |
||
169 |
"Created: / 31-08-2011 / 10:26:42 / cg" |
|
2753 | 170 |
"Modified: / 24-01-2012 / 22:13:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2368 | 171 |
! |
172 |
||
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
173 |
imageSource |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
174 |
"return the source for the in-image version of the method" |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
175 |
|
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
176 |
| cls | |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
177 |
|
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
178 |
cls := self changeClass. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
179 |
cls isNil ifTrue:[ ^ nil ]. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
180 |
^ cls definitionWithoutPackage |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
181 |
! |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
182 |
|
3689
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
183 |
indexedType |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
184 |
^ indexedType |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
185 |
! |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
186 |
|
1427 | 187 |
instanceVariableNames |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
188 |
^ self instanceVariableString asCollectionOfWords |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
189 |
! |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
190 |
|
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
191 |
instanceVariableNames:aCollectionOfWords |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
192 |
self instanceVariableString:(aCollectionOfWords asStringWith:' ') |
1427 | 193 |
! |
194 |
||
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
195 |
instanceVariableString |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
196 |
^ instanceVariableString |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
197 |
! |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
198 |
|
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
199 |
instanceVariableString:aString |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
200 |
instanceVariableString := aString. |
1427 | 201 |
! |
202 |
||
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
203 |
localClassName |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
204 |
"for private classes, this returns the name relative to its owner; |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
205 |
for non-private ones, this is the regular name. |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
206 |
Notice that className always returns the full name (incl. any owner prefix)" |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
207 |
|
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
208 |
self isPrivateClassDefinitionChange ifFalse:[^ self className]. |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
209 |
|
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
210 |
(className startsWith:(owningClassName,'::')) ifTrue:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
211 |
^ className copyFrom:(owningClassName size + 2 + 1). |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
212 |
] ifFalse:[ |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
213 |
"/ should not happen |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
214 |
^ self className |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
215 |
] |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
216 |
! |
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
217 |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
218 |
nameSpaceName |
3446 | 219 |
| nm | |
3270
b986056e7fe8
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3245
diff
changeset
|
220 |
|
3446 | 221 |
nm := super nameSpaceName. |
222 |
^nm. |
|
223 |
||
224 |
"/ "/ JV: What is the following good for? Please explain..." |
|
225 |
"/ objectType == #variable ifTrue:[ |
|
226 |
"/ ^ nil |
|
227 |
"/ ]. |
|
228 |
"/ ^ 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
|
229 |
|
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
230 |
"Modified: / 07-09-2011 / 20:47:14 / cg" |
3446 | 231 |
"Modified: / 11-06-2013 / 17:18:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
232 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
233 |
|
1196 | 234 |
nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg |
1854 | 235 |
"this instance setup message is used when reading from a VW-xml change file. |
236 |
Support for this is not yet complete." |
|
237 |
||
3446 | 238 |
| imports | |
1196 | 239 |
|
3446 | 240 |
nameSpaceName := aNameSpaceName. |
911 | 241 |
classType := aClassType. |
1196 | 242 |
otherParameters := Dictionary new addAll:otherParametersArg; yourself. |
3543
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
243 |
private := otherParameters at:#private: ifAbsent:nil. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
244 |
category := otherParameters at:#category: ifAbsent:nil. |
1196 | 245 |
|
3543
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
246 |
aClassType == #defineSharedVariable: ifTrue:[ |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
247 |
] ifFalse:[ |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
248 |
superClassName := otherParameters at:#superclass: ifAbsent:nil. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
249 |
self assert:(superClassName notNil). |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
250 |
superClassName notNil ifTrue:[ |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
251 |
superClassName := superClassName pathString. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
252 |
]. |
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
253 |
indexedType := otherParameters at:#indexedType: ifAbsent:nil. |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
254 |
instanceVariableString := otherParameters at:#instanceVariableNames: ifAbsent:nil. |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
255 |
classInstanceVariableString := otherParameters at:#classInstanceVariableNames: ifAbsent:nil. |
3543
ed4000ee3e21
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3491
diff
changeset
|
256 |
imports := otherParameters at:#imports: ifAbsent:nil. |
1196 | 257 |
]. |
1854 | 258 |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
259 |
"Modified: / 15-06-2010 / 14:50:35 / cg" |
3446 | 260 |
"Modified: / 12-12-2013 / 12:59:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
911 | 261 |
! |
262 |
||
263 |
objectType |
|
264 |
"return the value of the instance variable 'objectType' (automatically generated)" |
|
265 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
266 |
^ objectType |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
267 |
! |
911 | 268 |
|
269 |
objectType:something |
|
270 |
"set the value of the instance variable 'objectType' (automatically generated)" |
|
271 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
272 |
objectType := something. |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
273 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
274 |
|
1427 | 275 |
poolDictionaries |
2832 | 276 |
poolDictionaries isNil ifTrue:[ |
277 |
self setupFromSource. |
|
278 |
]. |
|
1427 | 279 |
^ poolDictionaries |
2832 | 280 |
|
281 |
"Modified: / 13-06-2012 / 12:23:41 / cg" |
|
1427 | 282 |
! |
283 |
||
284 |
poolDictionaries:something |
|
285 |
poolDictionaries := something. |
|
286 |
! |
|
287 |
||
2289 | 288 |
private:aBoolean |
289 |
private := aBoolean. |
|
290 |
||
291 |
"Created: / 30-08-2010 / 13:56:11 / cg" |
|
292 |
! |
|
293 |
||
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
294 |
source |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
295 |
"return the source of the change; |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
296 |
either the original source or a synthesized" |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
297 |
|
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
298 |
|src| |
1196 | 299 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
300 |
(src := source) isNil ifTrue:[ |
1196 | 301 |
src := self definitionString |
302 |
]. |
|
303 |
^ src |
|
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
304 |
|
2900
c21c251db4a0
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
305 |
"Modified: / 10-08-2012 / 11:53:54 / cg" |
1196 | 306 |
! |
307 |
||
308 |
superClassName |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
309 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
310 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
311 |
nm := superClassName. |
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
312 |
nm isNil ifTrue:[^ 'nil']. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
313 |
"/ convert VW namespace syntax |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
314 |
(nm includes:$.) ifTrue:[ |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
315 |
^ nm copyReplaceAll:$. withAll:'::'. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
316 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
317 |
^ nm |
1427 | 318 |
! |
319 |
||
3163
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
320 |
superClassName:aString |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
321 |
superClassName := aString. |
16fdcb5a998b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
322 |
self assert:(aString notNil). |
2207 | 323 |
self invalidateSource. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
324 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
325 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
326 |
superClassNameWithoutMyNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
327 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
328 |
|
1956 | 329 |
superClassName isNil ifTrue:[^ 'nil']. |
330 |
||
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
331 |
nm := self cutMyNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
332 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
333 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
334 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
335 |
^ nm |
1956 | 336 |
|
337 |
"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
|
338 |
! |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
339 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
340 |
superClassNameWithoutNamespace |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
341 |
|nm| |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
342 |
|
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
343 |
nm := self cutNameSpaceOf:superClassName. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
344 |
(nm includes:$.) ifTrue:[ |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
345 |
^ nm copyReplaceAll:$. withAll:'::'. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
346 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
347 |
^ nm |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
348 |
! ! |
911 | 349 |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
350 |
!ClassDefinitionChange methodsFor:'applying'! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
351 |
|
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
352 |
apply |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
353 |
|changeClass sourceWithNamespace| |
3111 | 354 |
|
2425 | 355 |
superClassName isNil ifTrue:[ |
3446 | 356 |
self setupFromSource. |
357 |
]. |
|
358 |
"Some classes have nil superclass (such as Object)..." |
|
359 |
superClassName notNil ifTrue:[ |
|
360 |
(Smalltalk classNamed:superClassName) isNil ifTrue:[ |
|
361 |
Class undeclared:superClassName |
|
3111 | 362 |
]. |
2425 | 363 |
]. |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
364 |
|
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
365 |
"/ here, using the current namespace as provided by the query or the override, |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
366 |
"/ generate a class definition with full names (i.e. incl. ns prefix). |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
367 |
sourceWithNamespace := self source. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
368 |
"/ as the namespace is already in the definition string, make sure that the namespace is not |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
369 |
"/ added twice, by anwering Smalltalk now!! |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
370 |
Class nameSpaceQuerySignal |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
371 |
answer:Smalltalk |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
372 |
do:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
373 |
Parser evaluate:sourceWithNamespace. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
374 |
]. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
375 |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
376 |
package notNil ifTrue:[ |
3111 | 377 |
changeClass := self changeClass. |
378 |
changeClass notNil ifTrue:[ |
|
379 |
changeClass setPackage:package. |
|
380 |
]. |
|
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
381 |
]. |
2368 | 382 |
|
383 |
" |
|
2425 | 384 |
(ClassDefinitionChange className: #TestB source: 'TestA subclass: #TestB |
385 |
instanceVariableNames:'''' |
|
386 |
classVariableNames:'''' |
|
387 |
poolDictionaries:'''' |
|
388 |
category:''* remove me *''') |
|
389 |
apply |
|
2368 | 390 |
" |
391 |
||
2554 | 392 |
"Modified: / 06-10-2011 / 17:01:58 / cg" |
3446 | 393 |
"Modified: / 10-06-2013 / 17:12:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1998
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
394 |
! ! |
06004ad8a6e4
changed #apply - set the packageId
Stefan Vogel <sv@exept.de>
parents:
1956
diff
changeset
|
395 |
|
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
396 |
!ClassDefinitionChange methodsFor:'comparing'! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
397 |
|
3210
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
398 |
isConflict |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
399 |
"true if this change is different than what is already in the image |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
400 |
(i.e. it overwrites some existing code)" |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
401 |
|
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
402 |
|cls| |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
403 |
|
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
404 |
(cls := self changeClass) isNil ifTrue:[^ false]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
405 |
cls superclass name ~= superClassName ifTrue:[ ^ true ]. |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
406 |
cls instanceVariableString ~= instanceVariableString ifTrue:[ ^ true ]. |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
407 |
cls classVariableString ~= classVariableString ifTrue:[ ^ true ]. |
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
408 |
cls class instanceVariableString ~= (classInstanceVariableString ? '') ifTrue:[ ^ true ]. |
3485
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
409 |
cls poolDictionaries ~= poolDictionaries ifTrue:[ ^ true ]. |
3210
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
410 |
cls category ~= category ifTrue:[ ^ true ]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
411 |
cls isPrivate ifTrue:[ |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
412 |
cls owningClass name ~= owningClassName ifTrue:[ ^ true ]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
413 |
]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
414 |
cls definitionSelector ~= self definitionSelector ifTrue:[ ^ true ]. |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
415 |
^ false |
3485
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
416 |
|
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
417 |
"Modified: / 12-02-2014 / 20:25:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3210
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
418 |
! |
ab1729c084da
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3205
diff
changeset
|
419 |
|
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
420 |
isForSameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
421 |
"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
|
422 |
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
|
423 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
424 |
changeB isClassDefinitionChange ifFalse:[^ false]. |
3205 | 425 |
^ self className = changeB className. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
426 |
! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
427 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
428 |
sameAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
429 |
"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
|
430 |
|
798 | 431 |
(self isForSameAs:changeB) ifFalse:[^ false]. |
784
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
432 |
^ self sameSourceAs:changeB |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
433 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
434 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
435 |
|
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
436 |
! ! |
1e50cc7fd07d
added compare methods #sameAs: and #isForSameAs:
Claus Gittinger <cg@exept.de>
parents:
772
diff
changeset
|
437 |
|
2410 | 438 |
!ClassDefinitionChange methodsFor:'converting'! |
439 |
||
440 |
asAntiChange |
|
441 |
||
442 |
^ClassRemoveChange className: self className |
|
443 |
||
444 |
"Created: / 02-11-2009 / 11:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
445 |
! ! |
|
446 |
||
962 | 447 |
!ClassDefinitionChange methodsFor:'printing & storing'! |
787 | 448 |
|
1196 | 449 |
definitionString |
3446 | 450 |
| ns | |
451 |
||
452 |
||
453 |
ns := self nameSpaceName. |
|
454 |
ns isEmptyOrNil ifTrue:[ |
|
455 |
^ self definitionStringInNamespace: ns. |
|
456 |
]. |
|
457 |
^String streamContents:[:s| |
|
458 |
"/ owningClassName isNil ifTrue:[ |
|
459 |
s nextPutAll: '"{ NameSpace: '; nextPutAll: ns; nextPutAll: ' }"'. |
|
460 |
s cr; cr. |
|
461 |
"/ ]. |
|
462 |
s nextPutAll: (self definitionStringInNamespace: ns). |
|
463 |
] |
|
464 |
||
465 |
"Modified: / 13-11-2013 / 17:40:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
466 |
! |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
467 |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
468 |
definitionStringInNamespace: nsOrNil |
3446 | 469 |
| classNameUsed superClassNameUsed selPart ownerNameUsed classNameSymbolString | |
2515
39059cf824a8
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2504
diff
changeset
|
470 |
|
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
471 |
objectType == #variable ifTrue:[ |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
472 |
"/ a visualWorks static variable definition change. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
473 |
"/ kludge to be here - should be a separate StaticVariableDefinitionChange |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
474 |
^ String streamContents:[:stream | |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
475 |
nsOrNil notNil ifTrue:[ |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
476 |
stream nextPutAll:((nsOrNil asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
477 |
] ifFalse:[ |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
478 |
self halt:'can this happen ?'. |
2834 | 479 |
stream nextPutAll:'Smalltalk' |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
480 |
]. |
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
481 |
|
1196 | 482 |
stream |
483 |
nextPutAll:' addClassVarName:'; |
|
1318 | 484 |
nextPutAll:className asString storeString |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
485 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
486 |
]. |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
487 |
|
2554 | 488 |
superClassNameUsed := self superClassName. |
3446 | 489 |
"Strip of namespace" |
490 |
nsOrNil notNil ifTrue:[ |
|
491 |
(superClassNameUsed startsWith: nsOrNil) ifTrue:[ |
|
492 |
superClassNameUsed := superClassNameUsed copyFrom: nsOrNil size + 3 |
|
493 |
]. |
|
494 |
]. |
|
495 |
||
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
496 |
"/ careful with private classes: the definition MUST give the |
3446 | 497 |
"/ local name as argument, not the full name |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
498 |
self isPrivateClassDefinitionChange ifTrue:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
499 |
classNameUsed := self localClassName. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
500 |
] ifFalse:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
501 |
classNameUsed := className. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
502 |
]. |
3150
10fa70a50dfa
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3139
diff
changeset
|
503 |
|
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
504 |
"/ selPart is the subclass:/variableSubclass/variableByteSubclass:/... - part |
2834 | 505 |
selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:') |
506 |
keywords first. |
|
2554 | 507 |
|
3446 | 508 |
(classNameUsed first isLetter not or:[classNameUsed contains:[:c | c isLetterOrDigit not and:[c ~~ $_]]]) ifTrue:[ |
509 |
classNameSymbolString := classNameUsed asSymbol storeString |
|
510 |
] ifFalse:[ |
|
511 |
classNameSymbolString := '#' , classNameUsed. |
|
512 |
]. |
|
513 |
||
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
514 |
^ String streamContents:[:stream | |
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
515 |
stream |
2554 | 516 |
nextPutAll:superClassNameUsed; |
2834 | 517 |
nextPutAll:' ',selPart; |
3446 | 518 |
nextPutLine: classNameSymbolString; |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
519 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
520 |
nextPutAll:'instanceVariableNames:'; |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
521 |
nextPutLine:(instanceVariableString ? '') storeString; |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
522 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
523 |
nextPutAll:'classVariableNames:'; |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
524 |
nextPutLine:(classVariableString ? '') storeString; |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
525 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
526 |
nextPutAll:'poolDictionaries:'; |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
527 |
nextPutLine:(poolDictionaries ? '') storeString. |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
528 |
self isPrivateClassDefinitionChange ifTrue:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
529 |
ownerNameUsed := self owningClassName. |
3446 | 530 |
(nsOrNil isNil or:[nsOrNil ~~ nameSpaceName]) ifTrue:[ |
531 |
(nsOrNil ? nameSpaceName) notNil ifTrue:[ |
|
532 |
ownerNameUsed := (nsOrNil ? nameSpaceName),'::',ownerNameUsed. |
|
533 |
]. |
|
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
534 |
]. |
2831 | 535 |
stream |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
536 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
537 |
nextPutAll:'privateIn:'; |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
538 |
nextPutAll:ownerNameUsed |
2831 | 539 |
] ifFalse:[ |
540 |
stream |
|
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
541 |
tab; |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
542 |
nextPutAll:'category:'; |
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
543 |
nextPutAll:(category ? '') asString storeString |
2831 | 544 |
]. |
1473
a8fe22600414
more support for alien namespaces (VW7)
Claus Gittinger <cg@exept.de>
parents:
1434
diff
changeset
|
545 |
] |
2280
c93519e114c9
fix for namespace: do not add ns twice.
Claus Gittinger <cg@exept.de>
parents:
2207
diff
changeset
|
546 |
|
2834 | 547 |
"Modified: / 13-06-2012 / 13:01:58 / cg" |
3446 | 548 |
"Modified: / 13-11-2013 / 17:13:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1196 | 549 |
! |
550 |
||
3203
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
551 |
definitionStringWithoutNamespace |
2639572248b5
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3163
diff
changeset
|
552 |
"cg - huh - who needs that? (the definitionString already does NOT include the classes namespace)" |
2876 | 553 |
|
554 |
|ns classNameUsed superClassNameUsed| |
|
555 |
||
556 |
ns := self nameSpaceOverride. |
|
557 |
||
558 |
objectType == #variable ifTrue:[ |
|
559 |
^ String streamContents:[:stream | |
|
560 |
ns notNil ifTrue:[ |
|
561 |
stream |
|
562 |
nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::') |
|
563 |
] ifFalse:[ |
|
564 |
self halt:'can this happen ?'. |
|
565 |
stream |
|
566 |
nextPutAll:'Smalltalk' |
|
567 |
]. |
|
568 |
||
569 |
stream |
|
570 |
nextPutAll:' addClassVarName:'; |
|
571 |
nextPutAll:className asString storeString |
|
572 |
]. |
|
573 |
]. |
|
574 |
||
575 |
superClassNameUsed := self superClassName. |
|
576 |
classNameUsed := self classNameWithoutNamespace. |
|
577 |
||
578 |
^ String streamContents:[:stream | |
|
579 |
self isPrivateClassDefinitionChange ifFalse:[ |
|
580 |
stream |
|
581 |
nextPutAll:superClassNameUsed; |
|
582 |
nextPutAll:' subclass:'; |
|
583 |
nextPutAll: classNameUsed asSymbol storeString |
|
584 |
; |
|
585 |
cr; |
|
586 |
tab; |
|
587 |
nextPutAll:'instanceVariableNames:'; |
|
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
588 |
nextPutAll:(instanceVariableString ? '') storeString; |
2876 | 589 |
cr; |
590 |
tab; |
|
591 |
nextPutAll:'classVariableNames:'; |
|
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
592 |
nextPutAll:(classVariableString ? '') storeString; |
2876 | 593 |
cr; |
594 |
tab; |
|
595 |
nextPutAll:'poolDictionaries:'; |
|
596 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
597 |
cr; |
|
598 |
tab; |
|
599 |
nextPutAll:'category:'; |
|
600 |
nextPutAll:(category ? '') storeString; |
|
601 |
cr |
|
602 |
] ifTrue:[ |
|
603 |
stream |
|
604 |
nextPutAll:superClassNameUsed; |
|
605 |
nextPutAll:' subclass:'; |
|
606 |
nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString |
|
607 |
; |
|
608 |
cr; |
|
609 |
tab; |
|
610 |
nextPutAll:'instanceVariableNames:'; |
|
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
611 |
nextPutAll:(instanceVariableString ? '') storeString; |
2876 | 612 |
cr; |
613 |
tab; |
|
614 |
nextPutAll:'classVariableNames:'; |
|
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
615 |
nextPutAll:(classVariableString ? '') storeString; |
2876 | 616 |
cr; |
617 |
tab; |
|
618 |
nextPutAll:'poolDictionaries:'; |
|
619 |
nextPutAll:(poolDictionaries ? '') storeString; |
|
620 |
cr; |
|
621 |
tab; |
|
622 |
nextPutAll:'privateIn:'; |
|
623 |
nextPutAll: |
|
624 |
((ns := self nameSpaceName) isNil |
|
625 |
ifTrue:[owningClassName] |
|
626 |
ifFalse:[owningClassName copyFrom: ns size + 3]); |
|
627 |
cr |
|
628 |
] |
|
629 |
] |
|
630 |
||
631 |
"Modified: / 06-10-2011 / 17:02:05 / cg" |
|
632 |
"Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
633 |
! |
|
634 |
||
1101 | 635 |
printOn:aStream |
1866 | 636 |
aStream |
637 |
nextPutAll:className; nextPutAll:' {definition}' |
|
638 |
||
639 |
"Modified: / 12-10-2006 / 17:48:28 / cg" |
|
1101 | 640 |
! |
641 |
||
896 | 642 |
printWithoutClassNameOn:aStream |
787 | 643 |
aStream nextPutAll:('definition of ' , className) |
644 |
||
645 |
||
646 |
! ! |
|
647 |
||
772 | 648 |
!ClassDefinitionChange methodsFor:'queries'! |
649 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
650 |
definitionSelector |
1854 | 651 |
definitionSelector isNil ifTrue:[ |
652 |
self setupFromSource. |
|
3485
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
653 |
definitionSelector isNil ifTrue:[ |
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
654 |
definitionSelector := #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:' |
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
655 |
]. |
1854 | 656 |
]. |
657 |
^ definitionSelector |
|
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
658 |
|
1854 | 659 |
"Modified: / 11-10-2006 / 14:11:44 / cg" |
3485
d191b20c93a5
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3446
diff
changeset
|
660 |
"Modified: / 12-02-2014 / 20:25:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
661 |
! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
662 |
|
2833 | 663 |
definitionSelector:aSelector |
664 |
definitionSelector := aSelector |
|
665 |
||
666 |
"Created: / 13-06-2012 / 12:45:02 / cg" |
|
667 |
! |
|
668 |
||
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
669 |
fullOwningClassName |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
670 |
"the owner's name, including its namespace" |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
671 |
|
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
672 |
|nm ns| |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
673 |
|
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
674 |
nm := self owningClassName. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
675 |
nm isNil ifTrue:[^ nil]. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
676 |
|
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
677 |
(ns := self nameSpaceOverride) notNil ifTrue:[ |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
678 |
^ ns,'::',nm |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
679 |
]. |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
680 |
^ nm |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
681 |
! |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
682 |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
683 |
owningClassName |
3220
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
684 |
"the owner's name, excluding the namespace" |
a8e24cc171f6
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3210
diff
changeset
|
685 |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
686 |
self isPrivateClassDefinitionChange ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
687 |
owningClassName isNil ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
688 |
self setupFromSource. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
689 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
690 |
]. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
691 |
^ owningClassName |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
692 |
|
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
693 |
"Created: / 12-10-2006 / 23:07:25 / cg" |
2289 | 694 |
! |
695 |
||
696 |
owningClassName:aStringOrSymbol |
|
697 |
owningClassName := aStringOrSymbol |
|
698 |
||
699 |
"Created: / 30-08-2010 / 13:55:37 / cg" |
|
772 | 700 |
! ! |
701 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
702 |
!ClassDefinitionChange methodsFor:'special'! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
703 |
|
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
704 |
installAsAutoloadedClassIfPublicWithFilename:aFilenameString |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
705 |
"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
|
706 |
Skip private classes. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
707 |
Enter class file name as abbreviation" |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
708 |
|
1904 | 709 |
|parseTree sel cat clsName cls catIdx pkg| |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
710 |
|
2289 | 711 |
private == true ifTrue:[^ self]. |
712 |
||
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
713 |
parseTree := Parser parseExpression:self source. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
714 |
parseTree isMessage ifFalse:[ |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
715 |
self error:'bad change source'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
716 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
717 |
|
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
718 |
sel := parseTree selector. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
719 |
(sel endsWith:':privateIn:') ifTrue:[^ self]. |
1418 | 720 |
|
3402
d13a0331a314
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
721 |
catIdx := sel keywords indexOf:'category:'. |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
722 |
catIdx ~~ 0 ifTrue:[ |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
723 |
cat := (parseTree args at:catIdx) evaluate. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
724 |
]. |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
725 |
|
3223
c3c37b9ce3f1
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
726 |
clsName := self fullClassName "className" asSymbol. |
1802 | 727 |
cls := Smalltalk at:clsName. |
1904 | 728 |
|
729 |
pkg := package ? Project current package. |
|
730 |
||
1802 | 731 |
(cls isNil |
732 |
or:[cls isBehavior not |
|
733 |
or:[cls isLoaded not]]) ifTrue:[ |
|
1904 | 734 |
|autoloadedClass| |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
735 |
|
1836 | 736 |
autoloadedClass := Smalltalk |
1395
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
737 |
installAutoloadedClassNamed:clsName |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
738 |
category:cat |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
739 |
package:pkg |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
740 |
revision:nil. |
6ea99b157f6b
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
1318
diff
changeset
|
741 |
aFilenameString notNil ifTrue:[ |
1836 | 742 |
autoloadedClass setClassFilename:aFilenameString. |
743 |
"/ 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
|
744 |
] |
1904 | 745 |
] ifFalse:[ |
746 |
cls notNil ifTrue:[ |
|
747 |
cls isBehavior ifTrue:[ |
|
748 |
cls package ~= pkg ifTrue:[ |
|
3380 | 749 |
Transcript showCR:('Autoloaded class: %1 (%4) not installed (package would change from %2 to %3)' |
750 |
bindWith:clsName with:cls package with:pkg with:aFilenameString). |
|
1904 | 751 |
] |
752 |
]. |
|
753 |
]. |
|
754 |
]. |
|
1836 | 755 |
|
2402
f6799fe6acc4
changed: #installAsAutoloadedClassIfPublicWithFilename:
Claus Gittinger <cg@exept.de>
parents:
2368
diff
changeset
|
756 |
"Modified: / 03-07-2011 / 18:34:05 / cg" |
1854 | 757 |
! |
758 |
||
2207 | 759 |
invalidateSource |
760 |
"internal - flush the sourceString if it got invalidated due to a |
|
761 |
className, superclassName, etc... change" |
|
762 |
||
763 |
source := nil. |
|
764 |
! |
|
765 |
||
1854 | 766 |
setupFromSource |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
767 |
"Extract data from class definition string in source. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
768 |
WARNING: This overwrites values in instvars!!" |
1854 | 769 |
|
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
770 |
|parseTree catIdx poolIdx instVarIdx classVarIdx | |
1854 | 771 |
|
772 |
source notNil ifTrue:[ |
|
773 |
parseTree := Parser parseExpression:source. |
|
1878 | 774 |
(parseTree notNil and:[parseTree isMessage]) ifFalse:[ |
1887 | 775 |
self error:'bad change source' mayProceed:true. |
776 |
^ self |
|
1854 | 777 |
]. |
778 |
||
779 |
definitionSelector := parseTree selector. |
|
780 |
||
781 |
private := (definitionSelector endsWith:':privateIn:'). |
|
1871
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
782 |
private ifTrue:[ |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
783 |
owningClassName := parseTree args last name. |
3daa5601c86e
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1866
diff
changeset
|
784 |
]. |
1854 | 785 |
|
786 |
catIdx := definitionSelector keywords indexOf:'category:'. |
|
787 |
catIdx ~~ 0 ifTrue:[ |
|
788 |
category := (parseTree args at:catIdx) evaluate. |
|
789 |
]. |
|
2368 | 790 |
|
2832 | 791 |
poolIdx := definitionSelector keywords indexOf:'poolDictionaries:'. |
792 |
poolIdx ~~ 0 ifTrue:[ |
|
793 |
poolDictionaries := (parseTree args at:poolIdx) evaluate. |
|
794 |
]. |
|
795 |
||
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
796 |
instVarIdx := definitionSelector keywords indexOf:'instanceVariableNames:'. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
797 |
instVarIdx ~~ 0 ifTrue:[ |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
798 |
instanceVariableString := (parseTree args at:instVarIdx) value. |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
799 |
]. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
800 |
|
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
801 |
classVarIdx := definitionSelector keywords indexOf:'classVariableNames:'. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
802 |
classVarIdx ~~ 0 ifTrue:[ |
3694
401ad8b2ca8b
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3689
diff
changeset
|
803 |
classVariableString := (parseTree args at:classVarIdx) value. |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
804 |
]. |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
805 |
|
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
806 |
|
3446 | 807 |
"Care about nil superclasss (that's valid for certain |
808 |
classes like Object, ProtoObject or custom proxies" |
|
809 |
parseTree receiver isVariable ifTrue:[ |
|
810 |
superClassName := parseTree receiver name. |
|
811 |
] ifFalse:[ |
|
812 |
parseTree receiver isConstant ifTrue:[ |
|
813 |
superClassName := parseTree receiver value. |
|
814 |
superClassName notNil ifTrue:[ |
|
815 |
self error: 'Invalid superclass - can be either a class or nil' |
|
816 |
] |
|
817 |
] |
|
818 |
]. |
|
1854 | 819 |
]. |
820 |
||
821 |
"Created: / 11-10-2006 / 14:10:02 / cg" |
|
2832 | 822 |
"Modified: / 13-06-2012 / 12:25:10 / cg" |
3446 | 823 |
"Modified: / 10-06-2013 / 17:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1134
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
824 |
! ! |
915934e8aab8
care for package; added installAsAutoloaded
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
825 |
|
3491
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
826 |
!ClassDefinitionChange methodsFor:'testing'! |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
827 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
828 |
isClassDefinitionChange |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
829 |
^ true |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
830 |
! |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
831 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
832 |
isOrContainsClassDefinitionChange |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
833 |
^ true |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
834 |
! |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
835 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
836 |
isPrivateClassDefinitionChange |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
837 |
"compute lazily; remember in private" |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
838 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
839 |
private isNil ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
840 |
(className includes:$:) ifFalse:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
841 |
"/ cannot be private |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
842 |
private := false |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
843 |
] ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
844 |
source isNil ifTrue:[^ false ]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
845 |
(source includesString:'private') ifFalse:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
846 |
private := false. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
847 |
] ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
848 |
"/ (self changeClass notNil |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
849 |
"/ and:[self changeClass isLoaded not]) ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
850 |
"/ "/ cannot be private |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
851 |
"/ private := false |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
852 |
"/ ] ifTrue:[ |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
853 |
self setupFromSource. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
854 |
"/ ]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
855 |
]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
856 |
]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
857 |
]. |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
858 |
^ private |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
859 |
|
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
860 |
"Created: / 11-10-2006 / 14:19:03 / cg" |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
861 |
"Modified: / 16-11-2006 / 16:34:19 / cg" |
3689
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
862 |
! |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
863 |
|
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
864 |
isVariable |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
865 |
indexedType notNil ifTrue:[ |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
866 |
self halt. |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
867 |
^ true. |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
868 |
]. |
4d94248f61ed
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
869 |
^ false. |
3491
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
870 |
! ! |
39ab3f1bc8fa
category change for isXXX testers;
Claus Gittinger <cg@exept.de>
parents:
3485
diff
changeset
|
871 |
|
2614
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
872 |
!ClassDefinitionChange methodsFor:'visiting'! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
873 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
874 |
acceptChangeVisitor:aVisitor |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
875 |
^ aVisitor visitClassDefinitionChange:self. |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
876 |
|
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
877 |
"Created: / 25-11-2011 / 17:13:13 / cg" |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
878 |
! ! |
7d342615bb66
visitor support (for monticello);
Claus Gittinger <cg@exept.de>
parents:
2554
diff
changeset
|
879 |
|
100 | 880 |
!ClassDefinitionChange class methodsFor:'documentation'! |
881 |
||
2518 | 882 |
version |
3744 | 883 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.93 2015-02-03 16:33:21 stefan Exp $' |
3223
c3c37b9ce3f1
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
884 |
! |
c3c37b9ce3f1
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
885 |
|
c3c37b9ce3f1
class: ClassDefinitionChange
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
886 |
version_CVS |
3744 | 887 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.93 2015-02-03 16:33:21 stefan Exp $' |
3245
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
888 |
! |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
889 |
|
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
890 |
version_HG |
a0e79ed3aa65
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3223
diff
changeset
|
891 |
|
3270
b986056e7fe8
class: ClassDefinitionChange
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3245
diff
changeset
|
892 |
^ '$Changeset: <not expanded> $' |
2180
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
893 |
! |
c952a3ae234d
changed: #installAsAutoloadedClassIfPublicWithFilename:
Stefan Vogel <sv@exept.de>
parents:
2093
diff
changeset
|
894 |
|
2368 | 895 |
version_SVN |
3744 | 896 |
^ '$Id: ClassDefinitionChange.st,v 1.93 2015-02-03 16:33:21 stefan Exp $' |
100 | 897 |
! ! |
3111 | 898 |