Python: Fix broken queries

This commit is contained in:
Taus
2025-12-05 13:48:28 +00:00
parent fd7b123ee3
commit 51ebec9164
3 changed files with 12 additions and 9 deletions

View File

@@ -3,8 +3,10 @@
import python
import semmle.python.dataflow.new.DataFlow
final class FinalAstNode = AstNode;
/** A looping construct. */
abstract class Loop extends AstNode {
abstract class Loop extends FinalAstNode {
/**
* Gets a loop variable of this loop.
* For example, `x` and `y` in `for x,y in pairs: print(x+y)`
@@ -13,9 +15,9 @@ abstract class Loop extends AstNode {
}
/** A `for` loop. */
private class ForLoop extends Loop, For {
private class ForLoop extends Loop instanceof For {
override Variable getALoopVariable() {
this.getTarget() = result.getAnAccess().getParentNode*() and
this.(For).getTarget() = result.getAnAccess().getParentNode*() and
result.getScope() = this.getScope()
}
}