@@ -321,6 +321,18 @@ private predicate hasChildPattern(ControlFlowElement pm, Expr child) {
321
321
mid instanceof @tuple_expr and
322
322
child = mid .getAChildExpr ( )
323
323
)
324
+ or
325
+ exists ( Expr mid |
326
+ hasChildPattern ( pm , mid ) and
327
+ mid instanceof @list_pattern_expr and
328
+ child = mid .getAChildExpr ( )
329
+ )
330
+ or
331
+ exists ( Expr mid |
332
+ hasChildPattern ( pm , mid ) and
333
+ mid instanceof @slice_pattern_expr and
334
+ child = mid .getAChildExpr ( )
335
+ )
324
336
}
325
337
326
338
/**
@@ -506,6 +518,26 @@ class PositionalPatternExpr extends PatternExpr, @positional_pattern_expr {
506
518
override string getAPrimaryQlClass ( ) { result = "PositionalPatternExpr" }
507
519
}
508
520
521
+ /** A list pattern. For example `[1, 2, int y]` in `x is [1, 2, int y]`. */
522
+ class ListPatternExpr extends PatternExpr , @list_pattern_expr {
523
+ override string toString ( ) { result = "[ ... ]" }
524
+
525
+ /** Gets the `n`th pattern. */
526
+ PatternExpr getPattern ( int n ) { result = this .getChild ( n ) }
527
+
528
+ override string getAPrimaryQlClass ( ) { result = "ListPatternExpr" }
529
+ }
530
+
531
+ /** A slice pattern. For example `..` in `x is [1, .., 2]. */
532
+ class SlicePatternExpr extends PatternExpr , @slice_pattern_expr {
533
+ override string toString ( ) { result = ".." }
534
+
535
+ /** Gets the subpattern, if any. */
536
+ PatternExpr getPattern ( ) { result = this .getChild ( 0 ) }
537
+
538
+ override string getAPrimaryQlClass ( ) { result = "SlicePatternExpr" }
539
+ }
540
+
509
541
/** A unary pattern. For example, `not 1`. */
510
542
class UnaryPatternExpr extends PatternExpr , @unary_pattern_expr {
511
543
/** Gets the underlying pattern. */
0 commit comments