Skip to content

Commit 182765f

Browse files
committed
Manage all blocs that same way. Inlining them in their users
1 parent 4f7a0e0 commit 182765f

7 files changed

Lines changed: 230 additions & 382 deletions

File tree

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Class {
1212
'augmentedAssignment',
1313
'await',
1414
'binaryOperator',
15-
'block',
1615
'booleanOperator',
1716
'breakStatement',
1817
'call',
@@ -125,7 +124,6 @@ Class {
125124
'tConditionalStatement',
126125
'complex',
127126
'thenClause',
128-
'tLoopStatement',
129127
'statement',
130128
'tWithStatements',
131129
'tNumericalLiteral',
@@ -189,7 +187,6 @@ FASTPythonMetamodelGenerator >> defineClasses [
189187
augmentedAssignment := builder ensureClassNamed: #AugmentedAssignment."Todo"
190188
await := builder ensureClassNamed: #Await."Todo"
191189
binaryOperator := builder ensureClassNamed: #BinaryOperator.
192-
block := builder ensureClassNamed: #Block."To review"
193190
boolean := builder ensureClassNamed: #Boolean.
194191
booleanOperator := builder ensureClassNamed: #BooleanOperator.
195192
breakStatement := builder ensureClassNamed: #BreakStatement.
@@ -324,8 +321,6 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
324321
binaryOperator --|> tSplatExpression.
325322
binaryOperator --|> tPattern.
326323

327-
block --|> tStatementBlock.
328-
329324
booleanOperator --|> operator.
330325
booleanOperator --|> tBinaryExpression. "I am not 100% sure this is the best trait to use but it seems to work well for now"
331326
booleanOperator --|> tSplatExpression.
@@ -386,7 +381,7 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
386381

387382
elseClause --|> tStatementBlock.
388383

389-
elifClause --|> block.
384+
elifClause --|> tStatementBlock.
390385
elifClause --|> tConditionalStatement.
391386

392387
ellipsis --|> literal.
@@ -407,7 +402,7 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
407402
forInClause --|> expression. "This is wrong! I am just here temporarily until we rework the relation to the for in clause (I need to be able to be a clause of a list comprehension)"
408403

409404
forStatement --|> statement.
410-
forStatement --|> tLoopStatement.
405+
forStatement --|> tStatementBlock.
411406
forStatement --|> tWithElseClause.
412407

413408
functionDefinition --|> statement.
@@ -570,7 +565,7 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
570565

571566
whileStatement --|> statement.
572567
whileStatement --|> tConditionalStatement.
573-
whileStatement --|> tLoopStatement.
568+
whileStatement --|> tStatementBlock.
574569
whileStatement --|> tWithElseClause.
575570

576571
withStatement --|> statement.
@@ -828,7 +823,6 @@ FASTPythonMetamodelGenerator >> defineTraits [
828823
tExpression := self remoteTrait: #TExpression withPrefix: #FAST.
829824
tInvocation := self remoteTrait: #TInvocation withPrefix: #FAST.
830825
tLiteral := self remoteTrait: #TLiteral withPrefix: #FAST.
831-
tLoopStatement := self remoteTrait: #TLoopStatement withPrefix: #FAST.
832826
tNamedBehaviouralEntity := self remoteTrait: #TNamedBehaviouralEntity withPrefix: #FAST.
833827
tNamedEntity := self remoteTrait: #TNamedEntity withPrefix: #FAST.
834828
tNumericalLiteral := self remoteTrait: #TNumericalLiteral withPrefix: #FAST.

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

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

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Parents
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
8+
| `fastBehaviouralParent` | `FASTTStatementBlock` | `statementBlock` | `FASTTWithStatements` | Behavioural entity containing the statement block.|
89
| `ifStatementOwner` | `FASTPyElifClause` | `elifClauses` | `FASTPyIfStatement` | |
910
| `parentLoopStatement` | `FASTTStatement` | `body` | `FASTTLoopStatement` | Optional loop of which this statement is the body|
1011
| `statementContainer` | `FASTTStatement` | `statements` | `FASTTStatementBlock` | Block containing this statement.|
@@ -13,6 +14,7 @@
1314
| Relation | Origin | Opposite | Type | Comment |
1415
|---|
1516
| `condition` | `FASTTWithCondition` | `parentConditional` | `FASTTExpression` | The boolean condition tested|
17+
| `statements` | `FASTTStatementBlock` | `statementContainer` | `FASTTStatement` | Statements enclosed in this block|
1618
1719
1820
## Properties
@@ -26,9 +28,9 @@
2628
"
2729
Class {
2830
#name : 'FASTPyElifClause',
29-
#superclass : 'FASTPyBlock',
30-
#traits : 'FASTTConditionalStatement',
31-
#classTraits : 'FASTTConditionalStatement classTrait',
31+
#superclass : 'FASTPyEntity',
32+
#traits : 'FASTTConditionalStatement + FASTTStatementBlock',
33+
#classTraits : 'FASTTConditionalStatement classTrait + FASTTStatementBlock classTrait',
3234
#instVars : [
3335
'#ifStatementOwner => FMOne type: #FASTPyIfStatement opposite: #elifClauses'
3436
],
@@ -40,7 +42,7 @@ Class {
4042
{ #category : 'meta' }
4143
FASTPyElifClause class >> annotation [
4244

43-
<FMClass: #ElifClause super: #FASTPyBlock>
45+
<FMClass: #ElifClause super: #FASTPyEntity>
4446
<package: #'FAST-Python-Model'>
4547
<generated>
4648
^ self

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
### Parents
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
8+
| `fastBehaviouralParent` | `FASTTStatementBlock` | `statementBlock` | `FASTTWithStatements` | Behavioural entity containing the statement block.|
89
| `parentLoopStatement` | `FASTTStatement` | `body` | `FASTTLoopStatement` | Optional loop of which this statement is the body|
910
| `statementContainer` | `FASTTStatement` | `statements` | `FASTTStatementBlock` | Block containing this statement.|
1011
1112
### Children
1213
| Relation | Origin | Opposite | Type | Comment |
1314
|---|
14-
| `body` | `FASTTLoopStatement` | `parentLoopStatement` | `FASTTStatement` | The body of the loop|
1515
| `elseClause` | `FASTPyTWithElseClause` | `ifStatementOwner` | `FASTPyElseClause` | |
1616
| `left` | `FASTPyForStatement` | `forStatementRightOwner` | `FASTPyExpression` | The identifier of the created local variable or tuple|
1717
| `right` | `FASTPyForStatement` | `forStatementLeftOwner` | `FASTPyExpression` | The list that the for statement iterates over|
18+
| `statements` | `FASTTStatementBlock` | `statementContainer` | `FASTTStatement` | Statements enclosed in this block|
1819
1920
2021
## Properties
@@ -29,8 +30,8 @@
2930
Class {
3031
#name : 'FASTPyForStatement',
3132
#superclass : 'FASTPyStatement',
32-
#traits : 'FASTPyTWithElseClause + FASTTLoopStatement',
33-
#classTraits : 'FASTPyTWithElseClause classTrait + FASTTLoopStatement classTrait',
33+
#traits : 'FASTPyTWithElseClause + FASTTStatementBlock',
34+
#classTraits : 'FASTPyTWithElseClause classTrait + FASTTStatementBlock classTrait',
3435
#instVars : [
3536
'#left => FMOne type: #FASTPyExpression opposite: #forStatementRightOwner',
3637
'#right => FMOne type: #FASTPyExpression opposite: #forStatementLeftOwner'

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,6 @@ FASTPyTEntityCreator >> newBinaryOperator [
6969
^ self add: FASTPyBinaryOperator new
7070
]
7171

72-
{ #category : 'entity creation' }
73-
FASTPyTEntityCreator >> newBlock [
74-
75-
<generated>
76-
^ self add: FASTPyBlock new
77-
]
78-
7972
{ #category : 'entity creation' }
8073
FASTPyTEntityCreator >> newBoolean [
8174

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
### Parents
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
8+
| `fastBehaviouralParent` | `FASTTStatementBlock` | `statementBlock` | `FASTTWithStatements` | Behavioural entity containing the statement block.|
89
| `parentLoopStatement` | `FASTTStatement` | `body` | `FASTTLoopStatement` | Optional loop of which this statement is the body|
910
| `statementContainer` | `FASTTStatement` | `statements` | `FASTTStatementBlock` | Block containing this statement.|
1011
1112
### Children
1213
| Relation | Origin | Opposite | Type | Comment |
1314
|---|
14-
| `body` | `FASTTLoopStatement` | `parentLoopStatement` | `FASTTStatement` | The body of the loop|
1515
| `condition` | `FASTTWithCondition` | `parentConditional` | `FASTTExpression` | The boolean condition tested|
1616
| `elseClause` | `FASTPyTWithElseClause` | `ifStatementOwner` | `FASTPyElseClause` | |
17+
| `statements` | `FASTTStatementBlock` | `statementContainer` | `FASTTStatement` | Statements enclosed in this block|
1718
1819
1920
## Properties
@@ -28,8 +29,8 @@
2829
Class {
2930
#name : 'FASTPyWhileStatement',
3031
#superclass : 'FASTPyStatement',
31-
#traits : 'FASTPyTWithElseClause + FASTTConditionalStatement + FASTTLoopStatement',
32-
#classTraits : 'FASTPyTWithElseClause classTrait + FASTTConditionalStatement classTrait + FASTTLoopStatement classTrait',
32+
#traits : 'FASTPyTWithElseClause + FASTTConditionalStatement + FASTTStatementBlock',
33+
#classTraits : 'FASTPyTWithElseClause classTrait + FASTTConditionalStatement classTrait + FASTTStatementBlock classTrait',
3334
#category : 'FAST-Python-Model-Entities',
3435
#package : 'FAST-Python-Model',
3536
#tag : 'Entities'

0 commit comments

Comments
 (0)