mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
Python: Cleanup "first" type-tracking predicate to be private
Since it's exposed nicely in the version that doesn't have a `DataFlow::TypeTracker` parameter, these should be private. Also found one instance where I had accidentially used DataFlow::Node instead of LocalSourceNode
This commit is contained in:
@@ -2,7 +2,7 @@ import python
|
||||
import semmle.python.dataflow.new.DataFlow
|
||||
import semmle.python.dataflow.new.TypeTracker
|
||||
|
||||
DataFlow::LocalSourceNode module_tracker(TypeTracker t) {
|
||||
private DataFlow::LocalSourceNode module_tracker(TypeTracker t) {
|
||||
t.start() and
|
||||
result = DataFlow::importNode("module")
|
||||
or
|
||||
@@ -13,7 +13,7 @@ query DataFlow::Node module_tracker() {
|
||||
module_tracker(DataFlow::TypeTracker::end()).flowsTo(result)
|
||||
}
|
||||
|
||||
DataFlow::LocalSourceNode module_attr_tracker(TypeTracker t) {
|
||||
private DataFlow::LocalSourceNode module_attr_tracker(TypeTracker t) {
|
||||
t.startInAttr("attr") and
|
||||
result = module_tracker()
|
||||
or
|
||||
|
||||
@@ -6,7 +6,7 @@ import TestUtilities.InlineExpectationsTest
|
||||
// -----------------------------------------------------------------------------
|
||||
// tracked
|
||||
// -----------------------------------------------------------------------------
|
||||
DataFlow::LocalSourceNode tracked(TypeTracker t) {
|
||||
private DataFlow::LocalSourceNode tracked(TypeTracker t) {
|
||||
t.start() and
|
||||
result.asCfgNode() = any(NameNode n | n.getId() = "tracked")
|
||||
or
|
||||
@@ -34,14 +34,14 @@ class TrackedTest extends InlineExpectationsTest {
|
||||
// -----------------------------------------------------------------------------
|
||||
// int + str
|
||||
// -----------------------------------------------------------------------------
|
||||
DataFlow::LocalSourceNode int_type(TypeTracker t) {
|
||||
private DataFlow::LocalSourceNode int_type(TypeTracker t) {
|
||||
t.start() and
|
||||
result.asCfgNode() = any(CallNode c | c.getFunction().(NameNode).getId() = "int")
|
||||
or
|
||||
exists(TypeTracker t2 | result = int_type(t2).track(t2, t))
|
||||
}
|
||||
|
||||
DataFlow::LocalSourceNode string_type(TypeTracker t) {
|
||||
private DataFlow::LocalSourceNode string_type(TypeTracker t) {
|
||||
t.start() and
|
||||
result.asCfgNode() = any(CallNode c | c.getFunction().(NameNode).getId() = "str")
|
||||
or
|
||||
@@ -83,7 +83,7 @@ class TrackedStringTest extends InlineExpectationsTest {
|
||||
// -----------------------------------------------------------------------------
|
||||
// tracked_self
|
||||
// -----------------------------------------------------------------------------
|
||||
DataFlow::LocalSourceNode tracked_self(TypeTracker t) {
|
||||
private DataFlow::LocalSourceNode tracked_self(TypeTracker t) {
|
||||
t.start() and
|
||||
exists(Function f |
|
||||
f.isMethod() and
|
||||
|
||||
Reference in New Issue
Block a user