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

Skip to content

Commit fe0c5d8

Browse files
authored
python: make ArgumentNode publicly usable
- add `getCall`
1 parent b22de69 commit fe0c5d8

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ SourceParameterNode parameterNode(Parameter p) { result.getParameter() = p }
322322
abstract class ArgumentNode extends Node {
323323
/** Holds if this argument occurs at the given position in the given call. */
324324
abstract predicate argumentOf(DataFlowCall call, ArgumentPosition pos);
325+
326+
/** Gets the call in which this node is an argument, if any. */
327+
final DataFlowSourceCall getCall() { this.argumentOf(result, _) }
325328
}
326329

327330
/** A data flow node that represents a call argument. */
@@ -335,9 +338,6 @@ class ArgumentSourceNode extends ArgumentNode {
335338
predicate sourceArgumentOf(DataFlowSourceCall call, ArgumentPosition pos) {
336339
this = call.getArg(pos)
337340
}
338-
339-
/** Gets the call in which this node is an argument. */
340-
final DataFlowSourceCall getCall() { this.argumentOf(result, _) }
341341
}
342342

343343
/**

python/ql/test/experimental/dataflow/TestUtil/MaximalFlowTest.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MaximalFlowsConfig extends DataFlow::Configuration {
3535
override predicate isSink(DataFlow::Node node) {
3636
exists(node.getLocation().getFile().getRelativePath()) and
3737
not any(CallNode c).getArg(_) = node.asCfgNode() and
38-
not node instanceof DataFlow::ArgumentSourceNode and
38+
not node instanceof DataFlow::ArgumentNode and
3939
not node.asCfgNode().(NameNode).getId().matches("SINK%") and
4040
not exists(DataFlow::Node succ | DataFlow::localFlowStep(node, succ))
4141
}

python/ql/test/experimental/dataflow/TestUtil/RoutingTest.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class RoutingTest extends InlineExpectationsTest {
4343
}
4444

4545
pragma[inline]
46-
private string fromFunc(DataFlow::ArgumentSourceNode fromNode) {
46+
private string fromFunc(DataFlow::ArgumentNode fromNode) {
4747
result = fromNode.getCall().getNode().(CallNode).getFunction().getNode().(Name).getId()
4848
}
4949

python/ql/test/experimental/dataflow/callGraphConfig.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CallGraphConfig extends DataFlow::Configuration {
1111
override predicate isSource(DataFlow::Node node) {
1212
node instanceof DataFlowPrivate::ReturnNode
1313
or
14-
node instanceof DataFlow::ArgumentSourceNode
14+
node instanceof DataFlow::ArgumentNode
1515
}
1616

1717
override predicate isSink(DataFlow::Node node) {

python/ql/test/experimental/dataflow/coverage/classesCallGraph.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CallGraphConfig extends DataFlow::Configuration {
1111
node instanceof DataFlowPrivate::ReturnNode
1212
or
1313
// These sources should allow for the non-standard call syntax
14-
node instanceof DataFlow::ArgumentSourceNode
14+
node instanceof DataFlow::ArgumentNode
1515
}
1616

1717
override predicate isSink(DataFlow::Node node) {

0 commit comments

Comments
 (0)