--- a/Make.proto Fri Aug 28 12:21:13 2015 +0100
+++ b/Make.proto Fri Aug 28 14:04:03 2015 +0100
@@ -153,7 +153,7 @@
$(OUTDIR)RGMetaclassDefinition.$(O) RGMetaclassDefinition.$(H): RGMetaclassDefinition.st $(INCLUDE_TOP)/stx/goodies/ring/RGBehaviorDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGGlobalDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)RGMetatraitDefinition.$(O) RGMetatraitDefinition.$(H): RGMetatraitDefinition.st $(INCLUDE_TOP)/stx/goodies/ring/RGBehaviorDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGGlobalDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGTraitDescriptionDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)RGTraitDefinition.$(O) RGTraitDefinition.$(H): RGTraitDefinition.st $(INCLUDE_TOP)/stx/goodies/ring/RGBehaviorDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGGlobalDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGTraitDescriptionDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/jv/tea/compiler/TClass.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBAbstractClass.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBClass.$(H) $(INCLUDE_TOP)/stx/libbasic/Behavior.$(H) $(INCLUDE_TOP)/stx/libbasic/Class.$(H) $(INCLUDE_TOP)/stx/libbasic/ClassDescription.$(H) $(INCLUDE_TOP)/stx/libbasic/CompiledCode.$(H) $(INCLUDE_TOP)/stx/libbasic/ExecutableFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/Method.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBAbstractClass.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers/RBClass.$(H) $(INCLUDE_TOP)/stx/libbasic/Behavior.$(H) $(INCLUDE_TOP)/stx/libbasic/Class.$(H) $(INCLUDE_TOP)/stx/libbasic/ClassDescription.$(H) $(INCLUDE_TOP)/stx/libbasic/CompiledCode.$(H) $(INCLUDE_TOP)/stx/libbasic/ExecutableFunction.$(H) $(INCLUDE_TOP)/stx/libbasic/Method.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line
--- a/RGCommentDefinition.st Fri Aug 28 12:21:13 2015 +0100
+++ b/RGCommentDefinition.st Fri Aug 28 14:04:03 2015 +0100
@@ -28,7 +28,7 @@
self isActive
ifTrue: [ ^ self realClass organization classComment ].
self isHistorical
- ifTrue: [ ^ self contentAtPointer ifNil:[ self realClass ifNil:[ content ] ifNotNil:[ :rc| rc organization classComment ] ] ].
+ ifTrue: [ ^ self contentAtPointer ifNil:[ | rc | (rc := self realClass) ifNil:[ content ] ifNotNil:[ rc organization classComment ] ] ].
^ content
!
@@ -55,7 +55,7 @@
self isActive
ifTrue: [ ^ self realClass organization commentStamp ].
self isHistorical
- ifTrue: [ ^ self stampAtPointer ifNil:[ self realClass ifNil:[ stamp ] ifNotNil:[ :rc| rc organization commentStamp ] ] ].
+ ifTrue: [ ^ self stampAtPointer ifNil:[ | rc | (rc := self realClass) ifNil:[ stamp ] ifNotNil:[ rc organization commentStamp ] ] ].
^ stamp
!
@@ -225,8 +225,9 @@
self sourcePointer ifNil:[
realClass := self realClass.
realClass notNil ifTrue: [
- realClass organization commentRemoteString
- ifNotNil: [:str | self sourcePointer: str sourcePointer ] ] ]
+ | str |
+ (str := realClass organization commentRemoteString)
+ ifNotNil: [ self sourcePointer: str sourcePointer ] ] ]
!
asPassive
@@ -257,26 +258,32 @@
!
isActive
+ "A ring comment isActive when it needs to access the class organization for retrieving its data"
- "A ring comment isActive when it needs to access the class organization for retrieving its data"
- ^(self annotationNamed: self class statusKey)
+ | status |
+
+ ^(status := self annotationNamed: self class statusKey)
ifNil:[ false ]
- ifNotNil:[ :status| status == #active ]
+ ifNotNil:[ status == #active ]
!
isHistorical
+ "A ring comment can be used to point an old version of the receiver, in this case it will use the sourcePointer to retrieve its information"
- "A ring comment can be used to point an old version of the receiver, in this case it will use the sourcePointer to retrieve its information"
+ | status |
+
^(self annotationNamed: self class statusKey)
ifNil:[ false ]
- ifNotNil:[ :status| status == #historical ]
+ ifNotNil:[ status == #historical ]
!
isPassive
+ "A ring comment isPassive by default. In this case it will retrieve the data that was assigned in its creation"
- "A ring comment isPassive by default. In this case it will retrieve the data that was assigned in its creation"
- ^(self annotationNamed: self class statusKey)
+ | status |
+
+ ^(status := self annotationNamed: self class statusKey)
ifNil:[ true ]
- ifNotNil:[ :status| status == #passive ]
+ ifNotNil:[ status == #passive ]
! !
--- a/RGContainer.st Fri Aug 28 12:21:13 2015 +0100
+++ b/RGContainer.st Fri Aug 28 14:04:03 2015 +0100
@@ -332,20 +332,24 @@
setPackageOfClass: rgClass using: packageKeys
"Set the package to aRGBehaviorDefinition"
- (self findPackageOfClass: rgClass using: packageKeys)
- ifNotNil:[ :pck| pck addClass: rgClass ]
+ | pkg |
+
+ (pkg := self findPackageOfClass: rgClass using: packageKeys)
+ ifNotNil:[ pkg addClass: rgClass ]
!
setPackageOfMethod: rgMethod ofClass: rgClass using: packageKeys
"Set the package to aRGMethodDefinition and its value isExtension"
- (self findPackageOfMethod: rgMethod using: packageKeys)
- ifNil:[ rgClass package ifNotNil:[ :pck|
- pck addMethod: rgMethod.
+ | pkg |
+
+ (pkg := self findPackageOfMethod: rgMethod using: packageKeys)
+ ifNil:[ rgClass package ifNotNil:[
+ pkg addMethod: rgMethod.
rgMethod isExtension: false ] ]
- ifNotNil:[ :pck|
- pck addMethod: rgMethod.
+ ifNotNil:[
+ pkg addMethod: rgMethod.
rgMethod isExtension: (rgMethod package ~= rgClass package) ]
! !
--- a/RGMethodDefinition.st Fri Aug 28 12:21:13 2015 +0100
+++ b/RGMethodDefinition.st Fri Aug 28 14:04:03 2015 +0100
@@ -9,7 +9,79 @@
category:'Ring-Core-Kernel'
!
-RGMethodDefinition comment:'RGMethodDefinition is a concrete representation of methods. It can be used to build browser for methods that are not in the image. It is polymorphic with CompiledMethod.
* We can ask a RGMethodDefinition for its selector using the selector message.
Example:
(Point>>#dist:) asRingDefinition selector
-> #dist
We can also ask the ring object representation of its class or the Smalltalk class actually implementing the corresponding compiledMethod.
* To access the ring class definition name, use parentName
aRGMethodDefinition parentName
Example:
(Point>>#dist:) asRingDefinition parentName
-> #Point
* If you have a complete model where classes and methods are ring definition, to access the ring class definition , use parent
aRGMethodDefinition parent
Example:
aRGMethodDefinition(Point>>#dist:) parent
-> aRGClassDefinition(Point)
* If you want to access the smalltalk class that contains the compiledMethod that is represented by a ringMethodDefinition, use realParent
aRGMethodDefinition realParent
Example:
(Point>>#dist:) asRingDefinition realParent
-> Point
Now a RingEntityDefinition offers two APIs: one that is generic and works for all the source code entities and this is the one we just
presented: parent, parentName and realParent. Having such interface is important to build generic tools that could manipulate
any entities in a polymorphic way (yes no isKindOf: everywhere).
In addition, a ring method definition offers a specific interface that should only be used when you know that you are solely manipulate
specific entity such as class element: method definition, class comment, and variables.
Here is the equivalence table
realParent realClass
parent ringClass
parentName className
* The message class returns the class of the object :).
Example:
(Point>>#dist:) asRingDefinition class
-> RingMethodDefinition
* The message className returns the name of the ring class defining the reingMethodDefinition.
Example:
(Point>>#dist:) asRingDefinition className
-> #Point
* If you have a complete model where classes and methods are ring definition, to access the ring class definition , use parent
aRGMethodDefinition ringClass
Example:
aRGMethodDefinition(Point>>#dist:) ringClass
-> aRGClassDefinition(Point)
* If you want to access the smalltalk class that contains the compiledMethod that is represented by a ringMethodDefinition, use realClass
aRGMethodDefinition realClass
Example:
(Point>>#dist:) asRingDefinition realClass
-> Point
'
+RGMethodDefinition comment:'RGMethodDefinition is a concrete representation of methods. It can be used to build browser for methods that are not in the image. It is polymorphic with CompiledMethod.
+
+* We can ask a RGMethodDefinition for its selector using the selector message.
+Example:
+ (Point>>#dist:) asRingDefinition selector
+ -> #dist
+
+We can also ask the ring object representation of its class or the Smalltalk class actually implementing the corresponding compiledMethod.
+
+* To access the ring class definition name, use parentName
+ aRGMethodDefinition parentName
+
+Example:
+ (Point>>#dist:) asRingDefinition parentName
+ -> #Point
+
+* If you have a complete model where classes and methods are ring definition, to access the ring class definition , use parent
+ aRGMethodDefinition parent
+
+Example:
+ aRGMethodDefinition(Point>>#dist:) parent
+ -> aRGClassDefinition(Point)
+
+* If you want to access the smalltalk class that contains the compiledMethod that is represented by a ringMethodDefinition, use realParent
+ aRGMethodDefinition realParent
+
+Example:
+ (Point>>#dist:) asRingDefinition realParent
+ -> Point
+
+
+Now a RingEntityDefinition offers two APIs: one that is generic and works for all the source code entities and this is the one we just
+presented: parent, parentName and realParent. Having such interface is important to build generic tools that could manipulate
+any entities in a polymorphic way (yes no isKindOf: everywhere).
+
+In addition, a ring method definition offers a specific interface that should only be used when you know that you are solely manipulate
+specific entity such as class element: method definition, class comment, and variables.
+
+Here is the equivalence table
+
+ realParent realClass
+ parent ringClass
+ parentName className
+
+
+* The message class returns the class of the object :).
+
+Example:
+ (Point>>#dist:) asRingDefinition class
+ -> RingMethodDefinition
+
+* The message className returns the name of the ring class defining the reingMethodDefinition.
+
+Example:
+ (Point>>#dist:) asRingDefinition className
+ -> #Point
+
+* If you have a complete model where classes and methods are ring definition, to access the ring class definition , use parent
+ aRGMethodDefinition ringClass
+
+Example:
+ aRGMethodDefinition(Point>>#dist:) ringClass
+ -> aRGClassDefinition(Point)
+
+
+* If you want to access the smalltalk class that contains the compiledMethod that is represented by a ringMethodDefinition, use realClass
+ aRGMethodDefinition realClass
+
+Example:
+ (Point>>#dist:) asRingDefinition realClass
+ -> Point
+
+'
!
!RGMethodDefinition class methodsFor:'instance creation'!
@@ -84,7 +156,7 @@
value := self parent package ~= self package.
self annotationNamed: self class isExtensionKey put: value.
value ]
- ifFalse: [ self protocol ifNil:[ false ] ifNotNil:[ :prot| prot beginsWith: '*' ] ] ]
+ ifFalse: [ | prot | self protocol ifNil:[ false ] ifNotNil:[ prot beginsWith: '*' ] ] ]
!
isExtension: aBoolean
@@ -95,9 +167,11 @@
origin
"Return the real oring of this method."
- ^ self compiledMethod
+ | mthd |
+
+ ^ (mthd := self compiledMethod)
ifNil: [ self methodClass ]
- ifNotNil: [ :compileMethod| compileMethod origin ]
+ ifNotNil: [ mthd origin ]
!
package
@@ -116,7 +190,7 @@
self isActive
ifTrue: [ ^ self compiledMethod ifNil: [ protocol ] ifNotNil: [ self compiledMethod protocol ]].
self isHistorical
- ifTrue: [ ^ self protocolAtPointer ifNil: [ self compiledMethod ifNil: [ protocol ] ifNotNil:[ :cm | cm protocol ] ] ].
+ ifTrue: [ ^ self protocolAtPointer ifNil: [ | cm | (cm := self compiledMethod) ifNil: [ protocol ] ifNotNil:[ cm protocol ] ] ].
^ protocol
!
@@ -142,7 +216,7 @@
self isActive
ifTrue: [ ^ self compiledMethod ifNil:[ sourceCode ] ifNotNil: [ self compiledMethod sourceCode ]].
self isHistorical
- ifTrue: [ ^ self sourceCodeAtPointer ifNil:[ self compiledMethod ifNil:[ sourceCode ] ifNotNil:[ :cm| cm sourceCode ] ] ].
+ ifTrue: [ ^ self sourceCodeAtPointer ifNil:[ | cm | (cm := self compiledMethod) ifNil:[ sourceCode ] ifNotNil:[ cm sourceCode ] ] ].
^ sourceCode
!
@@ -156,7 +230,7 @@
self isActive
ifTrue: [ ^ self compiledMethod timeStamp ].
self isHistorical
- ifTrue: [ ^ self stampAtPointer ifNil:[ self compiledMethod ifNil:[ stamp ] ifNotNil:[ :cm| cm timeStamp ] ] ].
+ ifTrue: [ ^ self stampAtPointer ifNil:[ | cm | (cm := self compiledMethod) ifNil:[ stamp ] ifNotNil:[ cm timeStamp ] ] ].
^ stamp
!
@@ -468,25 +542,32 @@
isActive
"A ring method isActive when it needs to access the compiledMethod for retrieving its data"
- ^(self annotationNamed: self class statusKey)
- ifNil:[ false ]
- ifNotNil:[ :status| status == #active ]
+
+ | status |
+
+ ^(status := self annotationNamed: self class statusKey) isNil
+ ifTrue:[ false ]
+ ifFalse:[ status == #active ]
!
isHistorical
+ "A ring method can be used to point an old version of the receiver, in this case it will use the sourcePointer to retrieve its information"
+
+ | status |
- "A ring method can be used to point an old version of the receiver, in this case it will use the sourcePointer to retrieve its information"
- ^(self annotationNamed: self class statusKey)
- ifNil:[ false ]
- ifNotNil:[ :status| status == #historical ]
+ ^(status := self annotationNamed: self class statusKey) isNil
+ ifTrue:[ false ]
+ ifFalse:[ status == #historical ]
!
isPassive
-
"A ring method isPassive when it retrieves the data that was assigned in its creation.
By default is passive"
- ^(self annotationNamed: self class statusKey)
- ifNil:[ true ]
- ifNotNil:[ :status| status == #passive ]
+
+ | status |
+
+ ^(status := self annotationNamed: self class statusKey) isNil
+ ifTrue:[ false ]
+ ifFalse:[ status == #passive ]
! !
--- a/bc.mak Fri Aug 28 12:21:13 2015 +0100
+++ b/bc.mak Fri Aug 28 14:04:03 2015 +0100
@@ -100,7 +100,7 @@
$(OUTDIR)RGMetaclassDefinition.$(O) RGMetaclassDefinition.$(H): RGMetaclassDefinition.st $(INCLUDE_TOP)\stx\goodies\ring\RGBehaviorDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGGlobalDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)RGMetatraitDefinition.$(O) RGMetatraitDefinition.$(H): RGMetatraitDefinition.st $(INCLUDE_TOP)\stx\goodies\ring\RGBehaviorDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGGlobalDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGTraitDescriptionDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)RGTraitDefinition.$(O) RGTraitDefinition.$(H): RGTraitDefinition.st $(INCLUDE_TOP)\stx\goodies\ring\RGBehaviorDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGGlobalDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGTraitDescriptionDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\jv\tea\compiler\TClass.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBAbstractClass.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBClass.$(H) $(INCLUDE_TOP)\stx\libbasic\Behavior.$(H) $(INCLUDE_TOP)\stx\libbasic\Class.$(H) $(INCLUDE_TOP)\stx\libbasic\ClassDescription.$(H) $(INCLUDE_TOP)\stx\libbasic\CompiledCode.$(H) $(INCLUDE_TOP)\stx\libbasic\ExecutableFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\Method.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBAbstractClass.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers\RBClass.$(H) $(INCLUDE_TOP)\stx\libbasic\Behavior.$(H) $(INCLUDE_TOP)\stx\libbasic\Class.$(H) $(INCLUDE_TOP)\stx\libbasic\ClassDescription.$(H) $(INCLUDE_TOP)\stx\libbasic\CompiledCode.$(H) $(INCLUDE_TOP)\stx\libbasic\ExecutableFunction.$(H) $(INCLUDE_TOP)\stx\libbasic\Method.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line
--- a/extensions.st Fri Aug 28 12:21:13 2015 +0100
+++ b/extensions.st Fri Aug 28 14:04:03 2015 +0100
@@ -256,75 +256,6 @@
^false
! !
-!TClass methodsFor:'*Ring-Core-Kernel'!
-
-asFullRingDefinition
- "A behavior is converted to a ring class including its variables, methods, direct superclass, direct subclasses and the package in which is loaded.
- Active methods are generated and each knows its package as well.
- Note that for its direct superclass and subclasses no full definitions are requested. If you need to traverse hierarchies use #asRingDefinitionWithMethods:withSuperclasses:withSubclasses:withPackages:"
-
- | rgClass rgSuper rgSub rgMethod packageKeys |
- rgClass:= self asRingDefinition.
- rgClass package: (RGContainer packageOfClass: rgClass).
-
- self superclass notNil
- ifTrue: [
- rgSuper := self superclass asRingDefinition.
- rgClass superclass: rgSuper ]
- ifFalse: [
- self isTrait ifTrue: [
- rgSuper := Trait asRingDefinition.
- rgClass superclass: rgSuper. ]
- ].
-
- self subclasses do:[ :each |
- rgSub := each asRingDefinition.
- rgSub superclass: rgClass ].
-
- packageKeys := RGContainer packageKeys.
- self methodsDo:[ :mth|
- rgMethod := mth asActiveRingDefinition.
- rgClass addMethod: rgMethod.
- rgMethod package: (RGContainer packageOfMethod: rgMethod using: packageKeys) ].
- self theMetaClass methodsDo:[ :mth|
- rgMethod := mth asActiveRingDefinition.
- rgClass theMetaClass addMethod: rgMethod.
- rgMethod package: (RGContainer packageOfMethod: rgMethod using: packageKeys) ].
-
- ^ rgClass
-! !
-
-!TClass methodsFor:'*Ring-Core-Kernel'!
-
-asRingDefinition
- ^self explicitRequirement.
-! !
-
-!TClass methodsFor:'*Ring-Core-Kernel'!
-
-asRingDefinitionWithMethods: methodsBoolean withSuperclasses: supersBoolean withSubclasses: subsBoolean withPackageKeys: packageKeys in: aRGSlice
- ^self explicitRequirement.
-! !
-
-!TClass methodsFor:'*Ring-Core-Kernel'!
-
-asRingDefinitionWithMethods: methodsBoolean withSuperclasses: supersBoolean withSubclasses: subsBoolean withPackages: packsBoolean
- "Retrieves a ring class/trait based on the receiver.
- The data loaded in the class/trait (active methods, superclasses, subclasses and packages) is requested by the users.
- As it may need to traverse hierarchies for retrieving super and subclasses a ring slice is created as the container for every class, method and package.
- To retrieve the slice: aRGClass environment "
- | rgClass rgSlice rgPackageKeys |
-
- rgSlice := RGSlice named: #fromImage.
- packsBoolean ifTrue: [
- rgPackageKeys := rgSlice loadPackagesFromImage ].
- rgClass := self asRingDefinitionWithMethods: methodsBoolean withSuperclasses: supersBoolean withSubclasses: subsBoolean withPackageKeys: rgPackageKeys in: rgSlice.
- rgSlice cleanEmptyPackages.
- rgSlice loadTraitUsers.
-
- ^ rgClass
-! !
-
!stx_goodies_ring class methodsFor:'documentation'!
extensionsVersion_HG
--- a/stx_goodies_ring.st Fri Aug 28 12:21:13 2015 +0100
+++ b/stx_goodies_ring.st Fri Aug 28 14:04:03 2015 +0100
@@ -29,8 +29,7 @@
This method is generated automatically,
by searching along the inheritance chain of all of my classes."
- ^ #(
- #'jv:tea/compiler' "TClass - extended"
+ ^ #(
#'stx:goodies/refactoryBrowser/helpers' "RBAbstractClass - extended"
#'stx:libbasic' "Behavior - extended"
)