ClassDefinitionChange.st
changeset 3150 10fa70a50dfa
parent 3139 c6eb068647cc
child 3158 f8c56a311307
child 3163 16fdcb5a998b
--- a/ClassDefinitionChange.st	Wed Mar 27 17:49:12 2013 +0100
+++ b/ClassDefinitionChange.st	Wed Mar 27 19:18:21 2013 +0100
@@ -50,7 +50,7 @@
 !ClassDefinitionChange class methodsFor:'others'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.74 2013-03-26 12:14:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.75 2013-03-27 18:18:21 cg Exp $'
 ! !
 
 !ClassDefinitionChange methodsFor:'accessing'!
@@ -157,6 +157,20 @@
     instanceVariableNames := something.
 !
 
+localClassName
+    "for private classes, this returns the name relative to its owner;
+     for non-private ones, this is the regular name.
+     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:[
+        "/ should not happen
+        ^ self className
+    ]
+!
+
 nameSpaceName
     objectType == #variable ifTrue:[
         ^ nil
@@ -378,7 +392,10 @@
     ].
 
     superClassNameUsed := self superClassName.
-    classNameUsed := self className.
+    "/ careful with private classes: the definition MUST give the
+    "/ local name as argument, not the full name
+    classNameUsed := self localClassName.
+
     selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:')
                     keywords first.         
 
@@ -613,6 +630,8 @@
 !
 
 isPrivateClassDefinitionChange
+    "compute lazily; remember in private"
+
     private isNil ifTrue:[
         (className includes:$:) ifFalse:[
             "/ cannot be private
@@ -767,7 +786,7 @@
 !ClassDefinitionChange class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.74 2013-03-26 12:14:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.75 2013-03-27 18:18:21 cg Exp $'
 !
 
 version_SVN