File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
csharp/ql/lib/semmle/code/csharp Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,9 @@ module AssignableInternal {
286
286
/** Holds if the local variable definition is at the top level of the pattern. */
287
287
predicate isTopLevel ( ) { this = pm .getPattern ( ) .( BindingPatternExpr ) .getVariableDeclExpr ( ) }
288
288
289
+ /** Holds of this local variable definition is a part of a tuple pattern. */
290
+ predicate isInTuple ( ) { this .getParent ( ) instanceof TuplePatternExpr }
291
+
289
292
/** Gets the pattern match that this local variable declaration (pattern) belongs to. */
290
293
PatternMatch getMatch ( ) { result = pm }
291
294
}
@@ -720,12 +723,15 @@ module AssignableDefinitions {
720
723
/** Gets the underlying local variable declaration. */
721
724
LocalVariableDeclExpr getDeclaration ( ) { result = lvpd }
722
725
723
- override Expr getSource ( ) { this . isTopLevel ( ) and result = this .getMatch ( ) .getExpr ( ) }
726
+ override Expr getSource ( ) { result = this .getMatch ( ) .getExpr ( ) }
724
727
725
728
override string toString ( ) { result = this .getDeclaration ( ) .toString ( ) }
726
729
727
730
/** Holds if the local variable definition is at the top level of the pattern. */
728
731
predicate isTopLevel ( ) { lvpd .isTopLevel ( ) }
732
+
733
+ /** Holds of this local variable definition is a part of a tuple pattern. */
734
+ predicate isInTuple ( ) { lvpd .isInTuple ( ) }
729
735
}
730
736
731
737
/**
Original file line number Diff line number Diff line change @@ -640,7 +640,8 @@ module LocalFlow {
640
640
def .getSource ( ) = e and
641
641
(
642
642
scope = def .getExpr ( ) and
643
- isSuccessor = true
643
+ isSuccessor = true and
644
+ not def instanceof AssignableDefinitions:: PatternDefinition
644
645
or
645
646
exists ( AssignableDefinitions:: PatternDefinition def0 | def = def0 and def0 .isTopLevel ( ) |
646
647
scope = def0 .getMatch ( ) .( IsExpr ) and
@@ -663,7 +664,7 @@ module LocalFlow {
663
664
isSuccessor = false and
664
665
def =
665
666
any ( AssignableDefinitions:: PatternDefinition apd |
666
- e = apd .getDeclaration ( ) and not apd .isTopLevel ( )
667
+ e = apd .getDeclaration ( ) and not apd .isTopLevel ( ) and not apd . isInTuple ( )
667
668
)
668
669
}
669
670
}
You can’t perform that action at this time.
0 commit comments