Skip to content

Commit 828ee3a

Browse files
committed
Manage most cases of list splats
1 parent 82414a5 commit 828ee3a

File tree

9 files changed

+657
-72
lines changed

9 files changed

+657
-72
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
357357
classDefinition --|> tDefinition.
358358

359359
collectionInitializer --|> expression.
360+
collectionInitializer --|> tCanBeSplatExpression.
360361

361362
collectionSplat --|> expression.
362363

@@ -377,7 +378,6 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
377378
deleteStatement --|> statement.
378379

379380
dictionary --|> collectionInitializer.
380-
dictionary --|> tCanBeSplatExpression.
381381

382382
dictionaryComprehension --|> expression.
383383
dictionaryComprehension --|> tComprehension.
@@ -448,8 +448,6 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
448448

449449
literal --|> expression.
450450
literal --|> tLiteral.
451-
452-
listSplat --|> expression.
453451

454452
methodDefinition --|> tNamedBehaviouralEntity.
455453
methodDefinition --|> tDefinition.
@@ -490,6 +488,7 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
490488

491489
string --|> literal.
492490
string --|> tStringLiteral.
491+
string --|> tCanBeSplatExpression.
493492

494493
subscript --|> expression.
495494
subscript --|> tDecoratorExpression.
@@ -617,9 +616,6 @@ FASTPythonMetamodelGenerator >> defineRelations [
617616

618617
(lambda property: #expression) <>- (expression property: #lambdaOwner).
619618

620-
((listSplat property: #iterable) comment: 'The iterable to unpack. Can be a collection, a call, an attribute access or a subscript.')
621-
<>- ((expression property: #listSplatOwner) comment: 'List splat unpacking me (if it''s the case)').
622-
623619
((nonlocalStatement property: #variables) comment: 'The variables scoped')
624620
<>-* ((variable property: #nonlocalOwner) comment: 'The global statement defining my scope (if it''s the case)').
625621

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
## Relations
33
======================
44
5+
### Parents
6+
| Relation | Origin | Opposite | Type | Comment |
7+
|---|
8+
| `parentSplat` | `FASTPyTCanBeSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
9+
510
### Children
611
| Relation | Origin | Opposite | Type | Comment |
712
|---|
@@ -13,6 +18,8 @@
1318
Class {
1419
#name : 'FASTPyCollectionInitializer',
1520
#superclass : 'FASTPyExpression',
21+
#traits : 'FASTPyTCanBeSplatExpression',
22+
#classTraits : 'FASTPyTCanBeSplatExpression classTrait',
1623
#instVars : [
1724
'#initializers => FMMany type: #FASTPyExpression opposite: #collectionInitializer'
1825
],

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
Class {
1414
#name : 'FASTPyDictionary',
1515
#superclass : 'FASTPyCollectionInitializer',
16-
#traits : 'FASTPyTCanBeSplatExpression',
17-
#classTraits : 'FASTPyTCanBeSplatExpression classTrait',
1816
#category : 'FAST-Python-Model-Entities',
1917
#package : 'FAST-Python-Model',
2018
#tag : 'Entities'

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
| `ifClauseOwner` | `FASTPyExpression` | `expression` | `FASTPyIfClause` | |
2525
| `keywordArgumentOwner` | `FASTPyExpression` | `value` | `FASTPyKeywordArgument` | Keyword argument from which I am the value (if it's the case)|
2626
| `lambdaOwner` | `FASTPyExpression` | `expression` | `FASTPyLambda` | |
27-
| `listSplatOwner` | `FASTPyExpression` | `iterable` | `FASTPyListSplat` | List splat unpacking me (if it's the case)|
2827
| `pairKeyOwner` | `FASTTExpression` | `key` | `FASTPyPair` | |
2928
| `pairValueOwner` | `FASTTExpression` | `value` | `FASTPyPair` | |
3029
| `parentAssertStatement` | `FASTPyExpression` | `expressions` | `FASTPyAssertStatement` | The assert statement that own the expression (if it's the case)|
@@ -76,7 +75,6 @@ Class {
7675
'#ifClauseOwner => FMOne type: #FASTPyIfClause opposite: #expression',
7776
'#keywordArgumentOwner => FMOne type: #FASTPyKeywordArgument opposite: #value',
7877
'#lambdaOwner => FMOne type: #FASTPyLambda opposite: #expression',
79-
'#listSplatOwner => FMOne type: #FASTPyListSplat opposite: #iterable',
8078
'#parentAssertStatement => FMOne type: #FASTPyAssertStatement opposite: #expressions',
8179
'#parentAwait => FMOne type: #FASTPyAwait opposite: #expression',
8280
'#parentComparisonOperator => FMOne type: #FASTPyComparisonOperator opposite: #operands',
@@ -491,31 +489,6 @@ FASTPyExpression >> lambdaOwnerGroup [
491489
^ MooseSpecializedGroup with: self lambdaOwner
492490
]
493491

494-
{ #category : 'accessing' }
495-
FASTPyExpression >> listSplatOwner [
496-
"Relation named: #listSplatOwner type: #FASTPyListSplat opposite: #iterable"
497-
498-
<generated>
499-
<FMComment: 'List splat unpacking me (if it''s the case)'>
500-
<container>
501-
<derived>
502-
^ listSplatOwner
503-
]
504-
505-
{ #category : 'accessing' }
506-
FASTPyExpression >> listSplatOwner: anObject [
507-
508-
<generated>
509-
listSplatOwner := anObject
510-
]
511-
512-
{ #category : 'navigation' }
513-
FASTPyExpression >> listSplatOwnerGroup [
514-
<generated>
515-
<navigation: 'ListSplatOwner'>
516-
^ MooseSpecializedGroup with: self listSplatOwner
517-
]
518-
519492
{ #category : 'accessing' }
520493
FASTPyExpression >> parentAssertStatement [
521494
"Relation named: #parentAssertStatement type: #FASTPyAssertStatement opposite: #expressions"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
## Relations
33
======================
44
5-
### Children
5+
### Parents
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
8-
| `initializers` | `FASTPyTCollectionInitializer` | `collectionInitializers` | `FASTTExpression` | Each initializer defines one element.|
8+
| `parentSplat` | `FASTPyTCanBeSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
99
1010
1111

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

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
"
1313
Class {
1414
#name : 'FASTPyListSplat',
15-
#superclass : 'FASTPyExpression',
16-
#instVars : [
17-
'#iterable => FMOne type: #FASTPyExpression opposite: #listSplatOwner'
18-
],
15+
#superclass : 'FASTPyCollectionSplat',
1916
#category : 'FAST-Python-Model-Entities',
2017
#package : 'FAST-Python-Model',
2118
#tag : 'Entities'
@@ -24,31 +21,8 @@ Class {
2421
{ #category : 'meta' }
2522
FASTPyListSplat class >> annotation [
2623

27-
<FMClass: #ListSplat super: #FASTPyExpression>
24+
<FMClass: #ListSplat super: #FASTPyCollectionSplat>
2825
<package: #'FAST-Python-Model'>
2926
<generated>
3027
^ self
3128
]
32-
33-
{ #category : 'accessing' }
34-
FASTPyListSplat >> iterable [
35-
"Relation named: #iterable type: #FASTPyExpression opposite: #listSplatOwner"
36-
37-
<generated>
38-
<FMComment: 'The iterable to unpack. Can be a collection, a call, an attribute access or a subscript.'>
39-
^ iterable
40-
]
41-
42-
{ #category : 'accessing' }
43-
FASTPyListSplat >> iterable: anObject [
44-
45-
<generated>
46-
iterable := anObject
47-
]
48-
49-
{ #category : 'navigation' }
50-
FASTPyListSplat >> iterableGroup [
51-
<generated>
52-
<navigation: 'Iterable'>
53-
^ MooseSpecializedGroup with: self iterable
54-
]

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1616
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1717
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
18+
| `parentSplat` | `FASTPyTCanBeSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
1819
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
1920
2021
### Children
@@ -36,8 +37,8 @@
3637
Class {
3738
#name : 'FASTPyString',
3839
#superclass : 'FASTPyLiteral',
39-
#traits : 'FASTTStringLiteral',
40-
#classTraits : 'FASTTStringLiteral classTrait',
40+
#traits : 'FASTPyTCanBeSplatExpression + FASTTStringLiteral',
41+
#classTraits : 'FASTPyTCanBeSplatExpression classTrait + FASTTStringLiteral classTrait',
4142
#instVars : [
4243
'#interpolations => FMMany type: #FASTPyInterpolation opposite: #parentString',
4344
'#parentConcatenatedString => FMOne type: #FASTPyConcatenatedString opposite: #strings'

0 commit comments

Comments
 (0)