File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
swift/ql/lib/codeql/swift/dataflow/internal Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,13 @@ private module Cached {
119119 def .( Ssa:: WriteDefinition ) .assigns ( nodeFrom .getCfgNode ( ) ) and
120120 nodeTo .asDefinition ( ) = def
121121 or
122+ // flow through optional binding `if let`, similarly to assignment
123+ exists ( ConditionElement ce |
124+ ce .getInitializer ( ) = nodeFrom .asExpr ( ) and
125+ ce .getPattern ( ) = def .getSourceVariable ( ) .getParentPattern ( ) and
126+ nodeTo .asDefinition ( ) = def
127+ )
128+ or
122129 // step from def to first read
123130 nodeFrom .asDefinition ( ) = def and
124131 nodeTo .getCfgNode ( ) = def .getAFirstRead ( ) and
@@ -153,13 +160,6 @@ private module Cached {
153160 or
154161 nodeFrom .asExpr ( ) = nodeTo .asExpr ( ) .( OptionalEvaluationExpr ) .getSubExpr ( )
155162 or
156- // flow through optional binding `if let`
157- exists ( ConditionElement ce , ConcreteVarDecl v |
158- ce .getInitializer ( ) = nodeFrom .asExpr ( ) and
159- ce .getPattern ( ) = v .getParentPattern ( ) and
160- nodeTo .asDefinition ( ) .getSourceVariable ( ) = v
161- )
162- or
163163 // flow through nil-coalescing operator `??`
164164 exists ( BinaryExpr nco |
165165 nco .getOperator ( ) .( FreeFunctionDecl ) .getName ( ) = "??(_:_:)" and
You can’t perform that action at this time.
0 commit comments