Skip to content

Commit

Permalink
Merge pull request #241 from moosetechnology/functionTypedeclaration
Browse files Browse the repository at this point in the history
Function typedeclaration
  • Loading branch information
uNouss authored Dec 20, 2024
2 parents ac88bbf + 6aabcef commit a591ebd
Show file tree
Hide file tree
Showing 22 changed files with 455 additions and 219 deletions.
12 changes: 6 additions & 6 deletions src/FAST-Fortran-Entities/FASTFortranAbstractExpression.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ I am the super class of all Fortran expressions
| `assignementExpressionOwner` | `FASTFortranAbstractExpression` | `expression` | `FASTFortranFunctionStatement` | The AssignementExpression owner (if possible)|
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
| `ioSpecifier` | `FASTTExpression` | `expression` | `FASTFortranIOParameter` | name of the parameter (keyword argument)|
| `parentArrayDimensionDeclarator` | `FASTFortranAbstractExpression` | `lowerBound` | `FASTFortranArrayRange` | Parent array dimension declarator|
| `parentArrayDimensionDeclarator` | `FASTFortranAbstractExpression` | `upperBound` | `FASTFortranArrayRange` | Parent array dimension declarator|
| `parentArrayDimensionDeclarator` | `FASTFortranAbstractExpression` | `lowerBound` | `FASTFortranArrayRange` | Parent array dimension declarator|
| `parentArrayExpression` | `FASTFortranAbstractExpression` | `indices` | `FASTFortranArrayVariable` | an ArrayVariable expression of which I am an indice|
| `parentConditionalStatement` | `FASTFortranAbstractExpression` | `condition` | `FASTFortranConditionalStatement` | Parent conditional statement (if-block, if-logical, ...)|
| `parentDataStatement` | `FASTFortranAbstractExpression` | `dataConstants` | `FASTFortranDataGroup` | |
Expand Down Expand Up @@ -44,17 +44,17 @@ Class {
#traits : 'FASTTExpression',
#classTraits : 'FASTTExpression classTrait',
#instVars : [
'#assignementExpressionOwner => FMOne type: #FASTFortranFunctionStatement opposite: #expression',
'#parentArrayDimensionDeclarator => FMOne type: #FASTFortranArrayRange opposite: #upperBound',
'#parentArrayExpression => FMOne type: #FASTFortranArrayVariable opposite: #indices',
'#parentConditionalStatement => FMOne type: #FASTFortranConditionalStatement opposite: #condition',
'#parentDataStatement => FMOne type: #FASTFortranDataGroup opposite: #dataConstants',
'#parentGotoAssignedStatement => FMOne type: #FASTFortranGoToAssignedStatement opposite: #selectorExpression',
'#variableDeclaratorOwner => FMOne type: #FASTFortranVariableDeclarator opposite: #expression',
'#assignementExpressionOwner => FMOne type: #FASTFortranFunctionStatement opposite: #expression',
'#parentGotoComputedStatement => FMOne type: #FASTFortranGoToComputedStatement opposite: #selectorExpression',
'#parentGotoAssignedStatement => FMOne type: #FASTFortranGoToAssignedStatement opposite: #selectorExpression',
'#parentConditionalStatement => FMOne type: #FASTFortranConditionalStatement opposite: #condition',
'#parentLoopControlIncrement => FMOne type: #FASTFortranLoopControlExpression opposite: #increment',
'#parentLoopControlLimit => FMOne type: #FASTFortranLoopControlExpression opposite: #limit',
'#parentTypeSize => FMOne type: #FASTFortranType opposite: #size',
'#variableDeclaratorOwner => FMOne type: #FASTFortranVariableDeclarator opposite: #expression'
'#parentTypeSize => FMOne type: #FASTFortranType opposite: #size'
],
#category : 'FAST-Fortran-Entities-Entities',
#package : 'FAST-Fortran-Entities',
Expand Down
29 changes: 3 additions & 26 deletions src/FAST-Fortran-Entities/FASTFortranFunction.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ I represent a Fortran Function
### Children
| Relation | Origin | Opposite | Type | Comment |
|---|
| `returnType` | `FASTFortranFunction` | `typedFunctions` | `FASTFortranType` | |
| `declaredType` | `FASTFortranTDeclaredType` | `parentDeclaration` | `FASTFortranType` | type|
"
Class {
#name : 'FASTFortranFunction',
#superclass : 'FASTFortranProcedure',
#instVars : [
'#returnType => FMOne type: #FASTFortranType opposite: #typedFunctions'
],
#traits : 'FASTFortranTDeclaredType',
#classTraits : 'FASTFortranTDeclaredType classTrait',
#category : 'FAST-Fortran-Entities-Entities',
#package : 'FAST-Fortran-Entities',
#tag : 'Entities'
Expand All @@ -31,25 +30,3 @@ FASTFortranFunction class >> annotation [
<generated>
^ self
]

{ #category : 'accessing' }
FASTFortranFunction >> returnType [
"Relation named: #returnType type: #FASTFortranType opposite: #typedFunctions"

<generated>
^ returnType
]

{ #category : 'accessing' }
FASTFortranFunction >> returnType: anObject [

<generated>
returnType := anObject
]

{ #category : 'navigation' }
FASTFortranFunction >> returnTypeGroup [
<generated>
<navigation: 'ReturnType'>
^ MooseSpecializedGroup with: self returnType
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"
I represent a return type declaration statement
## Relations
======================
### Parents
| Relation | Origin | Opposite | Type | Comment |
|---|
| `invokedIn` | `FASTTNamedEntity` | `invoked` | `FASTTInvocation` | Optional invocation where this name is used|
### Children
| Relation | Origin | Opposite | Type | Comment |
|---|
| `declaredType` | `FASTFortranTDeclaredType` | `parentDeclaration` | `FASTFortranType` | type|
## Properties
======================
| Name | Type | Default value | Comment |
|---|
| `endPos` | `Number` | nil | |
| `name` | `String` | nil | |
| `startPos` | `Number` | nil | |
"
Class {
#name : 'FASTFortranFunctionTypeDeclarationStatement',
#superclass : 'FASTFortranAbstractStatement',
#traits : 'FASTFortranTDeclaredType + FASTTNamedEntity',
#classTraits : 'FASTFortranTDeclaredType classTrait + FASTTNamedEntity classTrait',
#category : 'FAST-Fortran-Entities-Entities',
#package : 'FAST-Fortran-Entities',
#tag : 'Entities'
}

{ #category : 'meta' }
FASTFortranFunctionTypeDeclarationStatement class >> annotation [

<FMClass: #FunctionTypeDeclarationStatement super: #FASTFortranAbstractStatement>
<package: #'FAST-Fortran-Entities'>
<generated>
^ self
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ I represent a Fortran ""implied do"" expression
| Relation | Origin | Opposite | Type | Comment |
|---|
| `loopControl` | `FASTFortranTWithLoopControl` | `parentLoop` | `FASTFortranLoopControlExpression` | loop control|
| `variables` | `FASTFortranTVariableGroup` | `parentVariableGroup` | `FASTFortranVariable` | |
| `variables` | `FASTFortranImpliedDoExpression` | `parentImpliedExpression` | `FASTTVariableEntity` | |
| `variables` | `FASTFortranTVariableGroup` | `parentVariableGroup` | `FASTFortranVariable` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Contains the block of Fortran statements
|---|
| `fastBehaviouralParent` | `FASTTStatementBlock` | `statementBlock` | `FASTTBehaviouralEntity` | Behavioural entity containing the statement block.|
| `parentDoStatement` | `FASTFortranStatementBlock` | `statementBlock` | `FASTFortranDoStatement` | Parent do statement|
| `parentIfBlock` | `FASTFortranStatementBlock` | `thenStatementBlock` | `FASTFortranIfBlockStatement` | Parent if block|
| `parentIfBlock` | `FASTFortranStatementBlock` | `elseStatementBlock` | `FASTFortranIfBlockStatement` | Parent if block|
| `parentIfBlock` | `FASTFortranStatementBlock` | `thenStatementBlock` | `FASTFortranIfBlockStatement` | Parent if block|
| `statementContainer` | `FASTTStatement` | `statements` | `FASTTStatementBlock` | Block containing this statement.|
### Children
Expand Down
55 changes: 55 additions & 0 deletions src/FAST-Fortran-Entities/FASTFortranTDeclaredType.trait.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"
I am the declared type of a function or variable
## Relations
======================
### Children
| Relation | Origin | Opposite | Type | Comment |
|---|
| `declaredType` | `FASTFortranTDeclaredType` | `parentDeclaration` | `FASTFortranType` | type|
"
Trait {
#name : 'FASTFortranTDeclaredType',
#instVars : [
'#declaredType => FMOne type: #FASTFortranType opposite: #parentDeclaration'
],
#category : 'FAST-Fortran-Entities-Traits',
#package : 'FAST-Fortran-Entities',
#tag : 'Traits'
}

{ #category : 'meta' }
FASTFortranTDeclaredType classSide >> annotation [

<FMClass: #TDeclaredType super: #Object>
<package: #'FAST-Fortran-Entities'>
<generated>
^ self
]

{ #category : 'accessing' }
FASTFortranTDeclaredType >> declaredType [
"Relation named: #declaredType type: #FASTFortranType opposite: #parentDeclaration"

<generated>
<FMComment: 'type'>
^ declaredType
]

{ #category : 'accessing' }
FASTFortranTDeclaredType >> declaredType: anObject [

<generated>
declaredType := anObject
]

{ #category : 'navigation' }
FASTFortranTDeclaredType >> declaredTypeGroup [
<generated>
<navigation: 'DeclaredType'>
^ MooseSpecializedGroup with: self declaredType
]
7 changes: 7 additions & 0 deletions src/FAST-Fortran-Entities/FASTFortranTEntityCreator.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,13 @@ FASTFortranTEntityCreator >> newFunctionStatement [
^ self add: FASTFortranFunctionStatement new
]

{ #category : 'entity creation' }
FASTFortranTEntityCreator >> newFunctionTypeDeclarationStatement [

<generated>
^ self add: FASTFortranFunctionTypeDeclarationStatement new
]

{ #category : 'entity creation' }
FASTFortranTEntityCreator >> newGoToAssignedStatement [

Expand Down
34 changes: 4 additions & 30 deletions src/FAST-Fortran-Entities/FASTFortranType.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ I represent Fortran Type statement
### Parents
| Relation | Origin | Opposite | Type | Comment |
|---|
| `parentDeclaration` | `FASTFortranType` | `type` | `FASTFortranVariableDeclarationStatement` | Parent declaration|
| `parentDeclaration` | `FASTFortranType` | `declaredType` | `FASTFortranTDeclaredType` | Parent declaration|
| `parentImplicitRule` | `FASTFortranType` | `type` | `FASTFortranImplicitTypingRule` | |
| `typedFunctions` | `FASTFortranType` | `returnType` | `FASTFortranFunction` | |
### Children
| Relation | Origin | Opposite | Type | Comment |
Expand All @@ -23,10 +22,9 @@ Class {
#name : 'FASTFortranType',
#superclass : 'FASTFortranEntity',
#instVars : [
'#parentDeclaration => FMOne type: #FASTFortranVariableDeclarationStatement opposite: #type',
'#parentDeclaration => FMOne type: #FASTFortranTDeclaredType opposite: #declaredType',
'#parentImplicitRule => FMOne type: #FASTFortranImplicitTypingRule opposite: #type',
'#size => FMOne type: #FASTFortranAbstractExpression opposite: #parentTypeSize',
'#typedFunctions => FMOne type: #FASTFortranFunction opposite: #returnType'
'#size => FMOne type: #FASTFortranAbstractExpression opposite: #parentTypeSize'
],
#category : 'FAST-Fortran-Entities-Entities',
#package : 'FAST-Fortran-Entities',
Expand All @@ -44,7 +42,7 @@ FASTFortranType class >> annotation [

{ #category : 'accessing' }
FASTFortranType >> parentDeclaration [
"Relation named: #parentDeclaration type: #FASTFortranVariableDeclarationStatement opposite: #type"
"Relation named: #parentDeclaration type: #FASTFortranTDeclaredType opposite: #declaredType"

<generated>
<FMComment: 'Parent declaration'>
Expand Down Expand Up @@ -113,27 +111,3 @@ FASTFortranType >> sizeGroup [
<navigation: 'Size'>
^ MooseSpecializedGroup with: self size
]

{ #category : 'accessing' }
FASTFortranType >> typedFunctions [
"Relation named: #typedFunctions type: #FASTFortranFunction opposite: #returnType"

<generated>
<container>
<derived>
^ typedFunctions
]

{ #category : 'accessing' }
FASTFortranType >> typedFunctions: anObject [

<generated>
typedFunctions := anObject
]

{ #category : 'navigation' }
FASTFortranType >> typedFunctionsGroup [
<generated>
<navigation: 'TypedFunctions'>
^ MooseSpecializedGroup with: self typedFunctions
]
4 changes: 2 additions & 2 deletions src/FAST-Fortran-Entities/FASTFortranVariable.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ Class {
#traits : 'FASTFortranTEntryArgument + FASTFortranTFormat + FASTTVariableEntity',
#classTraits : 'FASTFortranTEntryArgument classTrait + FASTFortranTFormat classTrait + FASTTVariableEntity classTrait',
#instVars : [
'#pointerIn => FMOne type: #FASTFortranFieldAccess opposite: #pointer',
'#fieldIn => FMOne type: #FASTFortranFieldAccess opposite: #field',
'#parentVariableGroup => FMOne type: #FASTFortranTVariableGroup opposite: #variables',
'#pointerIn => FMOne type: #FASTFortranFieldAccess opposite: #pointer'
'#parentVariableGroup => FMOne type: #FASTFortranTVariableGroup opposite: #variables'
],
#category : 'FAST-Fortran-Entities-Entities',
#package : 'FAST-Fortran-Entities',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ I represent a type declaration for one or many scalar variables or arrays
| Relation | Origin | Opposite | Type | Comment |
|---|
| `declarators` | `FASTFortranTWithDeclarators` | `parentDeclaration` | `FASTFortranVariableDeclarator` | variables declared|
| `type` | `FASTFortranVariableDeclarationStatement` | `parentDeclaration` | `FASTFortranType` | type|
| `declaredType` | `FASTFortranTDeclaredType` | `parentDeclaration` | `FASTFortranType` | type|
"
Class {
#name : 'FASTFortranVariableDeclarationStatement',
#superclass : 'FASTFortranAbstractStatement',
#traits : 'FASTFortranTWithDeclarators',
#classTraits : 'FASTFortranTWithDeclarators classTrait',
#instVars : [
'#type => FMOne type: #FASTFortranType opposite: #parentDeclaration'
],
#traits : 'FASTFortranTDeclaredType + FASTFortranTWithDeclarators',
#classTraits : 'FASTFortranTDeclaredType classTrait + FASTFortranTWithDeclarators classTrait',
#category : 'FAST-Fortran-Entities-Entities',
#package : 'FAST-Fortran-Entities',
#tag : 'Entities'
Expand All @@ -34,26 +31,3 @@ FASTFortranVariableDeclarationStatement class >> annotation [
<generated>
^ self
]

{ #category : 'accessing' }
FASTFortranVariableDeclarationStatement >> type [
"Relation named: #type type: #FASTFortranType opposite: #parentDeclaration"

<generated>
<FMComment: 'type'>
^ type
]

{ #category : 'accessing' }
FASTFortranVariableDeclarationStatement >> type: anObject [

<generated>
type := anObject
]

{ #category : 'navigation' }
FASTFortranVariableDeclarationStatement >> typeGroup [
<generated>
<navigation: 'Type'>
^ MooseSpecializedGroup with: self type
]
Loading

0 comments on commit a591ebd

Please sign in to comment.