Skip to content

Commit fda1137

Browse files
committed
Begin to implement the assigned expressions
1 parent be5642a commit fda1137

5 files changed

Lines changed: 44 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ FASTPyAssignment class >> annotation [
4242
<generated>
4343
]
4444

45+
{ #category : 'accessing' }
46+
FASTPyAssignment >> assignedExpressions [
47+
48+
^ { self right }
49+
]
50+
4551
{ #category : 'testing' }
4652
FASTPyAssignment >> isDeclaration [
4753

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ FASTPyEntity class >> metamodel [
5050
^ FASTPyModel metamodel
5151
]
5252

53+
{ #category : 'accessing' }
54+
FASTPyEntity >> assignedExpressions [
55+
56+
^ Array empty
57+
]
58+
5359
{ #category : 'testing' }
5460
FASTPyEntity >> hasImmediateSource [
5561

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ FASTPyForInClause class >> annotation [
3131
<generated>
3232
]
3333

34+
{ #category : 'accessing' }
35+
FASTPyForInClause >> assignedExpressions [
36+
37+
^ { self right }
38+
]
39+
3440
{ #category : 'accessing' }
3541
FASTPyForInClause >> left [
3642
"Relation named: #left type: #FASTPyExpression opposite: #parentForInClauseLeft"

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ FASTPyForStatement class >> annotation [
4949
<generated>
5050
]
5151

52+
{ #category : 'accessing' }
53+
FASTPyForStatement >> assignedExpressions [
54+
55+
^ { self right }
56+
]
57+
5258
{ #category : 'accessing' }
5359
FASTPyForStatement >> left [
5460
"Relation named: #left type: #FASTPyExpression opposite: #parentForStatementLeft"

‎src/FAST-Python-Tools-Tests/FASTPythonVariablesAnalysisTest.class.st‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,26 @@ print(x)'.
9898
self assertCollection: model module statements fifth arguments first allWriteAccesses hasSameElements: result
9999
]
100100

101+
{ #category : 'tests' }
102+
FASTPythonVariablesAnalysisTest >> testAssignedExpressionsMap [
103+
104+
| variable result |
105+
self parseAndResolve: 'x = 1
106+
107+
print(x)
108+
109+
x = 2
110+
111+
if y > 3:
112+
x = 3
113+
114+
print(x)'.
115+
116+
variable := model module statements first left.
117+
result := variable assignedExpressionsMap.
118+
self skip "TODO: add assertions."
119+
]
120+
101121
{ #category : 'tests' }
102122
FASTPythonVariablesAnalysisTest >> testVersionAccessesOfIdentifier [
103123

0 commit comments

Comments
 (0)