RGMethodDefinition.st
changeset 2 e439b82dda7d
parent 1 24b88532f6ef
child 3 ed5aae792d24
--- a/RGMethodDefinition.st	Fri Aug 28 14:04:03 2015 +0100
+++ b/RGMethodDefinition.st	Sat Aug 29 10:31:59 2015 +0100
@@ -102,7 +102,9 @@
 realClass: aClass selector: aString
     "Creates a ring method definition from a Smalltalk class and a selector <compiledMethod>"
 
-    ^(aClass>>aString asSymbol) asActiveRingDefinition
+    ^(aClass >> aString asSymbol) asActiveRingDefinition
+
+    "Modified (format): / 29-08-2015 / 10:25:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !RGMethodDefinition class methodsFor:'categories'!
@@ -151,12 +153,25 @@
     ^self 
         annotationNamed: self class isExtensionKey
         ifAbsent: [  
-            (self parent notNil and:[ self package notNil ])
-                ifTrue: [ | value |
-                           value :=  self parent package ~= self package.
-                         self annotationNamed: self class isExtensionKey put: value.
-                         value ]
-                ifFalse: [ | prot | self protocol ifNil:[ false ] ifNotNil:[ prot beginsWith: '*' ] ] ]
+            (self parent notNil and:[ self package notNil ]) ifTrue: [ 
+                | value |
+
+                value :=  self parent package ~= self package.
+                self annotationNamed: self class isExtensionKey put: value.
+                value 
+            ] ifFalse: [ 
+                self isActive ifTrue:[ 
+                    | cm |
+
+                    cm := self compiledMethod.
+                    cm isExtension.
+                ] ifFalse:[ 
+                    false
+                ].
+            ]
+        ]
+
+    "Modified: / 29-08-2015 / 10:23:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 isExtension: aBoolean
@@ -188,10 +203,12 @@
 protocol
 
     self isActive 
-        ifTrue: [ ^ self compiledMethod ifNil: [ protocol ] ifNotNil: [ self compiledMethod protocol ]].
+        ifTrue: [ ^ self compiledMethod ifNil: [ protocol ] ifNotNil: [ self compiledMethod category ]].
     self isHistorical
-        ifTrue: [ ^ self protocolAtPointer ifNil: [ | cm | (cm := self compiledMethod) ifNil: [ protocol ] ifNotNil:[ cm protocol ] ] ].
-    ^ protocol			
+        ifTrue: [ ^ self protocolAtPointer ifNil: [ | cm | (cm := self compiledMethod) ifNil: [ protocol ] ifNotNil:[ cm category ] ] ].
+    ^ protocol
+
+    "Modified: / 29-08-2015 / 08:20:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 protocol: anObject
@@ -215,9 +232,9 @@
 
     self isActive 
         ifTrue: [ ^ self compiledMethod ifNil:[ sourceCode ] ifNotNil: [ self compiledMethod sourceCode ]].
-    self isHistorical
-        ifTrue: [ ^ self sourceCodeAtPointer ifNil:[ | cm | (cm := self compiledMethod) ifNil:[ sourceCode ] ifNotNil:[ cm sourceCode ] ] ].	
     ^ sourceCode
+
+    "Modified: / 29-08-2015 / 08:03:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 sourceCode: anObject
@@ -229,9 +246,9 @@
 
     self isActive 
         ifTrue: [ ^ self compiledMethod timeStamp ].
-    self isHistorical
-        ifTrue: [ ^ self stampAtPointer ifNil:[ | cm | (cm := self compiledMethod) ifNil:[ stamp ] ifNotNil:[ cm timeStamp ] ] ].
     ^ stamp
+
+    "Modified: / 29-08-2015 / 08:03:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 stamp: anObject
@@ -346,41 +363,53 @@
 !
 
 protocolAtPointer
-
     "A RGMethodDefinition that was set as historical will retrieve the protocol using the sourcePointer"
 
-    ^ self sourcePointer notNil
-        ifTrue: [ SourceFiles protocolAt: self sourcePointer ]
-        ifFalse:[ nil ]
+    self shouldNotImplement. "/ No source pointers in Smalltalk/X    
+"/    ^ self sourcePointer notNil
+"/        ifTrue: [ SourceFiles protocolAt: self sourcePointer ]
+"/        ifFalse:[ nil ]
+
+    "Modified: / 29-08-2015 / 08:02:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 sourceCodeAtPointer
-
     "A RGMethodDefinition that was set as historical will retrieve the sourceCode using the sourcePointer"
 
-    ^ self sourcePointer notNil
-        ifTrue: [ SourceFiles sourceCodeAt: self sourcePointer ]
-        ifFalse:[ nil ]
+    self shouldNotImplement. "/ No source pointers in Smalltalk/X
+"/    ^ self sourcePointer notNil
+"/        ifTrue: [ SourceFiles sourceCodeAt: self sourcePointer ]
+"/        ifFalse:[ nil ]
+
+    "Modified: / 29-08-2015 / 08:02:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 sourcePointer
     "Retrieves the sourcePointer for this definition if exists"
-    
-    ^self annotationNamed:  self class sourcePointerKey   
+
+    self shouldNotImplement. "/ No source pointers in Smalltalk/X    
+"/    ^self annotationNamed:  self class sourcePointerKey
+
+    "Modified: / 29-08-2015 / 08:02:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 sourcePointer: aNumber
 
-    self annotationNamed:  self class sourcePointerKey put: aNumber 
+    self shouldNotImplement. "/ No source pointers in Smalltalk/X
+"/    self annotationNamed:  self class sourcePointerKey put: aNumber
+
+    "Modified: / 29-08-2015 / 08:02:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-stampAtPointer	
-
+stampAtPointer  
     "A RGMethodDefinition that was set as historical will retrieve the stamp using the sourcePointer"
 
-    ^ self sourcePointer notNil
-        ifTrue: [ SourceFiles timeStampAt: self sourcePointer ]
-        ifFalse:[ nil ]
+    self shouldNotImplement. "/ No source pointers in Smalltalk/X
+"/    ^ self sourcePointer notNil
+"/        ifTrue: [ SourceFiles timeStampAt: self sourcePointer ]
+"/        ifFalse:[ nil ]
+
+    "Modified: / 29-08-2015 / 08:03:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !RGMethodDefinition methodsFor:'stamp values'!
@@ -499,16 +528,17 @@
 !
 
 asHistorical
-
     "Sets the receiver as historical object, which will allow itself to retrieve its data using the sourcePointer"
     self annotationNamed: self class statusKey put: #historical.
-    self sourcePointer ifNil:[ | pointer compiledMethod |
-        pointer := 0.
+    sourceCode isNil ifTrue:[
+        | compiledMethod |
         compiledMethod := self compiledMethod.
         compiledMethod notNil ifTrue: [
-            pointer := compiledMethod sourcePointer ].
-        pointer isZero
-            ifFalse:[ self sourcePointer: pointer ] ]
+            sourceCode := compiledMethod sourceCode 
+        ].
+    ]
+
+    "Modified: / 29-08-2015 / 08:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 asPassive