File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
test/query-tests/Variables/undefined Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -653,6 +653,8 @@ class DefinitionNode extends ControlFlowNode {
653653 DefinitionNode ( ) {
654654 exists ( Assign a | a .getATarget ( ) .getAFlowNode ( ) = this )
655655 or
656+ exists ( AnnAssign a | a .getTarget ( ) .getAFlowNode ( ) = this and exists ( a .getValue ( ) ) )
657+ or
656658 exists ( Alias a | a .getAsname ( ) .getAFlowNode ( ) = this )
657659 or
658660 augstore ( _, this )
@@ -795,6 +797,9 @@ private AstNode assigned_value(Expr lhs) {
795797 /* lhs = result */
796798 exists ( Assign a | a .getATarget ( ) = lhs and result = a .getValue ( ) )
797799 or
800+ /* lhs : annotation = result */
801+ exists ( AnnAssign a | a .getTarget ( ) = lhs and result = a .getValue ( ) )
802+ or
798803 /* import result as lhs */
799804 exists ( Alias a | a .getAsname ( ) = lhs and result = a .getValue ( ) )
800805 or
Original file line number Diff line number Diff line change 1111| UninitializedLocal.py:163:7:163:7 | x | Local variable 'x' may be used before it is initialized. |
1212| UninitializedLocal.py:176:16:176:16 | x | Local variable 'x' may be used before it is initialized. |
1313| UninitializedLocal.py:178:16:178:16 | y | Local variable 'y' may be used before it is initialized. |
14- | UninitializedLocal.py:294:14:294:22 | annotated | Local variable 'annotated' may be used before it is initialized. |
1514| odasa3987.py:11:8:11:10 | var | Local variable 'var' may be used before it is initialized. |
You can’t perform that action at this time.
0 commit comments