#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Fri, 13 Dec 2019 20:15:45 +0100
changeset 4525 04f4bfb1f1ee
parent 4524 32d0af6cebd4
child 4526 f87aa4714f76
#BUGFIX by cg class: ClassChange added: #source: comment/format in: #nameSpaceName changed: #changeClass: #class: #class:source: decompose className into namespace and base-class name
ClassChange.st
--- a/ClassChange.st	Thu Dec 12 18:10:56 2019 +0100
+++ b/ClassChange.st	Fri Dec 13 20:15:45 2019 +0100
@@ -184,13 +184,20 @@
 changeClass:aClass
     "set the class of the change"
 
-    className := aClass name.
+    self class:aClass.
 !
 
 class:aClass
     "set the class of the change"
 
-    self className:aClass name.
+    |classNameWithoutNamespace|
+
+    classNameWithoutNamespace := aClass nameWithoutNameSpacePrefix.
+    (aClass name = classNameWithoutNamespace) ifFalse:[
+        "/ split the name
+        self nameSpaceName:(aClass topNameSpace name).
+    ].
+    self className:classNameWithoutNamespace.
 
     "Created: / 03-12-1995 / 14:01:45 / cg"
     "Modified: / 12-11-2006 / 20:10:28 / cg"
@@ -199,7 +206,8 @@
 class:aClass source:newSource
     "set both class and source of the change"
 
-    self className:(aClass name) source:newSource
+    self class:aClass.
+    self source:newSource
 !
 
 classBaseName 
@@ -367,26 +375,6 @@
     ns := self nameSpaceOverride.
     ns notNil ifTrue:[ ^ ns ].
 
-"/  JV: Following code is rubbish because it cannot distiguish
-"/      between namespace and owning class...
-
-"/    (idx := className indexOf:$:) ~~ 0 ifTrue:[
-"/        "/ in a namespace
-"/        ^ className copyTo:(idx - 1).
-"/    ].
-
-"/  JV: I commented following It is not clear to how it is supposed to
-"/      work. If anybody wants this back, he/she should first write
-"/      a testcase to demonstrate how it should work.
-
-"/    (idx := className indexOf:$.) ~~ 0 ifTrue:[
-"/        "/ in a namespace
-"/        ns := className copyTo:(idx - 1).
-"/        cnm := className copyFrom:(idx + 1).
-"/        "cheat: VW namespaces"
-"/        ^ self nameSpaceForVWNamespace:ns class:cnm ifAbsent:ns
-"/    ].
-
     ^ nameSpaceName
 
     "Modified: / 03-08-2006 / 02:04:03 / cg"
@@ -463,6 +451,13 @@
     "set the value of the instance variable 'package' (automatically generated)"
 
     package := something.
+!
+
+source:newSource
+    "set the source of the change"
+
+    self assert:(newSource isString).
+    source := newSource.
 ! !
 
 !ClassChange methodsFor:'applying'!