Skip to content

Commit 9137f04

Browse files
committed
Python: Add getPostUpdateNode to DataFlow::Node
as discussed in github#5864 (comment)
1 parent 0c970b5 commit 9137f04

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

python/ql/src/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module syntheticPreUpdateNode {
1919
SyntheticPreUpdateNode() { this = TSyntheticPreUpdateNode(post) }
2020

2121
/** Gets the node for which this is a synthetic pre-update node. */
22-
Node getPostUpdateNode() { result = post }
22+
override NeedsSyntheticPreUpdateNode getPostUpdateNode() { result = post }
2323

2424
override string toString() { result = "[pre " + post.label() + "] " + post.toString() }
2525

python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ class Node extends TNode {
123123
* Gets a local source node from which data may flow to this node in zero or more local data-flow steps.
124124
*/
125125
LocalSourceNode getALocalSource() { result.flowsTo(this) }
126+
127+
/** Gets the `PostUpdateNode` for this node, if any. */
128+
PostUpdateNode getPostUpdateNode() { result.getPreUpdateNode() = this }
126129
}
127130

128131
/** A data-flow node corresponding to an SSA variable. */

0 commit comments

Comments
 (0)