diff --git a/src/Famix-Value-Entities/FamixValueOfClosure.class.st b/src/Famix-Value-Entities/FamixValueOfClosure.class.st new file mode 100644 index 0000000..0eaa932 --- /dev/null +++ b/src/Famix-Value-Entities/FamixValueOfClosure.class.st @@ -0,0 +1,54 @@ +" +A lexical closure. + +## Relations +====================== + +### Other +| Relation | Origin | Opposite | Type | Comment | +|---| +| `value` | `FamixValueOfClosure` | `closure` | `FamixValueOfType` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `value` | `Object` | nil | Value data represented as a native Smalltalk object.| + +" +Class { + #name : #FamixValueOfClosure, + #superclass : #FamixValueOfType, + #traits : 'FamixValueTWithValueProperty', + #classTraits : 'FamixValueTWithValueProperty classTrait', + #instVars : [ + '#value => FMOne type: #FamixValueOfType opposite: #closure' + ], + #category : #'Famix-Value-Entities-Entities' +} + +{ #category : #meta } +FamixValueOfClosure class >> annotation [ + + + + + ^ self +] + +{ #category : #accessing } +FamixValueOfClosure >> value [ + "Relation named: #value type: #FamixValueOfType opposite: #closure" + + + ^ value +] + +{ #category : #accessing } +FamixValueOfClosure >> value: anObject [ + + + value := anObject +] diff --git a/src/Famix-Value-Entities/FamixValueOfType.class.st b/src/Famix-Value-Entities/FamixValueOfType.class.st index b5c8540..5871ad4 100644 --- a/src/Famix-Value-Entities/FamixValueOfType.class.st +++ b/src/Famix-Value-Entities/FamixValueOfType.class.st @@ -8,6 +8,7 @@ Abstract superclass of all ValueOf_Type_ entities. | Relation | Origin | Opposite | Type | Comment | |---| | `attributeInObjects` | `FamixValueOfType` | `value` | `FamixValueOfObjectAttribute` | | +| `closure` | `FamixValueOfType` | `value` | `FamixValueOfClosure` | | | `elementInCollections` | `FamixValueOfType` | `value` | `FamixValueOfCollectionElement` | | | `keyInDictionaries` | `FamixValueOfType` | `key` | `FamixValueOfDictionaryAssociation` | | | `type` | `FamixValueOfType` | `values` | `FamixTType` | | @@ -22,6 +23,7 @@ Class { #superclass : #FamixValueEntity, #instVars : [ '#attributeInObjects => FMMany type: #FamixValueOfObjectAttribute opposite: #value', + '#closure => FMMany type: #FamixValueOfClosure opposite: #value', '#elementInCollections => FMMany type: #FamixValueOfCollectionElement opposite: #value', '#keyInDictionaries => FMMany type: #FamixValueOfDictionaryAssociation opposite: #key', '#valueInDictionaries => FMMany type: #FamixValueOfDictionaryAssociation opposite: #value' @@ -52,6 +54,12 @@ FamixValueOfType >> addAttributeInObject: anObject [ ^ self attributeInObjects add: anObject ] +{ #category : #adding } +FamixValueOfType >> addClosure: anObject [ + + ^ self closure add: anObject +] + { #category : #adding } FamixValueOfType >> addElementInCollection: anObject [ @@ -86,6 +94,22 @@ FamixValueOfType >> attributeInObjects: anObject [ attributeInObjects value: anObject ] +{ #category : #accessing } +FamixValueOfType >> closure [ + "Relation named: #closure type: #FamixValueOfClosure opposite: #value" + + + + ^ closure +] + +{ #category : #accessing } +FamixValueOfType >> closure: anObject [ + + + closure value: anObject +] + { #category : #accessing } FamixValueOfType >> elementInCollections [ "Relation named: #elementInCollections type: #FamixValueOfCollectionElement opposite: #value" diff --git a/src/Famix-Value-Entities/FamixValueTEntityCreator.trait.st b/src/Famix-Value-Entities/FamixValueTEntityCreator.trait.st index b73fadf..85b0e79 100644 --- a/src/Famix-Value-Entities/FamixValueTEntityCreator.trait.st +++ b/src/Famix-Value-Entities/FamixValueTEntityCreator.trait.st @@ -25,6 +25,13 @@ FamixValueTEntityCreator >> newOfClassReference [ ^ self add: FamixValueOfClassReference new ] +{ #category : #'entity creation' } +FamixValueTEntityCreator >> newOfClosure [ + + + ^ self add: FamixValueOfClosure new +] + { #category : #'entity creation' } FamixValueTEntityCreator >> newOfCollection [ diff --git a/src/Famix-Value-Exporter/FamixValueOfClosure.extension.st b/src/Famix-Value-Exporter/FamixValueOfClosure.extension.st new file mode 100644 index 0000000..d985afc --- /dev/null +++ b/src/Famix-Value-Exporter/FamixValueOfClosure.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #FamixValueOfClosure } + +{ #category : #'*Famix-Value-Exporter' } +FamixValueOfClosure >> accept: visitor [ + + ^ visitor visitClosure: self +] diff --git a/src/Famix-Value-Generator/FamixValueGenerator.class.st b/src/Famix-Value-Generator/FamixValueGenerator.class.st index d70e037..4cb8255 100644 --- a/src/Famix-Value-Generator/FamixValueGenerator.class.st +++ b/src/Famix-Value-Generator/FamixValueGenerator.class.st @@ -23,7 +23,8 @@ Class { 'tType', 'collectionElement', 'objectAttribute', - 'classReference' + 'classReference', + 'closure' ], #category : #'Famix-Value-Generator' } @@ -79,7 +80,6 @@ FamixValueGenerator >> defineClasses [ dictionary := (builder newClassNamed: #OfDictionary comment: 'A value of a dictionary type.') withTesting. - dictionaryAssociation := builder newClassNamed: #OfDictionaryAssociation comment: @@ -87,6 +87,9 @@ FamixValueGenerator >> defineClasses [ classReference := builder newClassNamed: #OfClassReference comment: 'A reference to a class.'. + closure := builder + newClassNamed: #OfClosure + comment: 'A lexical closure.'. ofUnknownType := (builder newClassNamed: #OfUnknownType comment: 'A value of an unknwon type.') @@ -100,14 +103,16 @@ FamixValueGenerator >> defineClasses [ FamixValueGenerator >> defineHierarchy [ object --|> value. + closure --|> value. primitive --|> value. enumValue --|> value. collection --|> value. dictionary --|> value. - classReference --|> value. ofUnknownType --|> value. + classReference --|> value. dictionaryAssociation --|> value. + closure --|> tWithValueProperty. "for the code" primitive --|> tWithValueProperty. ofUnknownType --|> tWithValueProperty. @@ -154,7 +159,9 @@ FamixValueGenerator >> defineRelations [ (classReference property: #value) *- ((self remoteTrait: #TClass withPrefix: #Famix) property: - #valueReferences) + #valueReferences). + + (closure property: #value) *- (value property: #closure) ] { #category : #definition }