Skip to content

Commit

Permalink
Add Closure entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Darbord committed Jul 4, 2024
1 parent 01df2dd commit 0b82586
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 4 deletions.
54 changes: 54 additions & 0 deletions src/Famix-Value-Entities/FamixValueOfClosure.class.st
Original file line number Diff line number Diff line change
@@ -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 [

<FMClass: #OfClosure super: #FamixValueOfType>
<package: #'Famix-Value-Entities'>
<generated>
^ self
]

{ #category : #accessing }
FamixValueOfClosure >> value [
"Relation named: #value type: #FamixValueOfType opposite: #closure"

<generated>
^ value
]

{ #category : #accessing }
FamixValueOfClosure >> value: anObject [

<generated>
value := anObject
]
24 changes: 24 additions & 0 deletions src/Famix-Value-Entities/FamixValueOfType.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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` | |
Expand All @@ -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'
Expand Down Expand Up @@ -52,6 +54,12 @@ FamixValueOfType >> addAttributeInObject: anObject [
^ self attributeInObjects add: anObject
]

{ #category : #adding }
FamixValueOfType >> addClosure: anObject [
<generated>
^ self closure add: anObject
]

{ #category : #adding }
FamixValueOfType >> addElementInCollection: anObject [
<generated>
Expand Down Expand Up @@ -86,6 +94,22 @@ FamixValueOfType >> attributeInObjects: anObject [
attributeInObjects value: anObject
]

{ #category : #accessing }
FamixValueOfType >> closure [
"Relation named: #closure type: #FamixValueOfClosure opposite: #value"

<generated>
<derived>
^ closure
]

{ #category : #accessing }
FamixValueOfType >> closure: anObject [

<generated>
closure value: anObject
]

{ #category : #accessing }
FamixValueOfType >> elementInCollections [
"Relation named: #elementInCollections type: #FamixValueOfCollectionElement opposite: #value"
Expand Down
7 changes: 7 additions & 0 deletions src/Famix-Value-Entities/FamixValueTEntityCreator.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ FamixValueTEntityCreator >> newOfClassReference [
^ self add: FamixValueOfClassReference new
]

{ #category : #'entity creation' }
FamixValueTEntityCreator >> newOfClosure [

<generated>
^ self add: FamixValueOfClosure new
]

{ #category : #'entity creation' }
FamixValueTEntityCreator >> newOfCollection [

Expand Down
7 changes: 7 additions & 0 deletions src/Famix-Value-Exporter/FamixValueOfClosure.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #FamixValueOfClosure }

{ #category : #'*Famix-Value-Exporter' }
FamixValueOfClosure >> accept: visitor [

^ visitor visitClosure: self
]
15 changes: 11 additions & 4 deletions src/Famix-Value-Generator/FamixValueGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Class {
'tType',
'collectionElement',
'objectAttribute',
'classReference'
'classReference',
'closure'
],
#category : #'Famix-Value-Generator'
}
Expand Down Expand Up @@ -79,14 +80,16 @@ FamixValueGenerator >> defineClasses [
dictionary := (builder
newClassNamed: #OfDictionary
comment: 'A value of a dictionary type.') withTesting.

dictionaryAssociation := builder
newClassNamed: #OfDictionaryAssociation
comment:
'A key-value pair belonging to a dictionary.'.
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.')
Expand All @@ -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.

Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit 0b82586

Please sign in to comment.