ClassDefinitionChange.st
branchjv
changeset 3303 7ed5d48e3756
parent 3301 cf7793a3625e
child 3387 b594e2d7a59e
--- a/ClassDefinitionChange.st	Tue Jun 11 15:50:58 2013 +0100
+++ b/ClassDefinitionChange.st	Wed Jun 12 11:54:30 2013 +0100
@@ -15,7 +15,7 @@
 	instanceVariableNames:'objectType superClassName classType indexedType otherParameters
 		instanceVariableNames classVariableNames
 		classInstanceVariableNames poolDictionaries category private
-		definitionSelector owningClassName'
+		definitionSelector'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Changes'
@@ -177,15 +177,19 @@
 !
 
 nameSpaceName
+    | nm |
 
-    "/ JV: What is the following good for? Please explain..."
-    objectType == #variable ifTrue:[
-        ^ nil
-    ].
-    ^ self cutNameSpaceOf:(self nameSpaceOverride ? super nameSpaceName)
+    nm := super nameSpaceName.
+    ^nm.
+
+"/    "/ JV: What is the following good for? Please explain..."
+"/    objectType == #variable ifTrue:[
+"/        ^ nil
+"/    ].
+"/    ^ self cutNameSpaceOf:(self nameSpaceOverride ? super nameSpaceName)
 
     "Modified: / 07-09-2011 / 20:47:14 / cg"
-    "Modified (comment): / 09-05-2013 / 13:46:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-06-2013 / 17:18:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg
@@ -398,7 +402,19 @@
 !ClassDefinitionChange methodsFor:'printing & storing'!
 
 definitionString
-    ^ self definitionStringInNamespace: (self nameSpaceOverride)
+    | ns  |
+
+    ns := self nameSpaceName.
+    ns isEmptyOrNil ifTrue:[
+        ^ self definitionStringInNamespace: ns.
+    ].
+    ^String streamContents:[:s|
+        s nextPutAll: '"{ NameSpace: '; nextPutAll: ns; nextPutAll: ' }"'.
+        s cr; cr.
+        s nextPutAll: (self definitionStringInNamespace: ns).
+    ]
+
+    "Modified: / 12-06-2013 / 11:16:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 definitionStringInNamespace: nsOrNil
@@ -422,15 +438,19 @@
     ].
 
     superClassNameUsed := self superClassName.
+    "Strip of namespace"
+    nsOrNil notNil ifTrue:[
+        (superClassNameUsed startsWith: nsOrNil) ifTrue:[
+            superClassNameUsed := superClassNameUsed copyFrom: nsOrNil size + 3
+        ].
+    ].
+
     "/ careful with private classes: the definition MUST give the
     "/ local name as argument, not the full name
     self isPrivateClassDefinitionChange ifTrue:[
         classNameUsed := self localClassName.
     ] ifFalse:[
         classNameUsed := className.
-        nsOrNil notNil ifTrue:[
-            classNameUsed := nsOrNil,'::',classNameUsed.
-        ].
     ].
 
     "/ selPart is the subclass:/variableSubclass/variableByteSubclass:/... - part
@@ -453,7 +473,7 @@
             nextPutLine:(poolDictionaries ? '') storeString.
         self isPrivateClassDefinitionChange ifTrue:[
             ownerNameUsed := self owningClassName.    
-            nsOrNil notNil ifTrue:[
+            nsOrNil ~~ nameSpaceName ifTrue:[
                 ownerNameUsed := nsOrNil,'::',ownerNameUsed.
             ].
             stream 
@@ -469,91 +489,7 @@
       ]
 
     "Modified: / 13-06-2012 / 13:01:58 / cg"
-    "Modified: / 30-04-2013 / 19:52:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-definitionStringWithoutNamespace
-    "cg - huh - who needs that? (the definitionString already does NOT include the classes namespace)"
-
-    |ns classNameUsed superClassNameUsed|
-
-    ns := self nameSpaceOverride.
-
-    objectType == #variable ifTrue:[
-        ^ String streamContents:[:stream |
-            ns notNil ifTrue:[
-                stream 
-                    nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
-            ] ifFalse:[
-                self halt:'can this happen ?'.
-                stream 
-                    nextPutAll:'Smalltalk'
-            ].
-
-            stream 
-                nextPutAll:' addClassVarName:';
-                nextPutAll:className asString storeString
-          ].
-    ].
-
-    superClassNameUsed := self superClassName.
-    classNameUsed := self classNameWithoutNamespace.
-
-    ^ String streamContents:[:stream |
-        self isPrivateClassDefinitionChange ifFalse:[
-            stream 
-                nextPutAll:superClassNameUsed;
-                nextPutAll:' subclass:';
-                nextPutAll: classNameUsed asSymbol storeString
-                ;
-                cr;
-                tab;
-                nextPutAll:'instanceVariableNames:';
-                nextPutAll:(instanceVariableNames ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'classVariableNames:';
-                nextPutAll:(classVariableNames ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'poolDictionaries:';
-                nextPutAll:(poolDictionaries ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'category:';
-                nextPutAll:(category ? '') storeString;
-                cr
-        ] ifTrue:[
-            stream 
-                nextPutAll:superClassNameUsed;
-                nextPutAll:' subclass:';
-                nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
-                ;
-                cr;
-                tab;
-                nextPutAll:'instanceVariableNames:';
-                nextPutAll:(instanceVariableNames ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'classVariableNames:';
-                nextPutAll:(classVariableNames ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'poolDictionaries:';
-                nextPutAll:(poolDictionaries ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'privateIn:';
-                nextPutAll:
-                    ((ns := self nameSpaceName) isNil
-                        ifTrue:[owningClassName]
-                        ifFalse:[owningClassName copyFrom: ns size + 3]);
-                cr
-        ]
-    ]
-
-    "Modified: / 06-10-2011 / 17:02:05 / cg"
-    "Created: / 20-03-2012 / 16:37:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-06-2013 / 11:24:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 printOn:aStream
@@ -643,12 +579,6 @@
     ^ owningClassName
 
     "Created: / 12-10-2006 / 23:07:25 / cg"
-!
-
-owningClassName:aStringOrSymbol
-    owningClassName := aStringOrSymbol
-
-    "Created: / 30-08-2010 / 13:55:37 / cg"
 ! !
 
 !ClassDefinitionChange methodsFor:'special'!