@@ -640,31 +640,30 @@ module LocalFlow {
640640 def .getSource ( ) = e and
641641 (
642642 scope = def .getExpr ( ) and
643- isSuccessor = true
643+ isSuccessor = true and
644+ (
645+ not def instanceof AssignableDefinitions:: PatternDefinition or
646+ def instanceof AssignableDefinitions:: TopLevelPatternDefinition
647+ )
648+ or
649+ scope = def .( AssignableDefinitions:: TopLevelPatternDefinition ) .getMatch ( ) .( IsExpr ) and
650+ isSuccessor = false
644651 or
645- exists ( AssignableDefinitions:: PatternDefinition def0 | def = def0 and def0 .isTopLevel ( ) |
646- scope = def0 .getMatch ( ) .( IsExpr ) and
647- isSuccessor = false
652+ exists ( Switch s |
653+ s .getACase ( ) = def .( AssignableDefinitions:: TopLevelPatternDefinition ) .getMatch ( ) and
654+ isSuccessor = true
655+ |
656+ scope = s .getExpr ( )
648657 or
649- exists ( Switch s |
650- s .getACase ( ) = def0 .getMatch ( ) and
651- isSuccessor = true
652- |
653- scope = s .getExpr ( )
654- or
655- scope = s .getACase ( )
656- )
658+ scope = s .getACase ( )
657659 )
658660 )
659661 or
660662 // Needed for read steps for pattern matching involving properties.
661663 scope = def .getExpr ( ) and
662664 exactScope = false and
663665 isSuccessor = false and
664- def =
665- any ( AssignableDefinitions:: PatternDefinition apd |
666- e = apd .getDeclaration ( ) and not apd .isTopLevel ( )
667- )
666+ e = def .( AssignableDefinitions:: PropertyPatternDefinition ) .getDeclaration ( )
668667 }
669668 }
670669
@@ -2508,7 +2507,7 @@ private class ReadStepConfiguration extends ControlFlowReachabilityConfiguration
25082507 or
25092508 scope =
25102509 any ( TuplePatternExpr te |
2511- te .getAnArgument ( ) = defTo .( AssignableDefinitions:: PatternDefinition ) .getDeclaration ( ) and
2510+ te .getAnArgument ( ) = defTo .( AssignableDefinitions:: TuplePatternDefinition ) .getDeclaration ( ) and
25122511 e = te and
25132512 exactScope = false and
25142513 isSuccessor = false
@@ -2558,7 +2557,7 @@ private predicate readContentStep(Node node1, Content c, Node node2) {
25582557 or
25592558 // item = variable in node1 = (..., variable, ...) in a case/is var (..., ...)
25602559 te = any ( TuplePatternExpr pe ) .getAChildExpr * ( ) and
2561- exists ( AssignableDefinitions:: PatternDefinition lvd |
2560+ exists ( AssignableDefinitions:: TuplePatternDefinition lvd |
25622561 node2 .( AssignableDefinitionNode ) .getDefinition ( ) = lvd and
25632562 lvd .getDeclaration ( ) = item and
25642563 hasNodePath ( x , node1 , node2 )
@@ -2990,10 +2989,8 @@ class CastNode extends Node {
29902989 CastNode ( ) {
29912990 this .asExpr ( ) instanceof Cast
29922991 or
2993- this .( AssignableDefinitionNode )
2994- .getDefinition ( )
2995- .( AssignableDefinitions:: PatternDefinition )
2996- .isTopLevel ( )
2992+ this .( AssignableDefinitionNode ) .getDefinition ( ) instanceof
2993+ AssignableDefinitions:: TopLevelPatternDefinition
29972994 }
29982995}
29992996
0 commit comments