diff --git a/src/Famix-MetamodelGeneration/FamixGenerator.class.st b/src/Famix-MetamodelGeneration/FamixGenerator.class.st index 581ec8b6..c5729ede 100644 --- a/src/Famix-MetamodelGeneration/FamixGenerator.class.st +++ b/src/Famix-MetamodelGeneration/FamixGenerator.class.st @@ -33,6 +33,7 @@ Class { 'tInvocable', 'tInvocation', 'tInvocationsReceiver', + 'tLambda', 'tLocalVariable', 'tMethod', 'tModule', @@ -70,6 +71,7 @@ Class { 'tWithImplicitVariables', 'tWithInheritances', 'tWithInvocations', + 'tWithLambdas', 'tWithLocalVariables', 'tWithMethods', 'tDefinedInModule', @@ -498,6 +500,12 @@ FamixGenerator >> commentForTInvocationsReceiver [ ^ '' ] +{ #category : #comments } +FamixGenerator >> commentForTLambda [ + + ^ 'FamixTLabmda represents a behavioural entity that does not have a name. It can be used to represent lambdas, closures, blocks...' +] + { #category : #comments } FamixGenerator >> commentForTLocalVariable [ @@ -941,6 +949,12 @@ FamixGenerator >> commentForTWithInvocations [ ^ '' ] +{ #category : #comments } +FamixGenerator >> commentForTWithLambdas [ + + ^ 'I represent an entity that can owned lambda expressions.' +] + { #category : #comments } FamixGenerator >> commentForTWithLocalVariables [ @@ -1091,6 +1105,13 @@ FamixGenerator >> defineHierarchy [ tInvocation --|> tHasSignature. tImplicitVariable --|> tStructuralEntity. + + tLambda --|> tWithParameters. + tLambda --|> tHasSignature. + tLambda --|> tWithStatements. + tLambda --|> tWithLocalVariables. + tLambda --|> tInvocable. + tLambda --|> #TEntityMetaLevelDependency. tLocalVariable --|> tStructuralEntity. @@ -1371,6 +1392,13 @@ FamixGenerator >> defineRelations [ ((tWithFunctions property: #functions) comment: 'Functions defined in the container, if any.'). + ((tLambda property: #lambdaContainer) + comment: 'The container defining the lambda expression. The lambda is placed in a container, because certain languages can nest lambdas in lambdas.'; + container) + *- + ((tWithLambdas property: #lambdas) + comment: 'Lambdas defined in the container, if any.'). + ((tGlobalVariable property: #parentScope) comment: 'Scope declaring the global variable. belongsTo implementation'; container) @@ -1736,6 +1764,9 @@ FamixGenerator >> defineTraits [ tInvocationsReceiver := builder newTraitNamed: #TInvocationsReceiver. tInvocationsReceiver comment: self commentForTInvocationsReceiver. + + tLambda := builder newTraitNamed: #TLambda. + tLambda comment: self commentForTLambda. tLocalVariable := builder newTraitNamed: #TLocalVariable. tLocalVariable comment: self commentForTLocalVariable. @@ -1891,6 +1922,9 @@ FamixGenerator >> defineTraits [ tWithInvocations := builder newTraitNamed: #TWithInvocations. tWithInvocations comment: self commentForTWithInvocations. + + tWithLambdas := builder newTraitNamed: #TWithLambdas. + tWithLambdas comment: self commentForTWithLambdas. tWithLocalVariables := builder newTraitNamed: #TWithLocalVariables. tWithLocalVariables comment: self commentForTWithLocalVariables. diff --git a/src/Famix-Traits/FamixTLambda.trait.st b/src/Famix-Traits/FamixTLambda.trait.st new file mode 100644 index 00000000..e5f87cbe --- /dev/null +++ b/src/Famix-Traits/FamixTLambda.trait.st @@ -0,0 +1,86 @@ +" +FamixTLabmda represents a behavioural entity that does not have a name. It can be used to represent lambdas, closures, blocks... + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `lambdaContainer` | `FamixTLambda` | `lambdas` | `FamixTWithLambdas` | The container defining the lambda expression. The lambda is placed in a container, because certain languages can nest lambdas in lambdas.| + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `localVariables` | `FamixTWithLocalVariables` | `parentBehaviouralEntity` | `FamixTLocalVariable` | Variables locally defined by this behaviour.| +| `parameters` | `FamixTWithParameters` | `parentBehaviouralEntity` | `FamixTParameter` | List of formal parameters declared by this behaviour.| + +### Outgoing dependencies +| Relation | Origin | Opposite | Type | Comment | +|---| +| `accesses` | `FamixTWithAccesses` | `accessor` | `FamixTAccess` | Accesses to variables made by this behaviour.| +| `outgoingInvocations` | `FamixTWithInvocations` | `sender` | `FamixTInvocation` | Outgoing invocations sent by this behaviour.| +| `outgoingReferences` | `FamixTWithReferences` | `referencer` | `FamixTReference` | References from this entity to other entities.| + +### Incoming dependencies +| Relation | Origin | Opposite | Type | Comment | +|---| +| `incomingInvocations` | `FamixTInvocable` | `candidates` | `FamixTInvocation` | Incoming invocations from other behaviours computed by the candidate operator.| + +### Other +| Relation | Origin | Opposite | Type | Comment | +|---| +| `sourceAnchor` | `FamixTSourceEntity` | `element` | `FamixTSourceAnchor` | SourceAnchor entity linking to the original source code for this entity| + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `isStub` | `Boolean` | false | Flag true if the entity attributes are incomplete, either because the entity is missing or not imported.| +| `signature` | `String` | nil | Signature of the message being sent| + +" +Trait { + #name : #FamixTLambda, + #instVars : [ + '#lambdaContainer => FMOne type: #FamixTWithLambdas opposite: #lambdas' + ], + #traits : 'FamixTHasSignature + FamixTInvocable + FamixTWithLocalVariables + FamixTWithParameters + FamixTWithStatements + TEntityMetaLevelDependency', + #classTraits : 'FamixTHasSignature classTrait + FamixTInvocable classTrait + FamixTWithLocalVariables classTrait + FamixTWithParameters classTrait + FamixTWithStatements classTrait + TEntityMetaLevelDependency classTrait', + #category : #'Famix-Traits-Traits' +} + +{ #category : #meta } +FamixTLambda classSide >> annotation [ + + + + + ^ self +] + +{ #category : #accessing } +FamixTLambda >> lambdaContainer [ + "Relation named: #lambdaContainer type: #FamixTWithLambdas opposite: #lambdas" + + + + + ^ lambdaContainer +] + +{ #category : #accessing } +FamixTLambda >> lambdaContainer: anObject [ + + + lambdaContainer := anObject +] + +{ #category : #navigation } +FamixTLambda >> lambdaContainerGroup [ + + + ^ MooseSpecializedGroup with: self lambdaContainer +] diff --git a/src/Famix-Traits/FamixTWithLambdas.trait.st b/src/Famix-Traits/FamixTWithLambdas.trait.st new file mode 100644 index 00000000..2516effb --- /dev/null +++ b/src/Famix-Traits/FamixTWithLambdas.trait.st @@ -0,0 +1,53 @@ +" +I represent an entity that can owned lambda expressions. + +## Relations +====================== + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `lambdas` | `FamixTWithLambdas` | `lambdaContainer` | `FamixTLambda` | Lambdas defined in the container, if any.| + + + +" +Trait { + #name : #FamixTWithLambdas, + #instVars : [ + '#lambdas => FMMany type: #FamixTLambda opposite: #lambdaContainer' + ], + #category : #'Famix-Traits-Traits' +} + +{ #category : #meta } +FamixTWithLambdas classSide >> annotation [ + + + + + ^ self +] + +{ #category : #adding } +FamixTWithLambdas >> addLambda: anObject [ + + ^ self lambdas add: anObject +] + +{ #category : #accessing } +FamixTWithLambdas >> lambdas [ + "Relation named: #lambdas type: #FamixTLambda opposite: #lambdaContainer" + + + + + ^ lambdas +] + +{ #category : #accessing } +FamixTWithLambdas >> lambdas: anObject [ + + + lambdas value: anObject +] diff --git a/src/Famix-Traits/MooseAbstractGroup.extension.st b/src/Famix-Traits/MooseAbstractGroup.extension.st index c66cc6b2..2ea6acee 100644 --- a/src/Famix-Traits/MooseAbstractGroup.extension.st +++ b/src/Famix-Traits/MooseAbstractGroup.extension.st @@ -114,6 +114,13 @@ MooseAbstractGroup >> allInvocations [ ^self allUsing: FamixTInvocation ] +{ #category : #'*Famix-Traits' } +MooseAbstractGroup >> allLambdas [ + + + ^ self allUsing: FamixTLambda +] + { #category : #'*Famix-Traits' } MooseAbstractGroup >> allLocalVariables [ @@ -147,6 +154,13 @@ MooseAbstractGroup >> allModelImports [ ^ self cacheAt: 'All model imports' ifAbsentPut: [ MooseGroup withAll: (self allImports reject: [ :each | each isStub ]) withDescription: 'All model imports' ] ] +{ #category : #'*Famix-Traits' } +MooseAbstractGroup >> allModelLambdas [ + + + ^ self cacheAt: 'All model lambdas' ifAbsentPut: [ MooseGroup withAll: (self allLambdas reject: [ :each | each isStub ]) withDescription: 'All model lambdas' ] +] + { #category : #'*Famix-Traits' } MooseAbstractGroup >> allModelMethods [