equal
deleted
inserted
replaced
45 [author:] |
45 [author:] |
46 Claus Gittinger |
46 Claus Gittinger |
47 " |
47 " |
48 ! ! |
48 ! ! |
49 |
49 |
|
50 |
50 !ClassDefinitionChange class methodsFor:'others'! |
51 !ClassDefinitionChange class methodsFor:'others'! |
51 |
52 |
52 version_CVS |
53 version_CVS |
53 ^ '§Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.72 2012/08/10 10:09:30 cg Exp §' |
54 ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.75 2013-03-27 18:18:21 cg Exp $' |
54 ! ! |
55 ! ! |
|
56 |
55 |
57 |
56 !ClassDefinitionChange methodsFor:'accessing'! |
58 !ClassDefinitionChange methodsFor:'accessing'! |
57 |
59 |
58 basicSuperClassName |
60 basicSuperClassName |
59 ^ superClassName |
61 ^ superClassName |
87 classVariableNames:something |
89 classVariableNames:something |
88 classVariableNames := something. |
90 classVariableNames := something. |
89 ! |
91 ! |
90 |
92 |
91 delta |
93 delta |
92 |
|
93 | class | |
94 | class | |
|
95 |
94 class := self changeClass. |
96 class := self changeClass. |
95 class ifNil:[^#+]. |
97 class ifNil:[^#+]. |
|
98 |
96 ^(self class isSource: self source sameSourceAs: class definitionWithoutPackage "definition") |
99 ^(self class isSource: self source sameSourceAs: class definitionWithoutPackage "definition") |
97 ifTrue:[#=] |
100 ifTrue:[#=] |
98 ifFalse:[#~] |
101 ifFalse:[#~] |
99 |
102 |
100 "Modified: / 31-08-2011 / 09:26:48 / cg" |
103 "Modified: / 31-08-2011 / 09:26:48 / cg" |
154 |
157 |
155 instanceVariableNames:something |
158 instanceVariableNames:something |
156 instanceVariableNames := something. |
159 instanceVariableNames := something. |
157 ! |
160 ! |
158 |
161 |
|
162 localClassName |
|
163 "for private classes, this returns the name relative to its owner; |
|
164 for non-private ones, this is the regular name. |
|
165 Notice that className always returns the full name (incl. any owner prefix)" |
|
166 |
|
167 self isPrivateClassDefinitionChange ifFalse:[^ self className]. |
|
168 (className startsWith:(owningClassName,'::')) ifTrue:[ |
|
169 ^ className copyFrom:(owningClassName size + 2 + 1). |
|
170 ] ifFalse:[ |
|
171 "/ should not happen |
|
172 ^ self className |
|
173 ] |
|
174 ! |
|
175 |
159 nameSpaceName |
176 nameSpaceName |
160 objectType == #variable ifTrue:[ |
177 objectType == #variable ifTrue:[ |
161 ^ nil |
178 ^ nil |
162 ]. |
179 ]. |
163 ^ self cutNameSpaceOf:(self nameSpaceOverride ? super nameSpaceName) |
180 ^ self cutNameSpaceOf:(self nameSpaceOverride ? super nameSpaceName) |
281 ^ nm copyReplaceAll:$. withAll:'::'. |
298 ^ nm copyReplaceAll:$. withAll:'::'. |
282 ]. |
299 ]. |
283 ^ nm |
300 ^ nm |
284 ! ! |
301 ! ! |
285 |
302 |
|
303 |
286 !ClassDefinitionChange methodsFor:'applying'! |
304 !ClassDefinitionChange methodsFor:'applying'! |
287 |
305 |
288 apply |
306 apply |
|
307 |changeClass| |
|
308 |
289 superClassName isNil ifTrue:[ |
309 superClassName isNil ifTrue:[ |
290 self setupFromSource |
310 self setupFromSource |
291 ]. |
311 superClassName isNil ifTrue:[ |
292 superClassName isNil ifTrue:[ |
312 self error:'Should not happen' |
293 self error:'Should not happen' |
313 ]. |
294 ]. |
314 ]. |
295 (Smalltalk classNamed:superClassName) isNil ifTrue:[ |
315 (Smalltalk classNamed:superClassName) isNil ifTrue:[ |
296 Class undeclared:superClassName |
316 Class undeclared:superClassName |
297 ]. |
317 ]. |
298 Parser evaluate:(self source). |
318 Parser evaluate:self source. |
299 package notNil ifTrue:[ |
319 package notNil ifTrue:[ |
300 self changeClass setPackage:package. |
320 changeClass := self changeClass. |
|
321 changeClass notNil ifTrue:[ |
|
322 changeClass setPackage:package. |
|
323 ]. |
301 ]. |
324 ]. |
302 |
325 |
303 " |
326 " |
304 (ClassDefinitionChange className: #TestB source: 'TestA subclass: #TestB |
327 (ClassDefinitionChange className: #TestB source: 'TestA subclass: #TestB |
305 instanceVariableNames:'''' |
328 instanceVariableNames:'''' |
311 |
334 |
312 "Modified: / 08-11-2010 / 16:10:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
335 "Modified: / 08-11-2010 / 16:10:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
313 "Modified: / 06-10-2011 / 17:01:58 / cg" |
336 "Modified: / 06-10-2011 / 17:01:58 / cg" |
314 ! ! |
337 ! ! |
315 |
338 |
|
339 |
316 !ClassDefinitionChange methodsFor:'comparing'! |
340 !ClassDefinitionChange methodsFor:'comparing'! |
317 |
341 |
318 isForSameAs:changeB |
342 isForSameAs:changeB |
319 "return true, if the given change represents a change for the same |
343 "return true, if the given change represents a change for the same |
320 thingy as the receiver (i.e. same method, same definition etc.)." |
344 thingy as the receiver (i.e. same method, same definition etc.)." |
338 |
362 |
339 |
363 |
340 |
364 |
341 ! ! |
365 ! ! |
342 |
366 |
|
367 |
343 !ClassDefinitionChange methodsFor:'converting'! |
368 !ClassDefinitionChange methodsFor:'converting'! |
344 |
369 |
345 asAntiChange |
370 asAntiChange |
346 |
371 |
347 ^ClassRemoveChange className: self className |
372 ^ClassRemoveChange className: self className |
348 |
373 |
349 "Created: / 02-11-2009 / 11:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
374 "Created: / 02-11-2009 / 11:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
350 ! ! |
375 ! ! |
|
376 |
351 |
377 |
352 !ClassDefinitionChange methodsFor:'printing & storing'! |
378 !ClassDefinitionChange methodsFor:'printing & storing'! |
353 |
379 |
354 definitionString |
380 definitionString |
355 |ns classNameUsed superClassNameUsed selPart| |
381 |ns classNameUsed superClassNameUsed selPart| |
370 nextPutAll:className asString storeString |
396 nextPutAll:className asString storeString |
371 ]. |
397 ]. |
372 ]. |
398 ]. |
373 |
399 |
374 superClassNameUsed := self superClassName. |
400 superClassNameUsed := self superClassName. |
375 classNameUsed := self className. |
401 "/ careful with private classes: the definition MUST give the |
|
402 "/ local name as argument, not the full name |
|
403 classNameUsed := self localClassName. |
|
404 |
376 selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:') |
405 selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:') |
377 keywords first. |
406 keywords first. |
378 |
407 |
379 ^ String streamContents:[:stream | |
408 ^ String streamContents:[:stream | |
380 stream |
409 stream |
583 aStream nextPutAll:('definition of ' , className) |
612 aStream nextPutAll:('definition of ' , className) |
584 |
613 |
585 |
614 |
586 ! ! |
615 ! ! |
587 |
616 |
|
617 |
588 !ClassDefinitionChange methodsFor:'queries'! |
618 !ClassDefinitionChange methodsFor:'queries'! |
589 |
619 |
590 definitionSelector |
620 definitionSelector |
591 definitionSelector isNil ifTrue:[ |
621 definitionSelector isNil ifTrue:[ |
592 self setupFromSource. |
622 self setupFromSource. |
605 isClassDefinitionChange |
635 isClassDefinitionChange |
606 ^ true |
636 ^ true |
607 ! |
637 ! |
608 |
638 |
609 isPrivateClassDefinitionChange |
639 isPrivateClassDefinitionChange |
|
640 "compute lazily; remember in private" |
|
641 |
610 private isNil ifTrue:[ |
642 private isNil ifTrue:[ |
611 (className includes:$:) ifFalse:[ |
643 (className includes:$:) ifFalse:[ |
612 "/ cannot be private |
644 "/ cannot be private |
613 private := false |
645 private := false |
614 ] ifTrue:[ |
646 ] ifTrue:[ |
647 owningClassName := aStringOrSymbol |
679 owningClassName := aStringOrSymbol |
648 |
680 |
649 "Created: / 30-08-2010 / 13:55:37 / cg" |
681 "Created: / 30-08-2010 / 13:55:37 / cg" |
650 ! ! |
682 ! ! |
651 |
683 |
|
684 |
652 !ClassDefinitionChange methodsFor:'special'! |
685 !ClassDefinitionChange methodsFor:'special'! |
653 |
686 |
654 installAsAutoloadedClassIfPublicWithFilename:aFilenameString |
687 installAsAutoloadedClassIfPublicWithFilename:aFilenameString |
655 "install the class defined by this change as autoloaded. |
688 "install the class defined by this change as autoloaded. |
656 Skip private classes. |
689 Skip private classes. |
761 "Created: / 11-10-2006 / 14:10:02 / cg" |
794 "Created: / 11-10-2006 / 14:10:02 / cg" |
762 "Modified: / 13-06-2012 / 12:25:10 / cg" |
795 "Modified: / 13-06-2012 / 12:25:10 / cg" |
763 "Modified: / 30-01-2013 / 12:01:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
796 "Modified: / 30-01-2013 / 12:01:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
764 ! ! |
797 ! ! |
765 |
798 |
|
799 |
766 !ClassDefinitionChange methodsFor:'visiting'! |
800 !ClassDefinitionChange methodsFor:'visiting'! |
767 |
801 |
768 acceptChangeVisitor:aVisitor |
802 acceptChangeVisitor:aVisitor |
769 ^ aVisitor visitClassDefinitionChange:self. |
803 ^ aVisitor visitClassDefinitionChange:self. |
770 |
804 |
771 "Created: / 25-11-2011 / 17:13:13 / cg" |
805 "Created: / 25-11-2011 / 17:13:13 / cg" |
772 ! ! |
806 ! ! |
773 |
807 |
|
808 |
774 !ClassDefinitionChange class methodsFor:'documentation'! |
809 !ClassDefinitionChange class methodsFor:'documentation'! |
775 |
810 |
776 version |
811 version |
777 ^ '$Header: ClassDefinitionChange.st 1961 2012-09-07 17:29:20Z vranyj1 $' |
812 ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.75 2013-03-27 18:18:21 cg Exp $' |
778 ! |
813 ! |
779 |
814 |
780 version_HG |
815 version_HG |
781 |
816 |
782 ^ '$Changeset: <not expanded> $' |
817 ^ '$Changeset: <not expanded> $' |
783 ! |
818 ! |
784 |
819 |
785 version_SVN |
820 version_SVN |
786 ^ '§Id:: ClassDefinitionChange.st 1961 2012-09-07 17:29:20Z vranyj1 §' |
821 ^ '§Id:: ClassDefinitionChange.st 1936 2012-07-24 15:47:21Z vranyj1 §' |
787 ! ! |
822 ! ! |
788 |
823 |