--- a/ClassDefinitionChange.st Mon Apr 15 15:39:06 2013 +0200
+++ b/ClassDefinitionChange.st Tue Apr 16 16:00:37 2013 +0200
@@ -50,7 +50,7 @@
!ClassDefinitionChange class methodsFor:'others'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.79 2013-04-14 06:55:37 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.80 2013-04-16 14:00:37 cg Exp $'
! !
!ClassDefinitionChange methodsFor:'accessing'!
@@ -173,6 +173,7 @@
Notice that className always returns the full name (incl. any owner prefix)"
self isPrivateClassDefinitionChange ifFalse:[^ self className].
+
(className startsWith:(owningClassName,'::')) ifTrue:[
^ className copyFrom:(owningClassName size + 2 + 1).
] ifFalse:[
@@ -247,22 +248,14 @@
!
source
- "return the source of the change"
+ "return the source of the change;
+ either the original source or a synthesized"
- |src ns|
+ |src|
(src := source) isNil ifTrue:[
src := self definitionString
].
-
-"/ ouch - already done in definitionString !!!!!!
-"/ (ns := self nameSpaceOverride) notNil ifTrue:[
-"/ (className startsWith:(ns,'::')) ifFalse:[
-"/ ^ '"{ NameSpace: ' , ns , ' }"' ,
-"/ Character cr, Character cr ,
-"/ src string
-"/ ].
-"/ ].
^ src
"Modified: / 10-08-2012 / 11:53:54 / cg"
@@ -313,7 +306,7 @@
!ClassDefinitionChange methodsFor:'applying'!
apply
- |changeClass|
+ |changeClass sourceWithNamespace|
superClassName isNil ifTrue:[
self setupFromSource
@@ -324,7 +317,18 @@
(Smalltalk classNamed:superClassName) isNil ifTrue:[
Class undeclared:superClassName
].
- Parser evaluate:self source.
+
+ "/ here, using the current namespace as provided by the query or the override,
+ "/ generate a class definition with full names (i.e. incl. ns prefix).
+ sourceWithNamespace := self source.
+ "/ as the namespace is already in the definition string, make sure that the namespace is not
+ "/ added twice, by anwering Smalltalk now!!
+ Class nameSpaceQuerySignal
+ answer:Smalltalk
+ do:[
+ Parser evaluate:sourceWithNamespace.
+ ].
+
package notNil ifTrue:[
changeClass := self changeClass.
changeClass notNil ifTrue:[
@@ -401,9 +405,11 @@
!
definitionStringInNamespace: nsOrNil
- |classNameUsed superClassNameUsed selPart|
+ |classNameUsed superClassNameUsed selPart ownerNameUsed|
objectType == #variable ifTrue:[
+ "/ a visualWorks static variable definition change.
+ "/ kludge to be here - should be a separate StaticVariableDefinitionChange
^ String streamContents:[:stream |
nsOrNil notNil ifTrue:[
stream nextPutAll:((nsOrNil asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
@@ -421,7 +427,14 @@
superClassNameUsed := self superClassName.
"/ careful with private classes: the definition MUST give the
"/ local name as argument, not the full name
- classNameUsed := self localClassName.
+ self isPrivateClassDefinitionChange ifTrue:[
+ classNameUsed := self localClassName.
+ ] ifFalse:[
+ classNameUsed := className.
+ nsOrNil notNil ifTrue:[
+ classNameUsed := nsOrNil,'::',classNameUsed.
+ ].
+ ].
"/ selPart is the subclass:/variableSubclass/variableByteSubclass:/... - part
selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:')
@@ -438,10 +451,14 @@
nextPutLine:(classVariableNames ? '') storeString;
nextPutAll:' poolDictionaries: ';
nextPutLine:(poolDictionaries ? '') storeString.
- private == true ifTrue:[
+ self isPrivateClassDefinitionChange ifTrue:[
+ ownerNameUsed := self owningClassName.
+ nsOrNil notNil ifTrue:[
+ ownerNameUsed := nsOrNil,'::',ownerNameUsed.
+ ].
stream
nextPutAll:' privateIn: ';
- nextPutAll:(self owningClassName)
+ nextPutAll:ownerNameUsed
] ifFalse:[
stream
nextPutAll:' category: ';
@@ -566,6 +583,20 @@
"Created: / 13-06-2012 / 12:45:02 / cg"
!
+fullOwningClassName
+ "the owner's name, including its namespace"
+
+ |nm ns|
+
+ nm := self owningClassName.
+ nm isNil ifTrue:[^ nil].
+
+ (ns := self nameSpaceOverride) notNil ifTrue:[
+ ^ ns,'::',nm
+ ].
+ ^ nm
+!
+
isClassDefinitionChange
^ true
!
@@ -599,6 +630,8 @@
!
owningClassName
+ "the owner's name, excluding the namespace"
+
self isPrivateClassDefinitionChange ifTrue:[
owningClassName isNil ifTrue:[
self setupFromSource.
@@ -728,7 +761,7 @@
!ClassDefinitionChange class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.79 2013-04-14 06:55:37 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.80 2013-04-16 14:00:37 cg Exp $'
!
version_SVN