Skip to content

Commit 6c6f73b

Browse files
committed
Handle better the parameters.
Only thing left on parameters now is to refine the default value type by introducing a new trait
1 parent 35a38f2 commit 6c6f73b

11 files changed

+460
-124
lines changed

src/FAST-Python-Model-Generator/FASTPythonMetamodelGenerator.class.st

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ Class {
2828
'conditionalExpression',
2929
'constrainedType',
3030
'continueStatement',
31-
'decoratedDefinition',
3231
'decorator',
33-
'defaultParameter',
3432
'deleteStatement',
3533
'dictPattern',
3634
'dictionary',
@@ -50,7 +48,6 @@ Class {
5048
'forInClause',
5149
'forStatement',
5250
'formatExpression',
53-
'formatSpecifier',
5451
'functionDefinition',
5552
'generatorExpression',
5653
'genericType',
@@ -67,7 +64,6 @@ Class {
6764
'keywordSeparator',
6865
'lambda',
6966
'lambdaParameters',
70-
'lineContinuation',
7167
'list',
7268
'listComprehension',
7369
'listPattern',
@@ -81,7 +77,6 @@ Class {
8177
'notOperator',
8278
'pair',
8379
'parameter',
84-
'parenthesizedExpression',
8580
'parenthesizedListSplat',
8681
'passStatement',
8782
'patternList',
@@ -102,9 +97,6 @@ Class {
10297
'type',
10398
'typeAliasStatement',
10499
'typeConversion',
105-
'typeParameter',
106-
'typedDefaultParameter',
107-
'typedParameter',
108100
'unaryOperator',
109101
'unionPattern',
110102
'unionType',
@@ -219,7 +211,6 @@ FASTPythonMetamodelGenerator >> defineClasses [
219211
constrainedType := builder ensureClassNamed: #ConstrainedType."Todo"
220212
continueStatement := builder ensureClassNamed: #ContinueStatement.
221213
decorator := builder ensureClassNamed: #Decorator."Todo"
222-
defaultParameter := builder ensureClassNamed: #DefaultParameter."Todo"
223214
deleteStatement := builder ensureClassNamed: #DeleteStatement.
224215
dictPattern := builder ensureClassNamed: #DictPattern."Todo"
225216
dictionary := builder ensureClassNamed: #Dictionary."To Review"
@@ -299,9 +290,6 @@ FASTPythonMetamodelGenerator >> defineClasses [
299290
type := builder ensureClassNamed: #Type."Todo"
300291
typeAliasStatement := builder ensureClassNamed: #TypeAliasStatement."Todo"
301292
typeConversion := builder ensureClassNamed: #TypeConversion."Todo"
302-
typeParameter := builder ensureClassNamed: #TypeParameter."Todo"
303-
typedDefaultParameter := builder ensureClassNamed: #TypedDefaultParameter."Todo"
304-
typedParameter := builder ensureClassNamed: #TypedParameter."Todo"
305293
unaryOperator := builder ensureClassNamed: #UnaryOperator.
306294
unionPattern := builder ensureClassNamed: #UnionPattern."Todo"
307295
unionType := builder ensureClassNamed: #UnionType."Todo"
@@ -674,6 +662,10 @@ FASTPythonMetamodelGenerator >> defineRelations [
674662
(pair property: #key) <>- (expression property: #pairKeyOwner).
675663

676664
(pair property: #value) <>- (expression property: #pairValueOwner).
665+
666+
(parameter property: #type) <>- (type property: #parentParameter).
667+
668+
(parameter property: #defaultValue) <>- (expression property: #parentDefaultParameterValue). "I need to refine the relation with a new trait."
677669

678670
(patternList property: #elements) <>-* (expression property: #patternListOwner).
679671

src/FAST-Python-Model/FASTPyDefaultParameter.class.st

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/FAST-Python-Model/FASTPyExpression.class.st

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
| `parentAwait` | `FASTPyExpression` | `expression` | `FASTPyAwait` | |
3232
| `parentComparisonOperator` | `FASTPyExpression` | `operands` | `FASTPyComparisonOperator` | Parent comparison expression of which I am.|
3333
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
34+
| `parentDefaultParameterValue` | `FASTPyExpression` | `defaultValue` | `FASTPyParameter` | |
3435
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
3536
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
3637
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
@@ -83,6 +84,7 @@ Class {
8384
'#parentAssignmentRight => FMOne type: #FASTPyAssignment opposite: #right',
8485
'#parentAwait => FMOne type: #FASTPyAwait opposite: #expression',
8586
'#parentComparisonOperator => FMOne type: #FASTPyComparisonOperator opposite: #operands',
87+
'#parentDefaultParameterValue => FMOne type: #FASTPyParameter opposite: #defaultValue',
8688
'#parentInterpolation => FMOne type: #FASTPyInterpolation opposite: #expression',
8789
'#parentType => FMOne type: #FASTPyType opposite: #expression',
8890
'#parentUnaryOperator => FMOne type: #FASTPyTUnaryOperator opposite: #argument',
@@ -639,6 +641,30 @@ FASTPyExpression >> parentComparisonOperatorGroup [
639641
^ MooseSpecializedGroup with: self parentComparisonOperator
640642
]
641643

644+
{ #category : 'accessing' }
645+
FASTPyExpression >> parentDefaultParameterValue [
646+
"Relation named: #parentDefaultParameterValue type: #FASTPyParameter opposite: #defaultValue"
647+
648+
<generated>
649+
<container>
650+
<derived>
651+
^ parentDefaultParameterValue
652+
]
653+
654+
{ #category : 'accessing' }
655+
FASTPyExpression >> parentDefaultParameterValue: anObject [
656+
657+
<generated>
658+
parentDefaultParameterValue := anObject
659+
]
660+
661+
{ #category : 'navigation' }
662+
FASTPyExpression >> parentDefaultParameterValueGroup [
663+
<generated>
664+
<navigation: 'ParentDefaultParameterValue'>
665+
^ MooseSpecializedGroup with: self parentDefaultParameterValue
666+
]
667+
642668
{ #category : 'accessing' }
643669
FASTPyExpression >> parentInterpolation [
644670
"Relation named: #parentInterpolation type: #FASTPyInterpolation opposite: #expression"

src/FAST-Python-Model/FASTPyParameter.class.st

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
| `parameterOwner` | `FASTTVariableEntity` | `parameters` | `FASTTWithParameters` | parameterOwner|
1010
| `parentAssignmentExpression` | `FASTTVariableEntity` | `variable` | `FASTTAssignment` | Optional assignment to the variable|
1111
12+
### Children
13+
| Relation | Origin | Opposite | Type | Comment |
14+
|---|
15+
| `defaultValue` | `FASTPyParameter` | `parentDefaultParameterValue` | `FASTPyExpression` | |
16+
| `type` | `FASTPyParameter` | `parentParameter` | `FASTPyType` | |
17+
1218
1319
## Properties
1420
======================
@@ -25,6 +31,10 @@ Class {
2531
#superclass : 'FASTPyEntity',
2632
#traits : 'FASTTVariableEntity',
2733
#classTraits : 'FASTTVariableEntity classTrait',
34+
#instVars : [
35+
'#defaultValue => FMOne type: #FASTPyExpression opposite: #parentDefaultParameterValue',
36+
'#type => FMOne type: #FASTPyType opposite: #parentParameter'
37+
],
2838
#category : 'FAST-Python-Model-Entities',
2939
#package : 'FAST-Python-Model',
3040
#tag : 'Entities'
@@ -38,3 +48,47 @@ FASTPyParameter class >> annotation [
3848
<generated>
3949
^ self
4050
]
51+
52+
{ #category : 'accessing' }
53+
FASTPyParameter >> defaultValue [
54+
"Relation named: #defaultValue type: #FASTPyExpression opposite: #parentDefaultParameterValue"
55+
56+
<generated>
57+
^ defaultValue
58+
]
59+
60+
{ #category : 'accessing' }
61+
FASTPyParameter >> defaultValue: anObject [
62+
63+
<generated>
64+
defaultValue := anObject
65+
]
66+
67+
{ #category : 'navigation' }
68+
FASTPyParameter >> defaultValueGroup [
69+
<generated>
70+
<navigation: 'DefaultValue'>
71+
^ MooseSpecializedGroup with: self defaultValue
72+
]
73+
74+
{ #category : 'accessing' }
75+
FASTPyParameter >> type [
76+
"Relation named: #type type: #FASTPyType opposite: #parentParameter"
77+
78+
<generated>
79+
^ type
80+
]
81+
82+
{ #category : 'accessing' }
83+
FASTPyParameter >> type: anObject [
84+
85+
<generated>
86+
type := anObject
87+
]
88+
89+
{ #category : 'navigation' }
90+
FASTPyParameter >> typeGroup [
91+
<generated>
92+
<navigation: 'Type'>
93+
^ MooseSpecializedGroup with: self type
94+
]

src/FAST-Python-Model/FASTPyTEntityCreator.trait.st

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,6 @@ FASTPyTEntityCreator >> newDecorator [
216216
^ self add: FASTPyDecorator new
217217
]
218218

219-
{ #category : 'entity creation' }
220-
FASTPyTEntityCreator >> newDefaultParameter [
221-
222-
<generated>
223-
^ self add: FASTPyDefaultParameter new
224-
]
225-
226219
{ #category : 'entity creation' }
227220
FASTPyTEntityCreator >> newDeleteStatement [
228221

@@ -783,27 +776,6 @@ FASTPyTEntityCreator >> newTypeConversion [
783776
^ self add: FASTPyTypeConversion new
784777
]
785778

786-
{ #category : 'entity creation' }
787-
FASTPyTEntityCreator >> newTypeParameter [
788-
789-
<generated>
790-
^ self add: FASTPyTypeParameter new
791-
]
792-
793-
{ #category : 'entity creation' }
794-
FASTPyTEntityCreator >> newTypedDefaultParameter [
795-
796-
<generated>
797-
^ self add: FASTPyTypedDefaultParameter new
798-
]
799-
800-
{ #category : 'entity creation' }
801-
FASTPyTEntityCreator >> newTypedParameter [
802-
803-
<generated>
804-
^ self add: FASTPyTypedParameter new
805-
]
806-
807779
{ #category : 'entity creation' }
808780
FASTPyTEntityCreator >> newUnaryOperator [
809781

src/FAST-Python-Model/FASTPyType.class.st

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
88
| `parentFunctionDefinition` | `FASTPyType` | `returnType` | `FASTPyFunctionDefinition` | |
9+
| `parentParameter` | `FASTPyType` | `type` | `FASTPyParameter` | |
910
| `parentyTypeAliasStatementAlias` | `FASTPyType` | `left` | `FASTPyTypeAliasStatement` | |
1011
| `parentyTypeAliasStatementType` | `FASTPyType` | `right` | `FASTPyTypeAliasStatement` | |
1112
@@ -23,6 +24,7 @@ Class {
2324
#instVars : [
2425
'#expression => FMOne type: #FASTPyExpression opposite: #parentType',
2526
'#parentFunctionDefinition => FMOne type: #FASTPyFunctionDefinition opposite: #returnType',
27+
'#parentParameter => FMOne type: #FASTPyParameter opposite: #type',
2628
'#parentyTypeAliasStatementAlias => FMOne type: #FASTPyTypeAliasStatement opposite: #left',
2729
'#parentyTypeAliasStatementType => FMOne type: #FASTPyTypeAliasStatement opposite: #right'
2830
],
@@ -86,6 +88,30 @@ FASTPyType >> parentFunctionDefinitionGroup [
8688
^ MooseSpecializedGroup with: self parentFunctionDefinition
8789
]
8890

91+
{ #category : 'accessing' }
92+
FASTPyType >> parentParameter [
93+
"Relation named: #parentParameter type: #FASTPyParameter opposite: #type"
94+
95+
<generated>
96+
<container>
97+
<derived>
98+
^ parentParameter
99+
]
100+
101+
{ #category : 'accessing' }
102+
FASTPyType >> parentParameter: anObject [
103+
104+
<generated>
105+
parentParameter := anObject
106+
]
107+
108+
{ #category : 'navigation' }
109+
FASTPyType >> parentParameterGroup [
110+
<generated>
111+
<navigation: 'ParentParameter'>
112+
^ MooseSpecializedGroup with: self parentParameter
113+
]
114+
89115
{ #category : 'accessing' }
90116
FASTPyType >> parentyTypeAliasStatementAlias [
91117
"Relation named: #parentyTypeAliasStatementAlias type: #FASTPyTypeAliasStatement opposite: #left"

src/FAST-Python-Model/FASTPyTypeParameter.class.st

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/FAST-Python-Model/FASTPyTypedDefaultParameter.class.st

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/FAST-Python-Model/FASTPyTypedParameter.class.st

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)