diff --git a/python/ql/src/semmle/python/dataflow/new/internal/DataFlowPrivate.qll b/python/ql/src/semmle/python/dataflow/new/internal/DataFlowPrivate.qll index c74ecc09f3f..e1fdd785762 100644 --- a/python/ql/src/semmle/python/dataflow/new/internal/DataFlowPrivate.qll +++ b/python/ql/src/semmle/python/dataflow/new/internal/DataFlowPrivate.qll @@ -132,7 +132,7 @@ module EssaFlow { // nodeTo = `TIterableSequence([a, b])` exists(UnpackingAssignmentDirectTarget target | nodeFrom.asExpr() = target.getValue() and - nodeTo = TIterableSequence(target) + nodeTo = TIterableSequenceNode(target) ) or // With definition @@ -435,7 +435,7 @@ module ArgumentPassing { // argument unpacked from dict exists(string name | call_unpacks(call, mapping, callable, name, paramN) and - result = TKwUnpacked(call, callable, name) + result = TKwUnpackedNode(call, callable, name) ) ) } @@ -1186,7 +1186,7 @@ module UnpackingAssignment { /** Step 2 */ predicate unpackingAssignmentFlowStep(Node nodeFrom, Node nodeTo) { exists(UnpackingAssignmentSequenceTarget target | - nodeFrom = TIterableSequence(target) and + nodeFrom = TIterableSequenceNode(target) and nodeTo.asCfgNode() = target ) } @@ -1194,8 +1194,8 @@ module UnpackingAssignment { /** Step 3 */ predicate unpackingAssignmentConvertingReadStep(Node nodeFrom, Content c, Node nodeTo) { exists(UnpackingAssignmentSequenceTarget target | - nodeFrom = TIterableSequence(target) and - nodeTo = TIterableElement(target) and + nodeFrom = TIterableSequenceNode(target) and + nodeTo = TIterableElementNode(target) and ( c instanceof ListElementContent or @@ -1215,7 +1215,7 @@ module UnpackingAssignment { /** Step 4 */ predicate unpackingAssignmentConvertingStoreStep(Node nodeFrom, Content c, Node nodeTo) { exists(UnpackingAssignmentSequenceTarget target | - nodeFrom = TIterableElement(target) and + nodeFrom = TIterableElementNode(target) and nodeTo.asCfgNode() = target and ( target instanceof ListNode and @@ -1249,13 +1249,13 @@ module UnpackingAssignment { if element instanceof SequenceNode then // Step 5b - nodeTo = TIterableSequence(element) and + nodeTo = TIterableSequenceNode(element) and precise = true else if element.getNode() instanceof Starred then // Step 5c - nodeTo = TIterableElement(element) and + nodeTo = TIterableElementNode(element) and precise = false else ( // Step 5a @@ -1269,7 +1269,7 @@ module UnpackingAssignment { /** Step 6 */ predicate unpackingAssignmentStarredElementStoreStep(Node nodeFrom, Content c, Node nodeTo) { exists(ControlFlowNode starred | starred.getNode() instanceof Starred | - nodeFrom = TIterableElement(starred) and + nodeFrom = TIterableElementNode(starred) and nodeTo.asVar().getDefinition().(MultiAssignmentDefinition).getDefiningNode() = starred and c instanceof ListElementContent ) @@ -1378,7 +1378,7 @@ predicate attributeReadStep(CfgNode nodeFrom, AttributeContent c, CfgNode nodeTo predicate kwUnpackReadStep(CfgNode nodeFrom, DictionaryElementContent c, Node nodeTo) { exists(CallNode call, CallableValue callable, string name | nodeFrom.asCfgNode() = call.getNode().getKwargs().getAFlowNode() and - nodeTo = TKwUnpacked(call, callable, name) and + nodeTo = TKwUnpackedNode(call, callable, name) and name = c.getKey() ) } diff --git a/python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll b/python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll index ad7112f4a7d..945c85b3170 100644 --- a/python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll +++ b/python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll @@ -58,18 +58,18 @@ newtype TNode = * That is, `call` contains argument `**{"foo": bar}` which is passed * to parameter `foo` of `callable`. */ - TKwUnpacked(CallNode call, CallableValue callable, string name) { + TKwUnpackedNode(CallNode call, CallableValue callable, string name) { call_unpacks(call, _, callable, name, _) } or /** * A synthetic node representing that an iterable sequence flows to consumer. */ - TIterableSequence(UnpackingAssignmentSequenceTarget consumer) or + TIterableSequenceNode(UnpackingAssignmentSequenceTarget consumer) or /** * A synthetic node representing that there may be an iterable element * for `consumer` to consume. */ - TIterableElement(UnpackingAssignmentTarget consumer) + TIterableElementNode(UnpackingAssignmentTarget consumer) /** Helper for `Node::getEnclosingCallable`. */ private DataFlowCallable getCallableScope(Scope s) { @@ -331,11 +331,11 @@ class KwOverflowNode extends Node, TKwOverflowNode { * The node representing the synthetic argument of a call that is unpacked from a dictionary * argument. */ -class KwUnpacked extends Node, TKwUnpacked { +class KwUnpackedNode extends Node, TKwUnpackedNode { CallNode call; string name; - KwUnpacked() { this = TKwUnpacked(call, _, name) } + KwUnpackedNode() { this = TKwUnpackedNode(call, _, name) } override string toString() { result = "KwUnpacked " + name } @@ -356,10 +356,10 @@ class KwUnpacked extends Node, TKwUnpacked { * read step then targets TIterableSequence, and the conversion can happen via a read * step to TIterableElement followed by a store step to the target. */ -class IterableSequence extends Node, TIterableSequence { +class IterableSequenceNode extends Node, TIterableSequenceNode { SequenceNode consumer; - IterableSequence() { this = TIterableSequence(consumer) } + IterableSequenceNode() { this = TIterableSequenceNode(consumer) } override string toString() { result = "IterableSequence" } @@ -375,10 +375,10 @@ class IterableSequence extends Node, TIterableSequence { * for instance from a `ListElement` to a `TupleElement`. This would happen via a * read step from the list to IterableElement followed by a store step to the tuple. */ -class IterableElement extends Node, TIterableElement { +class IterableElementNode extends Node, TIterableElementNode { ControlFlowNode consumer; - IterableElement() { this = TIterableElement(consumer) } + IterableElementNode() { this = TIterableElementNode(consumer) } override string toString() { result = "IterableElement" }