@@ -2221,10 +2221,26 @@ private predicate readStepPattern(Node node1, Content c, Node node2) {
22212221 c .( FieldContent ) .getField ( ) =
22222222 pattern .getType ( ) .( TupleType ) .getElement ( i ) .getUnboundDeclaration ( )
22232223 |
2224+ // item = { ... } in node1 = (var ..., { ... })
22242225 item = node2 .asExpr ( ) .( RecursivePatternExpr )
22252226 or
2227+ // item = (...,...) in node1 = (var ..., (..., ...))
22262228 item = node2 .asExpr ( ) .( TuplePatternExpr )
22272229 or
2230+ // item = variable in node1 = (..., variable, ...) in a case/is (var ..., var ...)
2231+ exists ( AssignableDefinitions:: PatternDefinition lvd |
2232+ node2 .( AssignableDefinitionNode ) .getDefinition ( ) = lvd and
2233+ item = lvd .getDeclaration ( )
2234+ )
2235+ )
2236+ or
2237+ // item = variable in node1 = (..., variable, ...) in a case/is var (..., ...)
2238+ exists ( TuplePatternExpr pattern , PatternExpr item , int i |
2239+ node1 .asExpr ( ) = pattern and
2240+ c .( FieldContent ) .getField ( ) =
2241+ pattern .getType ( ) .( TupleType ) .getElement ( i ) .getUnboundDeclaration ( ) and
2242+ item = pattern .getArgument ( i )
2243+ |
22282244 exists ( AssignableDefinitions:: PatternDefinition lvd |
22292245 node2 .( AssignableDefinitionNode ) .getDefinition ( ) = lvd and
22302246 item = lvd .getDeclaration ( )
@@ -2270,13 +2286,6 @@ private predicate readContentStep(Node node1, Content c, Node node2) {
22702286 node2 .( AssignableDefinitionNode ) .getDefinition ( ) = tad and
22712287 tad .getLeaf ( ) = item
22722288 )
2273- or
2274- // item = variable in node1 = (..., variable, ...) in a case/is var (..., ...)
2275- te instanceof TuplePatternExpr and
2276- exists ( AssignableDefinitions:: PatternDefinition lvd |
2277- node2 .( AssignableDefinitionNode ) .getDefinition ( ) = lvd and
2278- lvd .getDeclaration ( ) = item
2279- )
22802289 )
22812290 or
22822291 readStepPattern ( node1 , c , node2 )
0 commit comments