mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
cached stages iteration 5
This commit is contained in:
@@ -619,7 +619,9 @@ class UnaryExprNode extends ControlFlowNode {
|
||||
* and nodes implicitly assigned in class and function definitions and imports.
|
||||
*/
|
||||
class DefinitionNode extends ControlFlowNode {
|
||||
cached
|
||||
DefinitionNode() {
|
||||
Stages::SSA::ref() and
|
||||
exists(Assign a | a.getATarget().getAFlowNode() = this)
|
||||
or
|
||||
exists(AnnAssign a | a.getTarget().getAFlowNode() = this and exists(a.getValue()))
|
||||
@@ -678,6 +680,7 @@ abstract class SequenceNode extends ControlFlowNode {
|
||||
ControlFlowNode getAnElement() { result = this.getElement(_) }
|
||||
|
||||
/** Gets the control flow node for the nth element of this sequence */
|
||||
cached
|
||||
abstract ControlFlowNode getElement(int n);
|
||||
}
|
||||
|
||||
@@ -686,6 +689,7 @@ class TupleNode extends SequenceNode {
|
||||
TupleNode() { toAst(this) instanceof Tuple }
|
||||
|
||||
override ControlFlowNode getElement(int n) {
|
||||
Stages::SSA::ref() and
|
||||
exists(Tuple t | this.getNode() = t and result.getNode() = t.getElt(n)) and
|
||||
(
|
||||
result.getBasicBlock().dominates(this.getBasicBlock())
|
||||
|
||||
@@ -86,6 +86,10 @@ module Stages {
|
||||
any(PyFlow::BasicBlock b).dominates(_)
|
||||
or
|
||||
exists(any(PyFlow::ControlFlowNode b).getScope())
|
||||
or
|
||||
exists(PyFlow::DefinitionNode b)
|
||||
or
|
||||
exists(any(PyFlow::SequenceNode n).getElement(_))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user