--- a/ClassDefinitionChange.st Fri Mar 10 10:48:59 2006 +0100
+++ b/ClassDefinitionChange.st Mon Mar 13 16:50:24 2006 +0100
@@ -140,10 +140,8 @@
|src nsName|
- source isNil ifTrue:[
+ (src := source) isNil ifTrue:[
src := self definitionString
- ] ifFalse:[
- src := super source
].
(nsName := self nameSpaceName) notNil ifTrue:[
@@ -155,11 +153,39 @@
!
superClassName
- ^ self cutNameSpaceOf:superClassName
+ |nm|
+
+ nm := superClassName.
+ nm notNil ifTrue:[
+ (nm includes:$.) ifTrue:[
+ ^ nm copyReplaceAll:$. withAll:'::'.
+ ]
+ ].
+ ^ nm
!
superClassName:something
superClassName := something.
+!
+
+superClassNameWithoutMyNamespace
+ |nm|
+
+ nm := self cutMyNameSpaceOf:superClassName.
+ (nm includes:$.) ifTrue:[
+ ^ nm copyReplaceAll:$. withAll:'::'.
+ ].
+ ^ nm
+!
+
+superClassNameWithoutNamespace
+ |nm|
+
+ nm := self cutNameSpaceOf:superClassName.
+ (nm includes:$.) ifTrue:[
+ ^ nm copyReplaceAll:$. withAll:'::'.
+ ].
+ ^ nm
! !
!ClassDefinitionChange methodsFor:'comparing'!
@@ -192,36 +218,38 @@
!ClassDefinitionChange methodsFor:'printing & storing'!
definitionString
- ^ String streamContents:[:stream |
- objectType == #variable ifTrue:[
+ objectType == #variable ifTrue:[
+ ^ String streamContents:[:stream |
stream
nextPutAll:((nameSpaceName asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::');
nextPutAll:' addClassVarName:';
nextPutAll:className asString storeString
- ] ifFalse:[
- stream
- nextPutAll:self superClassName;
- nextPutAll:' subclass:';
- nextPutAll:self className asSymbol storeString
- ;
- cr;
- spaces:4;
- nextPutAll:'instanceVariableNames: ';
- nextPutAll:(instanceVariableNames ? '') storeString;
- cr;
- spaces:4;
- nextPutAll:'classVariableNames: ';
- nextPutAll:(classVariableNames ? '') storeString;
- cr;
- spaces:4;
- nextPutAll:'poolDictionaries: ';
- nextPutAll:(poolDictionaries ? '') storeString;
- cr;
- spaces:4;
- nextPutAll:'category: ';
- nextPutAll:(category ? '') storeString
- ]
- ]
+ ].
+ ].
+
+ ^ String streamContents:[:stream |
+ stream
+ nextPutAll:self superClassNameWithoutMyNamespace;
+ nextPutAll:' subclass:';
+ nextPutAll:"self" className asSymbol storeString
+ ;
+ cr;
+ spaces:4;
+ nextPutAll:'instanceVariableNames: ';
+ nextPutAll:(instanceVariableNames ? '') storeString;
+ cr;
+ spaces:4;
+ nextPutAll:'classVariableNames: ';
+ nextPutAll:(classVariableNames ? '') storeString;
+ cr;
+ spaces:4;
+ nextPutAll:'poolDictionaries: ';
+ nextPutAll:(poolDictionaries ? '') storeString;
+ cr;
+ spaces:4;
+ nextPutAll:'category: ';
+ nextPutAll:(category ? '') storeString
+ ]
!
printOn:aStream
@@ -236,6 +264,17 @@
!ClassDefinitionChange methodsFor:'queries'!
+cutMyNameSpaceOf:aString
+ |dotIndex colonIndex|
+
+ aString isNil ifTrue:[ ^ aString ].
+ nameSpaceName isNil ifTrue:[ ^ aString ].
+ (aString startsWith:(nameSpaceName , '.')) ifTrue:[ ^ self cutNameSpaceOf:aString ].
+ (aString startsWith:(nameSpaceName , '::')) ifTrue:[ ^ self cutNameSpaceOf:aString ].
+
+ ^ aString
+!
+
definitionSelector
|parseTree|
@@ -294,5 +333,5 @@
!ClassDefinitionChange class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.35 2005-11-21 17:32:20 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.36 2006-03-13 15:50:24 cg Exp $'
! !