Skip to content

Commit 5994482

Browse files
committed
Rename #variableDeclarator to #variableDeclaration
1 parent f8d9ec8 commit 5994482

9 files changed

Lines changed: 101 additions & 101 deletions

File tree

‎resources/doc/analysis.md‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ A general note: When we import an entity, we cannot know if it is a variable, a
55
> Note: Currently, analysis done with FASTPython are mostly done to analyse variables. So the documentation will be centered on analysis of variables and the algos are mostly tested on variables analysis and not functions, methods, ...ß
66
77
- [Doing analysis on FASTPython](#doing-analysis-on-fastpython)
8-
- [Overview of the analysis pipeline](#overview-of-the-analysis-pipeline)
9-
- [FAST utilities](#fast-utilities)
10-
- [Nodes additional API](#nodes-additional-api)
11-
- [FAST Python visitor](#fastpython-visitor)
12-
- [Local resolution](#local-resolution)
13-
- [Shadowing](#shadowing)
14-
- [Querying local resolver information](#querying-local-resolver-information)
15-
- [Control Flow Graph (CFG)](#control-flow-graph-cfg)
8+
- [Overview of the analysis pipeline](#overview-of-the-analysis-pipeline)
9+
- [FAST utilities](#fast-utilities)
10+
- [Nodes additional API](#nodes-additional-api)
11+
- [FAST Python visitor](#fastpython-visitor)
12+
- [Local resolution](#local-resolution)
13+
- [Shadowing](#shadowing)
14+
- [Querying local resolver information](#querying-local-resolver-information)
15+
- [Control Flow Graph (CFG)](#control-flow-graph-cfg)
1616
- [Static Single Assignment (SSA)](#static-single-assignment-ssa)
1717
- [Building](#building)
1818
- [Exploiting the SSA](#exploiting-the-ssa)
@@ -22,8 +22,8 @@ A general note: When we import an entity, we cannot know if it is a variable, a
2222
- [Subscript content](#subscript-content)
2323
- [Instance variables](#instance-variables)
2424
- [Python 2 VS Python 3](#python-2-vs-python-3)
25-
- [Global and Non local statement](#global-and-non-local-statement)
26-
- [API](#api)
25+
- [Global and Non local statement](#global-and-non-local-statement)
26+
- [API](#api)
2727
- [Variables analysis](#variables-analysis)
2828
- [Knowing what is a variable](#knowing-what-is-a-variable)
2929
- [Accessing the SSA versions of a variable](#accessing-the-ssa-versions-of-a-variable)
@@ -64,7 +64,7 @@ Some general properties got added such as:
6464
- `FASTPyMethodDefinition>>isAbstract` to know if a method is abstract
6565
- `FASTPyMethodDefinition>>selfName` to know the name of the self parameter (will be nil for static methods)
6666

67-
For nodes representing a write access to a variable (it is possible to find them easily once we resolved our project with the local resolver or the SSA), we can find the expressions used in their writing by using `#assignedExpressions` on the node doing the assignment, i.e. the `variableDeclarator` of the write access, not on the variable itself.
67+
For nodes representing a write access to a variable (it is possible to find them easily once we resolved our project with the local resolver or the SSA), we can find the expressions used in their writing by using `#assignedExpressions` on the node doing the assignment, i.e. the `variableDeclaration` of the write access, not on the variable itself.
6868

6969
> Note: you can find some warnings on this in the section [Querying local resolver information](#querying-local-resolver-information). They are the same.
7070
@@ -166,7 +166,7 @@ It is possible to ask a few things to the nodes once the resolution is done:
166166
- `node allNodesUsingMe` if the node is a variable, returns all the nodes using the variable: for each access of the variable, all its ancestors up to the statement containing it, without going further than the statement blocks (Module, function, method, clauses, ...). For example, for `return x + 3`, it returns the return statement and the binary operation
167167
- `node statementsUsingMe` if the node is a variable, returns the statements using the variable: same as `allNodesUsingMe` but only the statement of each access, without the intermediate nodes
168168
- `node callsOnVariable` if the node is a variable, returns the calls made on the variable, i.e. the `FASTPyCall` nodes having the variable as receiver: the callee of the call is the read of the variable itself (such as the invocation or instantiation `x()`) or an internal access on the variable (such as `x.append(1)` or `x[3]()`)
169-
- `node variableDeclarator` if the node that is a variable write access, it will return the node assigning the variable (can be an assignment, augmented assignment, for loop or for in clause)
169+
- `node variableDeclaration` if the node that is a variable write access, it will return the node assigning the variable (can be an assignment, augmented assignment, for loop or for in clause)
170170

171171
On the model:
172172
- `model allResolvedVariables` returns all nodes in the model that resolve to a variable declaration. This is a shortcut for querying the model-level view of all resolved variables
@@ -284,9 +284,9 @@ On top of this, it is possible to get information via the SSA directly with the
284284
### Assigned expressions
285285

286286
It is also possible to query what is assigned in variables once the SSA is done:
287-
- `node variableDeclarator` for a node that is a write access to a variable, it will return the node assigning the variable
287+
- `node variableDeclaration` for a node that is a write access to a variable, it will return the node assigning the variable
288288
- `node assignedExpressionsMap` for a variable, return a map of all expressions used to assigned the variable. The keys of the map are the write accesses that can impact the value of this variable. In some cases there will be only one. But if the variable is assigned in a conditional expression, it will get one entry by assignment that can impact the current variable value
289-
- `node transitiveAssignedExpressions` for a node doing an assignment (the `variableDeclarator` of a write access), returns the expressions used in the assignment and, for each variable used in those expressions, the expressions assigned to that variable, recursively
289+
- `node transitiveAssignedExpressions` for a node doing an assignment (the `variableDeclaration` of a write access), returns the expressions used in the assignment and, for each variable used in those expressions, the expressions assigned to that variable, recursively
290290
- `node transitiveAssignedExpressionsMap` for a variable, same as `assignedExpressionsMap` but the values are the transitive assigned expressions of each write access
291291

292292
Be carful, `x = 3` is not the only way to assign a variable. Take those cases into account:
@@ -479,7 +479,7 @@ The requirement column indicates what needs to be done on the model before using
479479
| `allAccesses` | Any access of a variable | LR | Returns all the read and write accesses to the variable |
480480
| `allReadAccesses` | Any access of a variable | LR | Returns all the read accesses to the variable |
481481
| `allWriteAccesses` | Any access of a variable | LR | Returns all the write accesses to the variable |
482-
| `variableDeclarator` | A write access of a variable | LR | Returns the node assigning the variable (assignment, augmented assignment, for loop or for in clause) |
482+
| `variableDeclaration` | A write access of a variable | LR | Returns the node assigning the variable (assignment, augmented assignment, for loop or for in clause) |
483483
| `versionAccesses` | Any access of a variable | SSA | Returns the read and write accesses for the current SSA version of the receiver |
484484
| `versionReadAccesses` | Any access of a variable | SSA | Returns the read accesses for the current SSA version of the receiver |
485485
| `versionWriteAccesses` | Any access of a variable | SSA | Returns the write accesses for the current SSA version of the receiver |
@@ -511,9 +511,9 @@ The requirement column indicates what needs to be done on the model before using
511511

512512
| Selector | Receiver | Requirement | Description |
513513
|---|---|---|---|
514-
| `assignedExpressions` | An assignment node (the `variableDeclarator` of a write access) | Vanilla | Returns the expressions used by this assignment. Returns an empty collection on any other node |
514+
| `assignedExpressions` | An assignment node (the `variableDeclaration` of a write access) | Vanilla | Returns the expressions used by this assignment. Returns an empty collection on any other node |
515515
| `assignedExpressionsMap` | Any access of a variable | SSA | Returns a map with, as key, each write access impacting the value of the variable, and as value, the expressions used by that assignment |
516-
| `transitiveAssignedExpressions` | An assignment node (the `variableDeclarator` of a write access) | SSA | Same as `#assignedExpressions` but the variables used in the assigned expressions are followed: the expressions assigned to them are added, recursively |
516+
| `transitiveAssignedExpressions` | An assignment node (the `variableDeclaration` of a write access) | SSA | Same as `#assignedExpressions` but the variables used in the assigned expressions are followed: the expressions assigned to them are added, recursively |
517517
| `transitiveAssignedExpressionsMap` | Any access of a variable | SSA | Same as `#assignedExpressionsMap` but each value is the transitive assigned expressions of the corresponding assignment |
518518

519519
## Examples of analysis
@@ -606,7 +606,7 @@ print(x)' withPlatformLineEndings.
606606
607607
lastVariableAccess := model module statements last arguments first.
608608
609-
lastVariableAccess ssaVersion writeAccesses collect: [ :access | access variableDeclarator ] "an OrderedCollection(PyAssignment(18 - 22) PyAssignment(36 - 40))"
609+
lastVariableAccess ssaVersion writeAccesses collect: [ :access | access variableDeclaration ] "an OrderedCollection(PyAssignment(18 - 22) PyAssignment(36 - 40))"
610610
```
611611

612612
The assignments nodes can be an assignment, a for, an augmented assignment or a for in clause.
@@ -644,7 +644,7 @@ It returns a dictionary with the possible write accesses as key and the expressi
644644

645645
> Note: you can find some warnings on this in the section [Querying local resolver information](#querying-local-resolver-information). They are the same.
646646
647-
> Note 2: You can use `#assignedExpressions` on the `variableDeclarator` of a specific write access to have information only on this one.
647+
> Note 2: You can use `#assignedExpressions` on the `variableDeclaration` of a specific write access to have information only on this one.
648648
649649
**What expressions are transitively used to do the assignment?**
650650

@@ -665,7 +665,7 @@ model module statements last arguments first transitiveAssignedExpressionsMap
665665

666666
The read of `y` is part of the result since `y` is itself assigned `1`.
667667

668-
> Note: `#transitiveAssignedExpressions` is the equivalent of `#assignedExpressions`: call it on the `variableDeclarator` of a specific write access to have the transitive expressions of only this one.
668+
> Note: `#transitiveAssignedExpressions` is the equivalent of `#assignedExpressions`: call it on the `variableDeclaration` of a specific write access to have the transitive expressions of only this one.
669669
670670
**How to know what nodes are variables?**
671671

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ FASTPyAttributeAccess >> value: anObject [
9797
]
9898

9999
{ #category : 'accessing' }
100-
FASTPyAttributeAccess >> variableDeclarator [
100+
FASTPyAttributeAccess >> variableDeclaration [
101101
"In the case I represent a write access to a variable, I return the node representing my assignment."
102102

103103
"If I am a variable defined in tuples, I should return the node initializing this tuple. Can be recursive (tuple in tuple)"
104104

105105
self selfOrTopmostAssignableCollection parentAssignmentLeft ifNotNil: [ :assignment | ^ assignment ].
106106

107-
^ super variableDeclarator
107+
^ super variableDeclaration
108108
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ FASTPyEntity >> shadowing: aFASTEntity [
307307
]
308308

309309
{ #category : 'accessing' }
310-
FASTPyEntity >> variableDeclarator [
310+
FASTPyEntity >> variableDeclaration [
311311
"In case I am a write access to a variable, I return the node categorized as my declaration. Else I return nil.
312312
Nodes representing potential variable write access should override me.
313313

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ FASTPyIdentifier >> isIdentifier [
5858
]
5959

6060
{ #category : 'accessing' }
61-
FASTPyIdentifier >> variableDeclarator [
61+
FASTPyIdentifier >> variableDeclaration [
6262
"In the case I represent a write access to a variable, I return the node representing my assignment."
6363

6464
| assignedNode |
@@ -71,5 +71,5 @@ FASTPyIdentifier >> variableDeclarator [
7171

7272
assignedNode parentForInClauseLeft ifNotNil: [ :clause | ^ clause ].
7373

74-
^ super variableDeclarator
74+
^ super variableDeclaration
7575
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ FASTPyParameter >> type: anObject [
9595
]
9696

9797
{ #category : 'accessing' }
98-
FASTPyParameter >> variableDeclarator [
98+
FASTPyParameter >> variableDeclaration [
9999
"For parameters, they are their own declarator."
100100

101101
^ self

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ FASTPySubscript >> value: anObject [
103103
]
104104

105105
{ #category : 'accessing' }
106-
FASTPySubscript >> variableDeclarator [
106+
FASTPySubscript >> variableDeclaration [
107107
"In the case I represent a write access to a variable, I return the node representing my assignment."
108108

109109
"If I am a variable defined in tuples, I should return the node initializing this tuple. Can be recursive (tuple in tuple)"
110110

111111
self selfOrTopmostAssignableCollection parentAssignmentLeft ifNotNil: [ :assignment | ^ assignment ].
112112

113-
^ super variableDeclarator
113+
^ super variableDeclaration
114114
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ FASTPyWalrus >> value: anObject [
6363
]
6464

6565
{ #category : 'accessing' }
66-
FASTPyWalrus >> variableDeclarator [
66+
FASTPyWalrus >> variableDeclaration [
6767

6868
^ self
6969
]

0 commit comments

Comments
 (0)