mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
Python: subscript on local source nodes
and adjust comment on awaited
This commit is contained in:
@@ -101,6 +101,11 @@ class LocalSourceNode extends Node {
|
||||
*/
|
||||
Node getAnAwaited() { Cached::await(this, result) }
|
||||
|
||||
/**
|
||||
* Gets a subscript of this node.
|
||||
*/
|
||||
CfgNode getASubscript() { Cached::subscript(this, result) }
|
||||
|
||||
/**
|
||||
* Gets a call to the method `methodName` on this node.
|
||||
*
|
||||
@@ -233,7 +238,7 @@ private module Cached {
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `node` flows to the awaited value of `awaited`.
|
||||
* Holds if `node` flows to a value that, when awaited, results in `awaited`.
|
||||
*/
|
||||
cached
|
||||
predicate await(LocalSourceNode node, Node awaited) {
|
||||
@@ -242,4 +247,15 @@ private module Cached {
|
||||
awaited = awaited(awaitedValue)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `node` flows to a sequence of which `subscript` is a subscript.
|
||||
*/
|
||||
cached
|
||||
predicate subscript(LocalSourceNode node, CfgNode subscript) {
|
||||
exists(CfgNode seq, SubscriptNode subscriptNode | subscriptNode = subscript.getNode() |
|
||||
node.flowsTo(seq) and
|
||||
seq.getNode() = subscriptNode.getObject()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user