author | ps |
Fri, 14 Jan 2000 09:11:38 +0100 | |
changeset 878 | 99583ccfe415 |
parent 877 | 0340af2075f3 |
child 879 | bfd06666f6c1 |
permissions | -rw-r--r-- |
3 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
16 | 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 |
" |
|
0 | 12 |
|
13 |
OrderedCollection subclass:#ChangeSet |
|
235 | 14 |
instanceVariableNames:'' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'System-Changes' |
|
0 | 18 |
! |
19 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
20 |
!ChangeSet class methodsFor:'documentation'! |
9 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
16 | 25 |
All Rights Reserved |
9 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
used in the changes management to keep track of changes |
|
235 | 39 |
|
40 |
[author:] |
|
41 |
Claus Gittinger |
|
9 | 42 |
" |
43 |
! ! |
|
44 |
||
654 | 45 |
!ChangeSet class methodsFor:'instance creation'! |
46 |
||
47 |
fromStream:aStream |
|
48 |
"build a changeSet from a stream, containing chunks. |
|
49 |
(i.e. either a classes sourceFile or a change-file). |
|
50 |
Return the changeSet." |
|
51 |
||
859 | 52 |
|changeSet chunk sawExcla lastTimeStamp s change nameSpace| |
654 | 53 |
|
54 |
changeSet := self new. |
|
859 | 55 |
nameSpace := Smalltalk. |
654 | 56 |
|
57 |
[aStream atEnd] whileFalse:[ |
|
58 |
aStream skipSeparators. |
|
59 |
sawExcla := aStream peekFor:$!!. |
|
60 |
chunk := aStream nextChunk. |
|
61 |
(chunk notNil and:[chunk notEmpty]) ifTrue:[ |
|
859 | 62 |
Class nameSpaceQuerySignal answer:nameSpace do:[ |
63 |
|parser tree| |
|
64 |
||
65 |
parser := Parser for:chunk. |
|
66 |
tree := parser |
|
67 |
parseExpressionWithSelf:nil |
|
68 |
notifying:nil |
|
69 |
ignoreErrors:true |
|
70 |
ignoreWarnings:true |
|
71 |
inNameSpace:nameSpace. |
|
72 |
tree == #Error ifTrue:[ |
|
73 |
change := DoItChange new. |
|
74 |
change source:chunk. |
|
75 |
changeSet add: change. |
|
76 |
] ifFalse:[ |
|
77 |
(tree notNil and:[tree ~~ #Error]) ifTrue:[ |
|
78 |
"/ if there is any nameSPace directoive in there, extract it. |
|
79 |
parser currentNameSpace notNil ifTrue:[ |
|
80 |
nameSpace := parser currentNameSpace |
|
81 |
]. |
|
82 |
Class nameSpaceQuerySignal answer:nameSpace do:[ |
|
83 |
"/ |
|
84 |
"/ what type of chunk is this ... |
|
85 |
"/ |
|
86 |
tree isConstant ifTrue:[ |
|
87 |
(s := tree evaluate) isString ifTrue:[ |
|
88 |
(s startsWith:'---- timestamp ') ifTrue:[ |
|
89 |
lastTimeStamp := s. |
|
90 |
] |
|
91 |
] ifFalse:[ |
|
92 |
self halt:'unexpected change-chunk' |
|
93 |
] |
|
94 |
] ifFalse:[ |
|
95 |
tree isMessage ifTrue:[ |
|
96 |
(changeSet addFromParseTree:tree andStream:aStream) ifFalse:[ |
|
97 |
change := DoItChange new. |
|
98 |
change source:chunk. |
|
99 |
changeSet add: change. |
|
100 |
] |
|
101 |
] ifFalse:[ |
|
102 |
self halt:'unexpected change-chunk' |
|
103 |
] |
|
654 | 104 |
] |
105 |
] |
|
106 |
] |
|
107 |
] |
|
108 |
] |
|
109 |
] |
|
110 |
]. |
|
111 |
^ changeSet |
|
112 |
||
113 |
" |
|
114 |
ChangeSet fromStream:('changes' asFilename readStream) |
|
115 |
ChangeSet fromStream:('patches' asFilename readStream) |
|
116 |
ChangeSet fromStream:(Object source asString readStream) |
|
117 |
" |
|
118 |
||
119 |
"Created: / 16.2.1998 / 12:19:34 / cg" |
|
859 | 120 |
"Modified: / 14.12.1999 / 15:23:16 / cg" |
654 | 121 |
! ! |
122 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
123 |
!ChangeSet class methodsFor:'ST80 compatibility'! |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
124 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
125 |
patches |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
126 |
^ #() |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
127 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
128 |
"Created: / 27.10.1997 / 13:52:54 / cg" |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
129 |
! ! |
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
130 |
|
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
131 |
!ChangeSet class methodsFor:'queries'! |
27 | 132 |
|
133 |
current |
|
134 |
"ST-80 compatibility: return the current changeSet" |
|
135 |
||
136 |
|p| |
|
137 |
||
138 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
139 |
^ p changeSet |
|
140 |
] |
|
141 |
||
142 |
" |
|
143 |
ChangeSet current |
|
144 |
" |
|
145 |
! ! |
|
146 |
||
0 | 147 |
!ChangeSet methodsFor:'change management'! |
148 |
||
100 | 149 |
addClassCategoryChange:newCategory for:aClass |
378 | 150 |
"add a classCategory change to the receiver" |
151 |
||
100 | 152 |
|newChange| |
153 |
||
154 |
newChange := ClassCategoryChange class:aClass category:newCategory. |
|
155 |
self add:newChange |
|
156 |
||
157 |
"Created: 3.12.1995 / 13:45:53 / cg" |
|
378 | 158 |
"Modified: 15.7.1996 / 09:26:52 / cg" |
100 | 159 |
! |
160 |
||
161 |
addClassDefinitionChangeFor:aClass |
|
378 | 162 |
"add a classDefinition change to the receiver" |
163 |
||
100 | 164 |
|newChange| |
165 |
||
166 |
newChange := ClassDefinitionChange class:aClass. |
|
787 | 167 |
newChange source:aClass definition. |
100 | 168 |
self add:newChange |
169 |
||
378 | 170 |
"Modified: 15.7.1996 / 09:27:05 / cg" |
100 | 171 |
! |
172 |
||
16 | 173 |
addMethodCategoryChange:aMethod category:newCategory in:aClass |
378 | 174 |
"add a methodCategory change to the receiver" |
175 |
||
16 | 176 |
|newChange| |
177 |
||
178 |
newChange := MethodCategoryChange class:aClass |
|
378 | 179 |
selector:(aClass selectorAtMethod:aMethod) |
180 |
category:newCategory. |
|
16 | 181 |
self add:newChange |
182 |
||
378 | 183 |
"Modified: 15.7.1996 / 09:27:15 / cg" |
44 | 184 |
! |
185 |
||
85 | 186 |
addMethodChange:aMethod in:aClass |
378 | 187 |
"add a method change to the receiver" |
188 |
||
85 | 189 |
|newChange| |
190 |
||
191 |
newChange := MethodChange class:aClass |
|
378 | 192 |
selector:(aClass selectorAtMethod:aMethod) |
193 |
source:aMethod source |
|
194 |
category:aMethod category. |
|
85 | 195 |
self add:newChange |
378 | 196 |
|
197 |
"Modified: 15.7.1996 / 09:27:21 / cg" |
|
85 | 198 |
! |
199 |
||
44 | 200 |
addMethodPrivacyChange:aMethod in:aClass |
378 | 201 |
"add a methodPrivacy change to the receiver" |
202 |
||
44 | 203 |
|newChange| |
204 |
||
205 |
newChange := MethodPrivacyChange class:aClass |
|
378 | 206 |
selector:(aClass selectorAtMethod:aMethod) |
207 |
privacy:aMethod privacy. |
|
44 | 208 |
self add:newChange |
209 |
||
210 |
"Modified: 27.8.1995 / 22:55:22 / claus" |
|
378 | 211 |
"Modified: 15.7.1996 / 09:27:28 / cg" |
235 | 212 |
! |
213 |
||
214 |
addPrimitiveDefinitionsChangeFor:aClass |
|
378 | 215 |
"add a primitiveDefinitions change to the receiver" |
216 |
||
235 | 217 |
|newChange| |
218 |
||
783 | 219 |
newChange := ClassPrimitiveDefinitionsChange new |
220 |
class:aClass name source:aClass primitiveDefinitionsString. |
|
235 | 221 |
self add:newChange |
378 | 222 |
|
223 |
"Modified: 15.7.1996 / 09:27:40 / cg" |
|
235 | 224 |
! |
225 |
||
226 |
addPrimitiveFunctionsChangeFor:aClass |
|
378 | 227 |
"add a primitiveFunctions change to the receiver" |
228 |
||
235 | 229 |
|newChange| |
230 |
||
783 | 231 |
newChange := ClassPrimitiveFunctionsChange new |
232 |
class:aClass name source:aClass primitiveFunctionsString. |
|
235 | 233 |
self add:newChange |
378 | 234 |
|
235 |
"Modified: 15.7.1996 / 09:27:47 / cg" |
|
235 | 236 |
! |
237 |
||
238 |
addPrimitiveVariablesChangeFor:aClass |
|
378 | 239 |
"add a primitiveVariables change to the receiver" |
240 |
||
235 | 241 |
|newChange| |
242 |
||
783 | 243 |
newChange := ClassPrimitiveVariablesChange new |
244 |
class:aClass name source:aClass primitiveVariablesString. |
|
235 | 245 |
self add:newChange |
378 | 246 |
|
247 |
"Modified: 15.7.1996 / 09:27:55 / cg" |
|
654 | 248 |
! |
249 |
||
250 |
addRemoveSelectorChange:aSelector in:aClass |
|
251 |
"add a method-remove change to the receiver" |
|
252 |
||
253 |
|newChange| |
|
254 |
||
255 |
newChange := MethodRemoveChange |
|
256 |
class:aClass |
|
257 |
selector:aSelector. |
|
258 |
self add:newChange |
|
259 |
||
260 |
"Modified: / 27.8.1995 / 22:55:22 / claus" |
|
261 |
"Modified: / 15.7.1996 / 09:27:28 / cg" |
|
262 |
"Created: / 16.2.1998 / 12:47:07 / cg" |
|
877 | 263 |
! |
264 |
||
265 |
condenseChangesForClass:aClass package:package |
|
266 |
"to be implemented soon" |
|
0 | 267 |
! ! |
268 |
||
85 | 269 |
!ChangeSet methodsFor:'misc'! |
270 |
||
271 |
addPatch:nameOfPatch |
|
272 |
"ignored for now - allows fileIn of ST-80 patch stuff .." |
|
273 |
||
274 |
^ self |
|
275 |
! ! |
|
276 |
||
654 | 277 |
!ChangeSet methodsFor:'private'! |
278 |
||
279 |
addFromParseTree:aTree andStream:aStream |
|
280 |
|sel className categoryName |
|
281 |
methodSource methodSelector change parser |
|
775 | 282 |
oldName newName priv receiver receiverVarName |
859 | 283 |
receiverSelector receiverReceiver primSource |
284 |
nameSpace| |
|
285 |
||
860 | 286 |
nameSpace := Class nameSpaceQuerySignal query. |
859 | 287 |
nameSpace isNil ifTrue:[nameSpace := Smalltalk]. |
654 | 288 |
|
289 |
sel := aTree selector. |
|
775 | 290 |
receiver := aTree receiver. |
291 |
receiver isMessage ifTrue:[ |
|
292 |
receiverSelector := receiver selector. |
|
293 |
receiverReceiver := receiver receiver. |
|
294 |
] ifFalse:[ |
|
295 |
receiver isVariable ifTrue:[ |
|
296 |
receiverVarName := receiver name |
|
297 |
] |
|
298 |
]. |
|
299 |
||
654 | 300 |
(sel == #'methodsFor:' |
301 |
or:[(sel == #'ignoredMethodsFor:')]) ifTrue:[ |
|
302 |
(sel == #'ignoredMethodsFor:') ifTrue:[ |
|
303 |
priv := #ignored. |
|
304 |
] ifFalse:[ |
|
305 |
priv := nil |
|
306 |
]. |
|
775 | 307 |
(receiver isUnaryMessage |
308 |
and:[receiverSelector == #class]) ifTrue:[ |
|
309 |
className := (receiverReceiver name) , ' class'. |
|
654 | 310 |
] ifFalse:[ |
775 | 311 |
className := (receiver name). |
654 | 312 |
]. |
859 | 313 |
nameSpace ~~ Smalltalk ifTrue:[ |
314 |
className := nameSpace name , '::' , className |
|
315 |
]. |
|
654 | 316 |
categoryName := (aTree arguments at:1) evaluate. |
317 |
||
318 |
aStream skipSeparators. |
|
319 |
methodSource := aStream nextChunk. |
|
320 |
[methodSource notEmpty] whileTrue:[ |
|
321 |
parser := Parser |
|
789
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
322 |
parseMethodArgAndVarSpecification:methodSource |
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
323 |
in:nil |
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
324 |
ignoreErrors:true |
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
325 |
ignoreWarnings:true |
f5dd39d0653e
dont parse the methods body, if all we need is the selector.
Claus Gittinger <cg@exept.de>
parents:
787
diff
changeset
|
326 |
parseBody:false. |
654 | 327 |
|
829
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
328 |
parser isNil ifTrue:[ |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
329 |
"/ something wierd ... |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
330 |
methodSelector := '????'. |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
331 |
] ifFalse:[ |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
332 |
methodSelector := parser selector. |
1e701ca3c59f
care for unparsable stuff (java methods)
Claus Gittinger <cg@exept.de>
parents:
802
diff
changeset
|
333 |
]. |
654 | 334 |
|
335 |
change := MethodChange new. |
|
336 |
change |
|
337 |
className:className |
|
338 |
selector:methodSelector |
|
339 |
source:methodSource |
|
340 |
category:categoryName |
|
341 |
privacy:priv. |
|
342 |
self add: change. |
|
343 |
||
344 |
aStream skipSeparators. |
|
345 |
methodSource := aStream nextChunk. |
|
346 |
]. |
|
347 |
^ true |
|
348 |
]. |
|
349 |
||
350 |
sel == #'removeSelector:' ifTrue:[ |
|
775 | 351 |
(receiver isUnaryMessage |
352 |
and:[receiverSelector == #class]) ifTrue:[ |
|
353 |
className := (receiverReceiver name) , ' class'. |
|
654 | 354 |
] ifFalse:[ |
775 | 355 |
className := (receiver name). |
654 | 356 |
]. |
859 | 357 |
nameSpace ~~ Smalltalk ifTrue:[ |
358 |
className := nameSpace name , '::' , className |
|
359 |
]. |
|
654 | 360 |
methodSelector := (aTree arguments at:1) evaluate. |
361 |
change := MethodRemoveChange new. |
|
362 |
change |
|
363 |
className:className |
|
364 |
selector:methodSelector. |
|
365 |
self add: change. |
|
366 |
^ true |
|
367 |
]. |
|
368 |
||
787 | 369 |
"/ any subclass definiton selector ? |
802 | 370 |
(Behavior definitionSelectors includes:sel) |
787 | 371 |
ifTrue:[ |
654 | 372 |
className := (aTree arguments at:1) evaluate. |
859 | 373 |
nameSpace ~~ Smalltalk ifTrue:[ |
374 |
className := nameSpace name , '::' , className |
|
375 |
]. |
|
654 | 376 |
change := ClassDefinitionChange new. |
377 |
change |
|
378 |
className:className; |
|
379 |
source:(aTree printString). |
|
380 |
self add: change. |
|
381 |
^ true |
|
382 |
]. |
|
383 |
||
384 |
sel == #'renameCategory:to:' ifTrue:[ |
|
775 | 385 |
(receiver isUnaryMessage |
386 |
and:[receiverSelector == #class]) ifTrue:[ |
|
387 |
className := (receiverReceiver name) , ' class'. |
|
654 | 388 |
] ifFalse:[ |
775 | 389 |
className := (receiver name). |
654 | 390 |
]. |
859 | 391 |
nameSpace ~~ Smalltalk ifTrue:[ |
392 |
className := nameSpace name , '::' , className |
|
393 |
]. |
|
654 | 394 |
change := MethodCategoryRenameChange new. |
395 |
change |
|
396 |
className:className; |
|
397 |
oldCategoryName:(aTree arguments at:1) evaluate |
|
398 |
newCategoryName:(aTree arguments at:2) evaluate. |
|
399 |
self add: change. |
|
400 |
^ true |
|
401 |
]. |
|
402 |
||
403 |
(sel == #'category:' |
|
404 |
or:[sel == #'privacy:']) ifTrue:[ |
|
775 | 405 |
(receiver isMessage |
406 |
and:[receiverSelector == #'compiledMethodAt:']) ifTrue:[ |
|
407 |
(receiverReceiver isUnaryMessage |
|
408 |
and:[receiverReceiver selector == #class]) ifTrue:[ |
|
409 |
className := (receiverReceiver receiver name) , ' class'. |
|
654 | 410 |
] ifFalse:[ |
775 | 411 |
className := (receiverReceiver name). |
654 | 412 |
]. |
859 | 413 |
nameSpace ~~ Smalltalk ifTrue:[ |
414 |
className := nameSpace name , '::' , className |
|
415 |
]. |
|
775 | 416 |
methodSelector := (receiver arguments at:1) evaluate. |
654 | 417 |
|
418 |
sel == #'category:' ifTrue:[ |
|
419 |
change := MethodCategoryChange new. |
|
420 |
change |
|
421 |
className:className |
|
422 |
selector:methodSelector |
|
423 |
category:(aTree arguments at:1) evaluate. |
|
424 |
] ifFalse:[ |
|
425 |
change := MethodPrivacyChange new. |
|
426 |
change |
|
427 |
className:className |
|
428 |
selector:methodSelector |
|
429 |
privacy:(aTree arguments at:1) evaluate. |
|
430 |
]. |
|
431 |
||
432 |
self add: change. |
|
433 |
^ true |
|
434 |
] ifFalse:[ |
|
798 | 435 |
self halt:'unexpected change' |
654 | 436 |
]. |
437 |
]. |
|
438 |
||
439 |
sel == #'comment:' ifTrue:[ |
|
775 | 440 |
(receiver isUnaryMessage |
441 |
and:[receiverSelector == #class]) ifTrue:[ |
|
442 |
className := (receiverReceiver name) , ' class'. |
|
654 | 443 |
] ifFalse:[ |
775 | 444 |
className := (receiver name). |
654 | 445 |
]. |
859 | 446 |
nameSpace ~~ Smalltalk ifTrue:[ |
447 |
className := nameSpace name , '::' , className |
|
448 |
]. |
|
654 | 449 |
|
450 |
change := ClassCommentChange new. |
|
451 |
change |
|
452 |
className:className |
|
453 |
comment:(aTree arguments at:1) evaluate. |
|
775 | 454 |
change source:(aTree printString). |
654 | 455 |
self add: change. |
456 |
^ true |
|
457 |
]. |
|
458 |
||
798 | 459 |
sel == #'instanceVariableNames:' ifTrue:[ |
460 |
(receiver isUnaryMessage |
|
461 |
and:[receiverSelector == #class]) ifTrue:[ |
|
462 |
className := (receiverReceiver name) , ' class'. |
|
463 |
] ifFalse:[ |
|
464 |
className := (receiver name). |
|
465 |
]. |
|
859 | 466 |
nameSpace ~~ Smalltalk ifTrue:[ |
467 |
className := nameSpace name , '::' , className |
|
468 |
]. |
|
798 | 469 |
change := ClassInstVarDefinitionChange new. |
470 |
change className:className. |
|
471 |
change source:(aTree printString). |
|
472 |
self add: change. |
|
473 |
^ true |
|
474 |
]. |
|
475 |
||
654 | 476 |
sel == #'removeClass:' ifTrue:[ |
775 | 477 |
(receiverVarName == #Smalltalk) ifTrue:[ |
654 | 478 |
className := (aTree arguments at:1) name. |
859 | 479 |
nameSpace ~~ Smalltalk ifTrue:[ |
480 |
className := nameSpace name , '::' , className |
|
481 |
]. |
|
654 | 482 |
|
483 |
change := ClassRemoveChange new. |
|
484 |
change className:className. |
|
485 |
self add: change. |
|
486 |
^ true |
|
487 |
] ifFalse:[ |
|
488 |
self halt |
|
489 |
]. |
|
490 |
]. |
|
491 |
||
492 |
sel == #'renameClass:to:' ifTrue:[ |
|
775 | 493 |
(receiverVarName == #Smalltalk) ifTrue:[ |
654 | 494 |
oldName := (aTree arguments at:1) name. |
495 |
newName := (aTree arguments at:2) evaluate. |
|
496 |
||
497 |
change := ClassRenameChange new. |
|
498 |
change oldName:oldName newName:newName. |
|
499 |
self add: change. |
|
500 |
^ true |
|
501 |
] ifFalse:[ |
|
502 |
self halt |
|
503 |
]. |
|
504 |
]. |
|
505 |
||
506 |
sel == #'name:' ifTrue:[ |
|
775 | 507 |
(receiverVarName == #Namespace) ifTrue:[ |
654 | 508 |
className := (aTree arguments at:1) evaluate. |
509 |
||
510 |
change := NameSpaceCreationChange new. |
|
511 |
change name:className. |
|
512 |
self add: change. |
|
513 |
^ true |
|
514 |
] ifFalse:[ |
|
515 |
self halt |
|
516 |
]. |
|
517 |
]. |
|
518 |
||
781 | 519 |
(sel == #'primitiveDefinitions' |
520 |
or:[sel == #'primitiveFunctions' |
|
521 |
or:[sel == #'primitiveVariables']]) ifTrue:[ |
|
522 |
(receiver isUnaryMessage |
|
523 |
and:[receiverSelector == #class]) ifTrue:[ |
|
524 |
className := (receiverReceiver name) , ' class'. |
|
525 |
] ifFalse:[ |
|
526 |
className := (receiver name). |
|
527 |
]. |
|
859 | 528 |
nameSpace ~~ Smalltalk ifTrue:[ |
529 |
className := nameSpace name , '::' , className |
|
530 |
]. |
|
781 | 531 |
|
532 |
aStream skipSeparators. |
|
533 |
primSource := aStream nextChunk. |
|
534 |
||
535 |
sel == #'primitiveDefinitions' ifTrue:[ |
|
536 |
change := ClassPrimitiveDefinitionsChange new |
|
537 |
] ifFalse:[ |
|
538 |
sel == #'primitiveFunctions' ifTrue:[ |
|
539 |
change := ClassPrimitiveFunctionsChange new |
|
540 |
] ifFalse:[ |
|
541 |
change := ClassPrimitiveVariablesChange new |
|
542 |
] |
|
543 |
]. |
|
783 | 544 |
change class:className source:primSource. |
781 | 545 |
self add: change. |
546 |
||
547 |
^ true |
|
548 |
]. |
|
549 |
||
654 | 550 |
^ false |
551 |
||
552 |
"Created: / 16.2.1998 / 13:42:40 / cg" |
|
860 | 553 |
"Modified: / 15.12.1999 / 00:29:06 / cg" |
654 | 554 |
! ! |
555 |
||
857 | 556 |
!ChangeSet methodsFor:'utilities'! |
557 |
||
878 | 558 |
apply |
559 |
"apply all changes in the receivers changeSet" |
|
560 |
||
561 |
self do:[:aChange | |
|
562 |
aChange apply |
|
563 |
] |
|
564 |
! |
|
565 |
||
566 |
condenseChangesForClass:aClass package:aPackageSymbol |
|
567 |
"remove all changes for aClass and aPackageSymbol |
|
568 |
(i.e. leave methodChanges for other packages" |
|
569 |
||
570 |
|changesToRemove| |
|
571 |
||
572 |
changesToRemove := OrderedCollection new. |
|
573 |
self do:[:aChange | |
|
574 |
aChange changeClass name = aClass name ifTrue:[ |
|
575 |
changesToRemove add:aChange |
|
576 |
] |
|
577 |
]. |
|
578 |
self removeAll:changesToRemove |
|
579 |
||
580 |
! |
|
581 |
||
857 | 582 |
diffSetsAgainst:anotherChangeSet |
583 |
"walk over the receiver and anotherChangeSet, |
|
584 |
add all changes to one of the tree lists: |
|
585 |
onlyInReceiver, onlyInArg or changed, |
|
864 | 586 |
each being a changeSet containing corresponding changes." |
857 | 587 |
|
588 |
|onlyInReceiver onlyInArg changedMethods |
|
589 |
indexFromChangedMethodsToA indexFromChangedMethodsToB |
|
864 | 590 |
"info" ret| |
857 | 591 |
|
592 |
onlyInReceiver := ChangeSet new. |
|
593 |
onlyInArg := ChangeSet new. |
|
594 |
changedMethods := ChangeSet new. |
|
595 |
||
596 |
indexFromChangedMethodsToA := OrderedCollection new. |
|
597 |
indexFromChangedMethodsToB := OrderedCollection new. |
|
598 |
||
599 |
self keysAndValuesDo:[:idxA :aChangeInA | |
|
600 |
|anyFound ch| |
|
601 |
||
602 |
anyFound := false. |
|
603 |
||
604 |
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB | |
|
605 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
|
606 |
anyFound := true. |
|
607 |
||
608 |
"/ also in B - is it different ? |
|
609 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
|
610 |
changedMethods add:aChangeInA. |
|
611 |
indexFromChangedMethodsToA add:idxA. |
|
612 |
indexFromChangedMethodsToB add:idxB. |
|
613 |
] ifTrue:[ |
|
614 |
aChangeInA isMethodChange ifTrue:[ |
|
615 |
aChangeInA methodCategory ~= aChangeInB methodCategory ifTrue:[ |
|
616 |
"/ only the category is different; |
|
617 |
"/ make it a MethodCategory changes. |
|
618 |
||
619 |
ch := MethodCategoryChange new |
|
620 |
className:aChangeInA className |
|
621 |
selector:aChangeInA selector |
|
622 |
category:aChangeInA methodCategory. |
|
623 |
self at:idxA put:ch. |
|
624 |
||
625 |
ch := MethodCategoryChange new |
|
626 |
className:aChangeInB className |
|
627 |
selector:aChangeInB selector |
|
628 |
category:aChangeInB methodCategory. |
|
629 |
anotherChangeSet at:idxB put:ch. |
|
630 |
||
631 |
changedMethods add:aChangeInA. |
|
632 |
indexFromChangedMethodsToA add:idxA. |
|
633 |
indexFromChangedMethodsToB add:idxB. |
|
634 |
] |
|
635 |
]. |
|
636 |
] |
|
637 |
] ifFalse:[ |
|
638 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
|
639 |
anyFound := true. |
|
640 |
] ifFalse:[ |
|
641 |
] |
|
642 |
] |
|
643 |
]. |
|
644 |
||
645 |
anyFound ifFalse:[ |
|
646 |
onlyInReceiver add:aChangeInA. |
|
647 |
] |
|
648 |
]. |
|
649 |
||
650 |
anotherChangeSet keysAndValuesDo:[:idxB :aChangeInB | |
|
651 |
|anyFound| |
|
652 |
||
653 |
anyFound := false. |
|
654 |
||
655 |
self do:[:aChangeInA | |
|
656 |
|idxM| |
|
657 |
||
658 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
|
659 |
anyFound := true. |
|
660 |
||
661 |
"/ also in B - is it different ? |
|
662 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
|
663 |
"/ already there ? |
|
664 |
idxM := changedMethods findFirst:[:c | c isForSameAs:aChangeInB]. |
|
665 |
idxM == 0 ifTrue:[ |
|
666 |
changedMethods add:aChangeInB. |
|
667 |
indexFromChangedMethodsToB add:idxB. |
|
668 |
] ifFalse:[ |
|
669 |
indexFromChangedMethodsToB at:idxM put:idxB |
|
670 |
] |
|
671 |
] |
|
672 |
] ifFalse:[ |
|
673 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
|
674 |
anyFound := true. |
|
675 |
] ifFalse:[ |
|
676 |
] |
|
677 |
] |
|
678 |
]. |
|
679 |
anyFound ifFalse:[ |
|
680 |
onlyInArg add:aChangeInB. |
|
681 |
] |
|
682 |
]. |
|
683 |
||
864 | 684 |
"/ info := OrderedCollection new:(changedMethods size). |
685 |
"/ changedMethods keysAndValuesDo:[:idx :changedMethod | |
|
686 |
"/ info add:(Array |
|
687 |
"/ with:(indexFromChangedMethodsToA at:idx) |
|
688 |
"/ with:(indexFromChangedMethodsToB at:idx) |
|
689 |
"/ ) |
|
690 |
"/ ]. |
|
857 | 691 |
changedMethods := (1 to:changedMethods size) collect:[:idx | |
692 |
|cA cB| |
|
693 |
||
694 |
cA := self at:(indexFromChangedMethodsToA at:idx). |
|
695 |
cB := anotherChangeSet at:(indexFromChangedMethodsToB at:idx). |
|
696 |
Array with:cA with:cB |
|
697 |
]. |
|
698 |
||
699 |
ret := IdentityDictionary new. |
|
864 | 700 |
"/ ret at:#info put:info. |
857 | 701 |
ret at:#changed put:changedMethods. |
702 |
ret at:#onlyInReceiver put:onlyInReceiver. |
|
703 |
ret at:#onlyInArg put:onlyInArg. |
|
864 | 704 |
^ret |
857 | 705 |
! ! |
706 |
||
625
06f4ed35832b
added #patches for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
378
diff
changeset
|
707 |
!ChangeSet class methodsFor:'documentation'! |
100 | 708 |
|
709 |
version |
|
878 | 710 |
^ '$Header: /cvs/stx/stx/libbasic3/ChangeSet.st,v 1.35 2000-01-14 08:11:38 ps Exp $' |
100 | 711 |
! ! |