Skip to content

Commit ebc2e32

Browse files
committed
Merge list and dictionary splat parameters
1 parent bc88524 commit ebc2e32

10 files changed

Lines changed: 43 additions & 120 deletions

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

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,16 @@ Class {
143143
'tAssignable',
144144
'tReturnReferenceable',
145145
'tSplatExpression',
146-
'listSplatParameter',
147146
'tSplatParameterTarget',
148-
'tSplatParameter',
149-
'dictionarySplatParameter',
150147
'tPattern',
151148
'tClassPatternElement',
152149
'tUnionMember',
153150
'tDeletable',
154151
'tTypeContent',
155152
'typeParameter',
156153
'tWithTypeParameters',
157-
'splat'
154+
'splat',
155+
'splatParameter'
158156
],
159157
#category : 'FAST-Python-Model-Generator',
160158
#package : 'FAST-Python-Model-Generator'
@@ -212,7 +210,6 @@ FASTPythonMetamodelGenerator >> defineClasses [
212210
deleteStatement := builder ensureClassNamed: #DeleteStatement.
213211
dictionary := builder ensureClassNamed: #Dictionary."To Review"
214212
dictionaryComprehension := builder ensureClassNamed: #DictionaryComprehension."Todo"
215-
dictionarySplatParameter := builder ensureClassNamed: #DictionarySplatParameter."Todo"
216213
dottedName := builder ensureClassNamed: #DottedName."Todo"
217214
elifClause := builder ensureClassNamed: #ElifClause."Todo"
218215
ellipsis := builder ensureClassNamed: #Ellipsis.
@@ -248,7 +245,6 @@ FASTPythonMetamodelGenerator >> defineClasses [
248245
lambdaParameters := builder ensureClassNamed: #LambdaParameters."Todo"
249246
list := builder ensureClassNamed: #List.
250247
listComprehension := builder ensureClassNamed: #ListComprehension."Todo"
251-
listSplatParameter := builder ensureClassNamed: #ListSplatParameter."Todo"
252248
literal := builder ensureClassNamed: #Literal.
253249
matchStatement := builder ensureClassNamed: #MatchStatement."Todo"
254250
memberType := builder ensureClassNamed: #MemberType."Todo"
@@ -271,6 +267,7 @@ FASTPythonMetamodelGenerator >> defineClasses [
271267
setComprehension := builder ensureClassNamed: #SetComprehension."Todo"
272268
slice := builder ensureClassNamed: #Slice. "To review"
273269
(splat := builder ensureClassNamed: #Splat) comment: 'In Python a collection (list or dictionary) splat is the unpacking of a collection in a call or in the definition of another definition like `[ *list , 4 ]` or `func(*list)`'.
270+
splatParameter := builder ensureClassNamed: #SplatParameter.
274271
splatType := builder ensureClassNamed: #SplatType."Todo"
275272
statement := builder ensureClassNamed: #Statement.
276273
string := builder ensureClassNamed: #String.
@@ -377,9 +374,6 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
377374
dictionaryComprehension --|> expression.
378375
dictionaryComprehension --|> tComprehension.
379376

380-
dictionarySplatParameter --|> parameter.
381-
dictionarySplatParameter --|> tSplatParameter.
382-
383377
dottedName --|> expression.
384378
dottedName --|> tPattern.
385379
dottedName --|> tClassPatternElement.
@@ -463,9 +457,6 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
463457
listComprehension --|> expression.
464458
listComprehension --|> tComprehension.
465459

466-
listSplatParameter --|> parameter.
467-
listSplatParameter --|> tSplatParameter.
468-
469460
literal --|> expression.
470461
literal --|> tLiteral.
471462
literal --|> tPattern.
@@ -516,6 +507,8 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
516507

517508
splat --|> expression.
518509
splat --|> tPattern.
510+
511+
splatParameter --|> parameter.
519512

520513
splatType --|> tTypeContent.
521514
splatType --|> tNamedEntity.
@@ -760,7 +753,7 @@ FASTPythonMetamodelGenerator >> defineRelations [
760753

761754
(tryStatement property: #excepts) <>-* (exceptClause property: #parentTryStatement).
762755

763-
(tSplatParameter property: #target) <>- (tSplatParameterTarget property: #parentSplatParameter).
756+
(splatParameter property: #target) <>- (tSplatParameterTarget property: #parentSplatParameter).
764757

765758
((tUnaryOperator property: #argument) comment: 'Expression influanced by the unary operator..')
766759
<>- ((expression property: #parentUnaryOperator) comment: 'Parent unary operator in which I am.').
@@ -816,8 +809,6 @@ FASTPythonMetamodelGenerator >> defineTraits [
816809

817810
tSplatExpression := (builder newTraitNamed: #TSplatExpression) comment: 'My users are expressions that can be in a collection splat. For example in `[ *getList(), 3 ]`, we have a list splat on the call `getList()`. Get list, is the expression of the splat.'.
818811

819-
(tSplatParameter := builder newTraitNamed: #TSplatParameter) comment: 'I represent a parameter that is a list or dictionary splat.'.
820-
821812
tSplatParameterTarget := (builder newTraitNamed: #TSplatParameterTarget) comment: 'My users are parameter target in a splat. For example in `def f(*list): pass`, we have a list splat parameter named list.'.
822813

823814
(tTypeContent := builder newTraitNamed: #TTypeContent) comment: 'My user can be used as a type declaration'.

‎src/FAST-Python-Model/FASTPyAttributeAccess.class.st‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1313
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
1414
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
15-
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPyTSplatParameter` | |
15+
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPySplatParameter` | |
1616
1717
### Children
1818
| Relation | Origin | Opposite | Type | Comment |

‎src/FAST-Python-Model/FASTPyDictionarySplatParameter.class.st‎

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

‎src/FAST-Python-Model/FASTPyIdentifier.class.st‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1414
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
1515
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
16-
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPyTSplatParameter` | |
16+
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPySplatParameter` | |
1717
1818
1919

‎src/FAST-Python-Model/FASTPyListSplatParameter.class.st‎

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

src/FAST-Python-Model/FASTPyTSplatParameter.trait.st renamed to src/FAST-Python-Model/FASTPySplatParameter.class.st

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
11
"
2-
I represent a parameter that is a list or dictionary splat.
3-
42
## Relations
53
======================
64
75
### Children
86
| Relation | Origin | Opposite | Type | Comment |
97
|---|
10-
| `target` | `FASTPyTSplatParameter` | `parentSplatParameter` | `FASTPyTSplatParameterTarget` | |
8+
| `target` | `FASTPySplatParameter` | `parentSplatParameter` | `FASTPyTSplatParameterTarget` | |
119
1210
1311
1412
"
15-
Trait {
16-
#name : 'FASTPyTSplatParameter',
13+
Class {
14+
#name : 'FASTPySplatParameter',
15+
#superclass : 'FASTPyParameter',
1716
#instVars : [
1817
'#target => FMOne type: #FASTPyTSplatParameterTarget opposite: #parentSplatParameter'
1918
],
20-
#category : 'FAST-Python-Model-Traits',
19+
#category : 'FAST-Python-Model-Entities',
2120
#package : 'FAST-Python-Model',
22-
#tag : 'Traits'
21+
#tag : 'Entities'
2322
}
2423

2524
{ #category : 'meta' }
26-
FASTPyTSplatParameter classSide >> annotation [
25+
FASTPySplatParameter class >> annotation [
2726

28-
<FMClass: #TSplatParameter super: #Object>
27+
<FMClass: #SplatParameter super: #FASTPyParameter>
2928
<package: #'FAST-Python-Model'>
3029
<generated>
3130
^ self
3231
]
3332

3433
{ #category : 'accessing' }
35-
FASTPyTSplatParameter >> target [
34+
FASTPySplatParameter >> target [
3635
"Relation named: #target type: #FASTPyTSplatParameterTarget opposite: #parentSplatParameter"
3736

3837
<generated>
3938
^ target
4039
]
4140

4241
{ #category : 'accessing' }
43-
FASTPyTSplatParameter >> target: anObject [
42+
FASTPySplatParameter >> target: anObject [
4443

4544
<generated>
4645
target := anObject
4746
]
4847

4948
{ #category : 'navigation' }
50-
FASTPyTSplatParameter >> targetGroup [
49+
FASTPySplatParameter >> targetGroup [
5150
<generated>
5251
<navigation: 'Target'>
5352
^ MooseSpecializedGroup with: self target

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

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,6 @@ FASTPyTEntityCreator >> newDictionaryComprehension [
216216
^ self add: FASTPyDictionaryComprehension new
217217
]
218218

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

@@ -475,13 +468,6 @@ FASTPyTEntityCreator >> newListComprehension [
475468
^ self add: FASTPyListComprehension new
476469
]
477470

478-
{ #category : 'entity creation' }
479-
FASTPyTEntityCreator >> newListSplatParameter [
480-
481-
<generated>
482-
^ self add: FASTPyListSplatParameter new
483-
]
484-
485471
{ #category : 'entity creation' }
486472
FASTPyTEntityCreator >> newLiteral [
487473

@@ -629,6 +615,13 @@ FASTPyTEntityCreator >> newSplat [
629615
^ self add: FASTPySplat new
630616
]
631617

618+
{ #category : 'entity creation' }
619+
FASTPyTEntityCreator >> newSplatParameter [
620+
621+
<generated>
622+
^ self add: FASTPySplatParameter new
623+
]
624+
632625
{ #category : 'entity creation' }
633626
FASTPyTEntityCreator >> newSplatType [
634627

‎src/FAST-Python-Model/FASTPyTSplatParameterTarget.trait.st‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ My users are parameter target in a splat. For example in `def f(*list): pass`, w
77
### Parents
88
| Relation | Origin | Opposite | Type | Comment |
99
|---|
10-
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPyTSplatParameter` | |
10+
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPySplatParameter` | |
1111
1212
1313
1414
"
1515
Trait {
1616
#name : 'FASTPyTSplatParameterTarget',
1717
#instVars : [
18-
'#parentSplatParameter => FMOne type: #FASTPyTSplatParameter opposite: #target'
18+
'#parentSplatParameter => FMOne type: #FASTPySplatParameter opposite: #target'
1919
],
2020
#category : 'FAST-Python-Model-Traits',
2121
#package : 'FAST-Python-Model',
@@ -33,7 +33,7 @@ FASTPyTSplatParameterTarget classSide >> annotation [
3333

3434
{ #category : 'accessing' }
3535
FASTPyTSplatParameterTarget >> parentSplatParameter [
36-
"Relation named: #parentSplatParameter type: #FASTPyTSplatParameter opposite: #target"
36+
"Relation named: #parentSplatParameter type: #FASTPySplatParameter opposite: #target"
3737

3838
<generated>
3939
<container>

0 commit comments

Comments
 (0)