File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
csharp/ql/lib/semmle/code/csharp/dataflow/internal Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -520,6 +520,16 @@ module SsaFlow {
520520
521521/** Provides predicates related to local data flow. */
522522module LocalFlow {
523+ /**
524+ * Holds if the pattern `e` is a top level variable pattern expression or
525+ * if the pattern doesn't contain any variable pattern expressions.
526+ */
527+ private predicate basicPattern ( PatternExpr e ) {
528+ e instanceof VariablePatternExpr
529+ or
530+ not exists ( VariablePatternExpr vpe | e .getAChild * ( ) = vpe )
531+ }
532+
523533 class LocalExprStepConfiguration extends ControlFlowReachabilityConfiguration {
524534 LocalExprStepConfiguration ( ) { this = "LocalExprStepConfiguration" }
525535
@@ -615,14 +625,16 @@ module LocalFlow {
615625 scope =
616626 any ( IsExpr ie |
617627 e1 = ie .getExpr ( ) and
618- e2 = ie .getPattern ( )
628+ e2 = ie .getPattern ( ) and
629+ not basicPattern ( e2 )
619630 )
620631 or
621632 isSuccessor = true and
622633 scope =
623634 any ( Switch e |
624635 e1 = e .getExpr ( ) and
625- e2 = e .getACase ( ) .getPattern ( )
636+ e2 = e .getACase ( ) .getPattern ( ) and
637+ not basicPattern ( e2 )
626638 )
627639 or
628640 isSuccessor = false and
You can’t perform that action at this time.
0 commit comments