MethodCategoryChange.st
branchjv
changeset 3034 c892671f3e2a
parent 3012 4f40b8304d54
child 3042 48e76977cdc3
--- a/MethodCategoryChange.st	Tue Mar 20 16:55:14 2012 +0000
+++ b/MethodCategoryChange.st	Wed Mar 21 01:53:44 2012 +0000
@@ -12,7 +12,7 @@
 "{ Package: 'stx:libbasic3' }"
 
 MethodChange subclass:#MethodCategoryChange
-	instanceVariableNames:''
+	instanceVariableNames:'origin'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Changes'
@@ -39,8 +39,21 @@
     instances represent method-category changes (as done in the browser). 
     They are typically held in a ChangeSet.
 
+    Change origin.
+
+    When a changeset diff is generated, two MethodChanges that 
+    represent the same method (code is the same) but differ in
+    category, those two methods are transformed to MethodCategoruChanges.
+    In that case, origin keeps the reference to original MethodChange.
+
     [author:]
         Claus Gittinger
+
+    [instance variables:]
+        origin      <MethodChange>  Change that cause this category
+                                    change to be created. See comment.
+
+
 "
 ! !
 
@@ -60,6 +73,14 @@
     "Created: / 16.2.1998 / 14:14:16 / cg"
 !
 
+origin
+    ^ origin
+!
+
+origin:aMethodChange
+    origin := aMethodChange.
+!
+
 prettyPrintedSource
     ^ self sourceForMethod, Character cr 
           , '    category:' , methodCategory storeString
@@ -71,6 +92,17 @@
     ^ self sourceForMethod , ' category:' , methodCategory storeString
 
     "Modified: / 09-10-2006 / 13:59:10 / cg"
+!
+
+source: aString
+    | expr |
+
+    expr := Parser parseExpression: aString onError: [ self error: 'Invalid source'].
+    expr isMessage ifFalse:[ self error: 'Invalid source' ].
+    expr selector == #'category:' ifFalse:[ self error: 'Invalid source' ].
+    methodCategory := expr arguments first value.
+
+    "Created: / 20-03-2012 / 22:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !MethodCategoryChange methodsFor:'applying'!
@@ -109,7 +141,7 @@
 !MethodCategoryChange class methodsFor:'documentation'!
 
 version
-    ^ '$Id: MethodCategoryChange.st 1872 2012-01-30 17:19:14Z vranyj1 $'
+    ^ '$Id: MethodCategoryChange.st 1900 2012-03-21 01:53:44Z vranyj1 $'
 !
 
 version_CVS
@@ -117,5 +149,5 @@
 !
 
 version_SVN
-    ^ '$Id: MethodCategoryChange.st 1872 2012-01-30 17:19:14Z vranyj1 $'
+    ^ '$Id: MethodCategoryChange.st 1900 2012-03-21 01:53:44Z vranyj1 $'
 ! !