File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
python/ql/lib/semmle/python Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -672,6 +672,8 @@ class DefinitionNode extends ControlFlowNode {
672
672
exists ( For for | for .getTarget ( ) .getAFlowNode ( ) = this )
673
673
or
674
674
exists ( Parameter param | this = param .asName ( ) .getAFlowNode ( ) and exists ( param .getDefault ( ) ) )
675
+ or
676
+ exists ( With with | this = with .getOptionalVars ( ) .getAFlowNode ( ) )
675
677
}
676
678
677
679
/** flow node corresponding to the value assigned for the definition corresponding to this flow node */
@@ -840,7 +842,11 @@ private AstNode assigned_value(Expr lhs) {
840
842
/* for lhs in seq: => `result` is the `for` node, representing the `iter(next(seq))` operation. */
841
843
result .( For ) .getTarget ( ) = lhs
842
844
or
845
+ // def f(a = 42): => `result` is 42
843
846
exists ( Parameter param | lhs = param .asName ( ) and result = param .getDefault ( ) )
847
+ or
848
+ // with f(42) as x: => `result` is `f(42)`
849
+ exists ( With with | lhs = with .getOptionalVars ( ) and result = with .getContextExpr ( ) )
844
850
}
845
851
846
852
predicate nested_sequence_assign (
You can’t perform that action at this time.
0 commit comments