Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 19918e2

Browse files
committed
Python: Have Node-postfix consistently
1 parent 7a5d553 commit 19918e2

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ module EssaFlow {
132132
// nodeTo = `TIterableSequence([a, b])`
133133
exists(UnpackingAssignmentDirectTarget target |
134134
nodeFrom.asExpr() = target.getValue() and
135-
nodeTo = TIterableSequence(target)
135+
nodeTo = TIterableSequenceNode(target)
136136
)
137137
or
138138
// With definition
@@ -435,7 +435,7 @@ module ArgumentPassing {
435435
// argument unpacked from dict
436436
exists(string name |
437437
call_unpacks(call, mapping, callable, name, paramN) and
438-
result = TKwUnpacked(call, callable, name)
438+
result = TKwUnpackedNode(call, callable, name)
439439
)
440440
)
441441
}
@@ -1186,16 +1186,16 @@ module UnpackingAssignment {
11861186
/** Step 2 */
11871187
predicate unpackingAssignmentFlowStep(Node nodeFrom, Node nodeTo) {
11881188
exists(UnpackingAssignmentSequenceTarget target |
1189-
nodeFrom = TIterableSequence(target) and
1189+
nodeFrom = TIterableSequenceNode(target) and
11901190
nodeTo.asCfgNode() = target
11911191
)
11921192
}
11931193

11941194
/** Step 3 */
11951195
predicate unpackingAssignmentConvertingReadStep(Node nodeFrom, Content c, Node nodeTo) {
11961196
exists(UnpackingAssignmentSequenceTarget target |
1197-
nodeFrom = TIterableSequence(target) and
1198-
nodeTo = TIterableElement(target) and
1197+
nodeFrom = TIterableSequenceNode(target) and
1198+
nodeTo = TIterableElementNode(target) and
11991199
(
12001200
c instanceof ListElementContent
12011201
or
@@ -1215,7 +1215,7 @@ module UnpackingAssignment {
12151215
/** Step 4 */
12161216
predicate unpackingAssignmentConvertingStoreStep(Node nodeFrom, Content c, Node nodeTo) {
12171217
exists(UnpackingAssignmentSequenceTarget target |
1218-
nodeFrom = TIterableElement(target) and
1218+
nodeFrom = TIterableElementNode(target) and
12191219
nodeTo.asCfgNode() = target and
12201220
(
12211221
target instanceof ListNode and
@@ -1249,13 +1249,13 @@ module UnpackingAssignment {
12491249
if element instanceof SequenceNode
12501250
then
12511251
// Step 5b
1252-
nodeTo = TIterableSequence(element) and
1252+
nodeTo = TIterableSequenceNode(element) and
12531253
precise = true
12541254
else
12551255
if element.getNode() instanceof Starred
12561256
then
12571257
// Step 5c
1258-
nodeTo = TIterableElement(element) and
1258+
nodeTo = TIterableElementNode(element) and
12591259
precise = false
12601260
else (
12611261
// Step 5a
@@ -1269,7 +1269,7 @@ module UnpackingAssignment {
12691269
/** Step 6 */
12701270
predicate unpackingAssignmentStarredElementStoreStep(Node nodeFrom, Content c, Node nodeTo) {
12711271
exists(ControlFlowNode starred | starred.getNode() instanceof Starred |
1272-
nodeFrom = TIterableElement(starred) and
1272+
nodeFrom = TIterableElementNode(starred) and
12731273
nodeTo.asVar().getDefinition().(MultiAssignmentDefinition).getDefiningNode() = starred and
12741274
c instanceof ListElementContent
12751275
)
@@ -1378,7 +1378,7 @@ predicate attributeReadStep(CfgNode nodeFrom, AttributeContent c, CfgNode nodeTo
13781378
predicate kwUnpackReadStep(CfgNode nodeFrom, DictionaryElementContent c, Node nodeTo) {
13791379
exists(CallNode call, CallableValue callable, string name |
13801380
nodeFrom.asCfgNode() = call.getNode().getKwargs().getAFlowNode() and
1381-
nodeTo = TKwUnpacked(call, callable, name) and
1381+
nodeTo = TKwUnpackedNode(call, callable, name) and
13821382
name = c.getKey()
13831383
)
13841384
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ newtype TNode =
5858
* That is, `call` contains argument `**{"foo": bar}` which is passed
5959
* to parameter `foo` of `callable`.
6060
*/
61-
TKwUnpacked(CallNode call, CallableValue callable, string name) {
61+
TKwUnpackedNode(CallNode call, CallableValue callable, string name) {
6262
call_unpacks(call, _, callable, name, _)
6363
} or
6464
/**
6565
* A synthetic node representing that an iterable sequence flows to consumer.
6666
*/
67-
TIterableSequence(UnpackingAssignmentSequenceTarget consumer) or
67+
TIterableSequenceNode(UnpackingAssignmentSequenceTarget consumer) or
6868
/**
6969
* A synthetic node representing that there may be an iterable element
7070
* for `consumer` to consume.
7171
*/
72-
TIterableElement(UnpackingAssignmentTarget consumer)
72+
TIterableElementNode(UnpackingAssignmentTarget consumer)
7373

7474
/** Helper for `Node::getEnclosingCallable`. */
7575
private DataFlowCallable getCallableScope(Scope s) {
@@ -331,11 +331,11 @@ class KwOverflowNode extends Node, TKwOverflowNode {
331331
* The node representing the synthetic argument of a call that is unpacked from a dictionary
332332
* argument.
333333
*/
334-
class KwUnpacked extends Node, TKwUnpacked {
334+
class KwUnpackedNode extends Node, TKwUnpackedNode {
335335
CallNode call;
336336
string name;
337337

338-
KwUnpacked() { this = TKwUnpacked(call, _, name) }
338+
KwUnpackedNode() { this = TKwUnpackedNode(call, _, name) }
339339

340340
override string toString() { result = "KwUnpacked " + name }
341341

@@ -356,10 +356,10 @@ class KwUnpacked extends Node, TKwUnpacked {
356356
* read step then targets TIterableSequence, and the conversion can happen via a read
357357
* step to TIterableElement followed by a store step to the target.
358358
*/
359-
class IterableSequence extends Node, TIterableSequence {
359+
class IterableSequenceNode extends Node, TIterableSequenceNode {
360360
SequenceNode consumer;
361361

362-
IterableSequence() { this = TIterableSequence(consumer) }
362+
IterableSequenceNode() { this = TIterableSequenceNode(consumer) }
363363

364364
override string toString() { result = "IterableSequence" }
365365

@@ -375,10 +375,10 @@ class IterableSequence extends Node, TIterableSequence {
375375
* for instance from a `ListElement` to a `TupleElement`. This would happen via a
376376
* read step from the list to IterableElement followed by a store step to the tuple.
377377
*/
378-
class IterableElement extends Node, TIterableElement {
378+
class IterableElementNode extends Node, TIterableElementNode {
379379
ControlFlowNode consumer;
380380

381-
IterableElement() { this = TIterableElement(consumer) }
381+
IterableElementNode() { this = TIterableElementNode(consumer) }
382382

383383
override string toString() { result = "IterableElement" }
384384

0 commit comments

Comments
 (0)