mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
Merge pull request #17653 from yoff/python/typetracking-through-comprehensions
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* Type tracking, and hence the API graph, is now able to correctly trace trough comprehensions.
|
||||
@@ -843,6 +843,13 @@ module API {
|
||||
ref = pred.getSubscript(_) and
|
||||
ref.asCfgNode().isLoad()
|
||||
or
|
||||
// Subscript via comprehension
|
||||
lbl = Label::subscript() and
|
||||
exists(PY::Comp comp |
|
||||
pred.asExpr() = comp.getIterable() and
|
||||
ref.asExpr() = comp.getNthInnerLoop(0).getTarget()
|
||||
)
|
||||
or
|
||||
// Subclassing a node
|
||||
lbl = Label::subclass() and
|
||||
exists(PY::ClassExpr clsExpr, DataFlow::Node superclass | pred.flowsTo(superclass) |
|
||||
|
||||
@@ -304,7 +304,7 @@ module TypeTrackingInput implements Shared::TypeTrackingInput {
|
||||
var.hasDefiningNode(def)
|
||||
|
|
||||
nodeTo.(DataFlowPublic::ScopeEntryDefinitionNode).getDefinition() = e and
|
||||
nodeFrom.asCfgNode() = def.getValue() and
|
||||
nodeFrom.asCfgNode() = def and
|
||||
var.getScope().getScope*() = nodeFrom.getScope()
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user