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 {
119
119
def .( Ssa:: WriteDefinition ) .assigns ( nodeFrom .getCfgNode ( ) ) and
120
120
nodeTo .asDefinition ( ) = def
121
121
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
122
129
// step from def to first read
123
130
nodeFrom .asDefinition ( ) = def and
124
131
nodeTo .getCfgNode ( ) = def .getAFirstRead ( ) and
@@ -153,13 +160,6 @@ private module Cached {
153
160
or
154
161
nodeFrom .asExpr ( ) = nodeTo .asExpr ( ) .( OptionalEvaluationExpr ) .getSubExpr ( )
155
162
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
163
163
// flow through nil-coalescing operator `??`
164
164
exists ( BinaryExpr nco |
165
165
nco .getOperator ( ) .( FreeFunctionDecl ) .getName ( ) = "??(_:_:)" and
You can’t perform that action at this time.
0 commit comments