fix for namespace: do not add ns twice.
--- a/ClassDefinitionChange.st Fri Apr 30 17:00:41 2010 +0200
+++ b/ClassDefinitionChange.st Tue Jun 15 14:54:58 2010 +0200
@@ -12,7 +12,7 @@
"{ Package: 'stx:libbasic3' }"
ClassChange subclass:#ClassDefinitionChange
- instanceVariableNames:'objectType nameSpaceName superClassName classType indexedType
+ instanceVariableNames:'objectType nameSpaceOverride superClassName classType indexedType
otherParameters instanceVariableNames classVariableNames
classInstanceVariableNames poolDictionaries category private
definitionSelector owningClassName'
@@ -94,7 +94,9 @@
objectType == #variable ifTrue:[
^ nil
].
- ^ self cutNameSpaceOf:(nameSpaceName ? super nameSpaceName)
+ ^ self cutNameSpaceOf:(nameSpaceOverride ? super nameSpaceName)
+
+ "Modified: / 15-06-2010 / 14:50:27 / cg"
!
nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg
@@ -103,7 +105,7 @@
|indexedType imports|
- nameSpaceName := aNameSpaceName.
+ nameSpaceOverride := aNameSpaceName.
classType := aClassType.
otherParameters := Dictionary new addAll:otherParametersArg; yourself.
@@ -118,7 +120,7 @@
imports := otherParameters at:#imports: ifAbsent:nil.
category := otherParameters at:#category: ifAbsent:nil.
- "Modified: / 11-10-2006 / 14:06:47 / cg"
+ "Modified: / 15-06-2010 / 14:50:35 / cg"
!
objectType
@@ -148,18 +150,22 @@
source
"return the source of the change"
- |src nsName|
+ |src|
(src := source) isNil ifTrue:[
src := self definitionString
].
- (nsName := self nameSpaceName) notNil ifTrue:[
- ^ '"{ NameSpace: ' , nsName , ' }"' ,
- Character cr, Character cr ,
- src string
+ nameSpaceOverride notNil ifTrue:[
+ (className startsWith:(nameSpaceOverride,'::')) ifFalse:[
+ ^ '"{ NameSpace: ' , nameSpaceOverride , ' }"' ,
+ Character cr, Character cr ,
+ src string
+ ].
].
^ src
+
+ "Modified: / 15-06-2010 / 14:51:09 / cg"
!
superClassName
@@ -245,8 +251,16 @@
definitionString
objectType == #variable ifTrue:[
^ String streamContents:[:stream |
+ nameSpaceOverride notNil ifTrue:[
+ stream
+ nextPutAll:((nameSpaceOverride asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
+ ] ifFalse:[
+ self halt:'can this happen ?'.
+ stream
+ nextPutAll:'Smalltalk'
+ ].
+
stream
- nextPutAll:((nameSpaceName asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::');
nextPutAll:' addClassVarName:';
nextPutAll:className asString storeString
].
@@ -275,6 +289,8 @@
nextPutAll:'category: ';
nextPutAll:(category ? '') storeString
]
+
+ "Modified: / 15-06-2010 / 14:53:57 / cg"
!
printOn:aStream
@@ -293,14 +309,14 @@
!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 ].
+ nameSpaceOverride isNil ifTrue:[ ^ aString ].
+ (aString startsWith:(nameSpaceOverride , '.')) ifTrue:[ ^ self cutNameSpaceOf:aString ].
+ (aString startsWith:(nameSpaceOverride , '::')) ifTrue:[ ^ self cutNameSpaceOf:aString ].
^ aString
+
+ "Modified: / 15-06-2010 / 14:51:49 / cg"
!
definitionSelector
@@ -447,9 +463,9 @@
!ClassDefinitionChange class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.52 2009-10-12 08:00:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.53 2010-06-15 12:54:58 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.52 2009-10-12 08:00:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.53 2010-06-15 12:54:58 cg Exp $'
! !