@@ -640,31 +640,30 @@ module LocalFlow {
640
640
def .getSource ( ) = e and
641
641
(
642
642
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
644
651
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 ( )
648
657
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 ( )
657
659
)
658
660
)
659
661
or
660
662
// Needed for read steps for pattern matching involving properties.
661
663
scope = def .getExpr ( ) and
662
664
exactScope = false and
663
665
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 ( )
668
667
}
669
668
}
670
669
@@ -2508,7 +2507,7 @@ private class ReadStepConfiguration extends ControlFlowReachabilityConfiguration
2508
2507
or
2509
2508
scope =
2510
2509
any ( TuplePatternExpr te |
2511
- te .getAnArgument ( ) = defTo .( AssignableDefinitions:: PatternDefinition ) .getDeclaration ( ) and
2510
+ te .getAnArgument ( ) = defTo .( AssignableDefinitions:: TuplePatternDefinition ) .getDeclaration ( ) and
2512
2511
e = te and
2513
2512
exactScope = false and
2514
2513
isSuccessor = false
@@ -2558,7 +2557,7 @@ private predicate readContentStep(Node node1, Content c, Node node2) {
2558
2557
or
2559
2558
// item = variable in node1 = (..., variable, ...) in a case/is var (..., ...)
2560
2559
te = any ( TuplePatternExpr pe ) .getAChildExpr * ( ) and
2561
- exists ( AssignableDefinitions:: PatternDefinition lvd |
2560
+ exists ( AssignableDefinitions:: TuplePatternDefinition lvd |
2562
2561
node2 .( AssignableDefinitionNode ) .getDefinition ( ) = lvd and
2563
2562
lvd .getDeclaration ( ) = item and
2564
2563
hasNodePath ( x , node1 , node2 )
@@ -2990,10 +2989,8 @@ class CastNode extends Node {
2990
2989
CastNode ( ) {
2991
2990
this .asExpr ( ) instanceof Cast
2992
2991
or
2993
- this .( AssignableDefinitionNode )
2994
- .getDefinition ( )
2995
- .( AssignableDefinitions:: PatternDefinition )
2996
- .isTopLevel ( )
2992
+ this .( AssignableDefinitionNode ) .getDefinition ( ) instanceof
2993
+ AssignableDefinitions:: TopLevelPatternDefinition
2997
2994
}
2998
2995
}
2999
2996
0 commit comments