File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
Variables/LoopVariableCapture Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -471,11 +471,10 @@ Definition getUniqueDefinition(Expr use) {
471471 not result = TLocalDefinition ( use )
472472}
473473
474- /** A helper class to get suitable locations for attributes */
475- class NiceLocationExpr extends Expr {
476- /** Gets a textual representation of this element. */
477- override string toString ( ) { result = this .( Expr ) .toString ( ) }
474+ final class FinalExpr = Expr ;
478475
476+ /** A helper class to get suitable locations for attributes */
477+ class NiceLocationExpr extends FinalExpr {
479478 /**
480479 * Holds if this element is at the specified location.
481480 * The location spans column `bc` of line `bl` to
Original file line number Diff line number Diff line change 33import python
44import semmle.python.dataflow.new.DataFlow
55
6+ final class FinalAstNode = AstNode ;
7+
68/** A looping construct. */
7- abstract class Loop extends AstNode {
9+ abstract class Loop extends FinalAstNode {
810 /**
911 * Gets a loop variable of this loop.
1012 * For example, `x` and `y` in `for x,y in pairs: print(x+y)`
@@ -13,9 +15,9 @@ abstract class Loop extends AstNode {
1315}
1416
1517/** A `for` loop. */
16- private class ForLoop extends Loop , For {
18+ private class ForLoop extends Loop instanceof For {
1719 override Variable getALoopVariable ( ) {
18- this .getTarget ( ) = result .getAnAccess ( ) .getParentNode * ( ) and
20+ this .( For ) . getTarget ( ) = result .getAnAccess ( ) .getParentNode * ( ) and
1921 result .getScope ( ) = this .getScope ( )
2022 }
2123}
Original file line number Diff line number Diff line change @@ -59,7 +59,9 @@ predicate ok_to_fail(ImportExpr ie) {
5959 os_specific_import ( ie ) != get_os ( )
6060}
6161
62- class VersionTest extends ControlFlowNode {
62+ final class FinalControlFlowNode = ControlFlowNode ;
63+
64+ class VersionTest extends FinalControlFlowNode {
6365 VersionTest ( ) {
6466 exists ( string name |
6567 name .matches ( "%version%" ) and
@@ -70,7 +72,7 @@ class VersionTest extends ControlFlowNode {
7072 )
7173 }
7274
73- override string toString ( ) { result = "VersionTest" }
75+ string toString ( ) { result = "VersionTest" }
7476}
7577
7678/** A guard on the version of the Python interpreter */
You can’t perform that action at this time.
0 commit comments