Skip to content

Commit ec55ffe

Browse files
committed
Introduce FASTTWithCondition
Because currently we have FASTTConditionalStatement but not everything with conditions are statements. For example conditional expressions in Java or Python are not statements but have conditions.
1 parent 8ad512a commit ec55ffe

15 files changed

Lines changed: 95 additions & 58 deletions

src/FAST-Core-Model/FASTTAssignment.trait.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A node representing an assignment
1010
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1111
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1212
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
13-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
13+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1515
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1616
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

src/FAST-Core-Model/FASTTBinaryExpression.trait.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A trait representing a binary expression of a node of a source code.
1010
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1111
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1212
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
13-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
13+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1515
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1616
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

src/FAST-Core-Model/FASTTBooleanLiteral.trait.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A boolean literal
1010
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1111
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1212
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
13-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
13+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1515
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1616
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

src/FAST-Core-Model/FASTTCharacterLiteral.trait.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A character literal
1010
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1111
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1212
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
13-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
13+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1515
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1616
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

src/FAST-Core-Model/FASTTConditionalStatement.trait.st

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ I represent any statement that has a boolean condition (eg. ifStatement)
1313
### Children
1414
| Relation | Origin | Opposite | Type | Comment |
1515
|---|
16-
| `condition` | `FASTTConditionalStatement` | `parentConditionalStatement` | `FASTTExpression` | The boolean condition tested|
16+
| `condition` | `FASTTWithCondition` | `parentConditional` | `FASTTExpression` | The boolean condition tested|
1717
1818
1919
## Properties
@@ -27,11 +27,8 @@ I represent any statement that has a boolean condition (eg. ifStatement)
2727
"
2828
Trait {
2929
#name : 'FASTTConditionalStatement',
30-
#instVars : [
31-
'#condition => FMOne type: #FASTTExpression opposite: #parentConditionalStatement'
32-
],
33-
#traits : 'FASTTStatement',
34-
#classTraits : 'FASTTStatement classTrait',
30+
#traits : 'FASTTStatement + FASTTWithCondition',
31+
#classTraits : 'FASTTStatement classTrait + FASTTWithCondition classTrait',
3532
#category : 'FAST-Core-Model-Traits',
3633
#package : 'FAST-Core-Model',
3734
#tag : 'Traits'
@@ -45,26 +42,3 @@ FASTTConditionalStatement classSide >> annotation [
4542
<generated>
4643
^ self
4744
]
48-
49-
{ #category : 'accessing' }
50-
FASTTConditionalStatement >> condition [
51-
"Relation named: #condition type: #FASTTExpression opposite: #parentConditionalStatement"
52-
53-
<generated>
54-
<FMComment: 'The boolean condition tested'>
55-
^ condition
56-
]
57-
58-
{ #category : 'accessing' }
59-
FASTTConditionalStatement >> condition: anObject [
60-
61-
<generated>
62-
condition := anObject
63-
]
64-
65-
{ #category : 'navigation' }
66-
FASTTConditionalStatement >> conditionGroup [
67-
<generated>
68-
<navigation: 'Condition'>
69-
^ MooseSpecializedGroup with: self condition
70-
]

src/FAST-Core-Model/FASTTExpression.trait.st

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ An abstract superclass representing an expression node of a source code.
1010
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1111
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1212
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
13-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
13+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1515
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1616
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
@@ -29,14 +29,14 @@ An abstract superclass representing an expression node of a source code.
2929
Trait {
3030
#name : 'FASTTExpression',
3131
#instVars : [
32+
'#argumentOwner => FMOne type: #FASTTWithArguments opposite: #arguments',
3233
'#assignedIn => FMOne type: #FASTTAssignment opposite: #expression',
33-
'#parentExpressionLeft => FMOne type: #FASTTBinaryExpression opposite: #leftOperand',
34-
'#parentExpressionRight => FMOne type: #FASTTBinaryExpression opposite: #rightOperand',
35-
'#parentConditionalStatement => FMOne type: #FASTTConditionalStatement opposite: #condition',
3634
'#expressionStatementOwner => FMOne type: #FASTTExpressionStatement opposite: #expression',
37-
'#returnOwner => FMOne type: #FASTTReturnStatement opposite: #expression',
35+
'#parentConditional => FMOne type: #FASTTWithCondition opposite: #condition',
3836
'#parentExpression => FMOne type: #FASTTUnaryExpression opposite: #expression',
39-
'#argumentOwner => FMOne type: #FASTTWithArguments opposite: #arguments'
37+
'#parentExpressionLeft => FMOne type: #FASTTBinaryExpression opposite: #leftOperand',
38+
'#parentExpressionRight => FMOne type: #FASTTBinaryExpression opposite: #rightOperand',
39+
'#returnOwner => FMOne type: #FASTTReturnStatement opposite: #expression'
4040
],
4141
#traits : 'FASTTEntity',
4242
#classTraits : 'FASTTEntity classTrait',
@@ -136,28 +136,35 @@ FASTTExpression >> isExpression [
136136
]
137137

138138
{ #category : 'accessing' }
139-
FASTTExpression >> parentConditionalStatement [
140-
"Relation named: #parentConditionalStatement type: #FASTTConditionalStatement opposite: #condition"
139+
FASTTExpression >> parentConditional [
140+
"Relation named: #parentConditional type: #FASTTWithCondition opposite: #condition"
141141

142142
<generated>
143-
<FMComment: 'Optional condition statement where this expression is used'>
143+
<FMComment: 'Optional condition statement/expression where this expression is used'>
144144
<container>
145145
<derived>
146-
^ parentConditionalStatement
146+
^ parentConditional
147147
]
148148

149149
{ #category : 'accessing' }
150-
FASTTExpression >> parentConditionalStatement: anObject [
150+
FASTTExpression >> parentConditional: anObject [
151151

152152
<generated>
153-
parentConditionalStatement := anObject
153+
parentConditional := anObject
154154
]
155155

156156
{ #category : 'navigation' }
157-
FASTTExpression >> parentConditionalStatementGroup [
157+
FASTTExpression >> parentConditionalGroup [
158158
<generated>
159-
<navigation: 'ParentConditionalStatement'>
160-
^ MooseSpecializedGroup with: self parentConditionalStatement
159+
<navigation: 'ParentConditional'>
160+
^ MooseSpecializedGroup with: self parentConditional
161+
]
162+
163+
{ #category : 'accessing' }
164+
FASTTExpression >> parentConditionalStatement [
165+
166+
self deprecated: 'Use #parentConditional instead.' transformWith: '`@rcv parentConditionalStatement' -> '`@rcv parentConditional'.
167+
^ self parentConditional
161168
]
162169

163170
{ #category : 'accessing' }

src/FAST-Core-Model/FASTTInvocation.trait.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A invocation of a behavioural entity
1010
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1111
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1212
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
13-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
13+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1515
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1616
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

src/FAST-Core-Model/FASTTLiteral.trait.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ FLAG: should refactor some literals to core-model
1515
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1616
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1717
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
18-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
18+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1919
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
2020
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
2121
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

src/FAST-Core-Model/FASTTNullPointerLiteral.trait.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ An undefined object literal
1010
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1111
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1212
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
13-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
13+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1515
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1616
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

src/FAST-Core-Model/FASTTNumericalLiteral.trait.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A numerical literal
1010
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
1111
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
1212
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
13-
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
13+
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1515
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1616
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

0 commit comments

Comments
 (0)