@@ -76,7 +76,10 @@ const nodeMatchers: Partial<
76
76
statement : STATEMENT_TYPES ,
77
77
string : "string" ,
78
78
collectionItem : matcher ( importNodeFinder ( ) , argumentSelectionExtractor ( ) ) ,
79
- collectionKey : trailingMatcher ( [ "pair[key]" ] , [ ":" ] ) ,
79
+ collectionKey : cascadingMatcher (
80
+ trailingMatcher ( [ "pair[key]" ] , [ ":" ] ) ,
81
+ patternMatcher ( "match_statement[alternative][pattern]" )
82
+ ) ,
80
83
ifStatement : "if_statement" ,
81
84
anonymousFunction : "lambda?.lambda" ,
82
85
functionCall : "call" ,
@@ -86,7 +89,10 @@ const nodeMatchers: Partial<
86
89
className : "class_definition[name]" ,
87
90
namedFunction : "decorated_definition?.function_definition" ,
88
91
functionName : "function_definition[name]" ,
89
- condition : conditionMatcher ( "*[condition]" ) ,
92
+ condition : cascadingMatcher (
93
+ conditionMatcher ( "*[condition]" ) ,
94
+ patternMatcher ( "match_statement[alternative][pattern]" )
95
+ ) ,
90
96
type : leadingMatcher (
91
97
[ "function_definition[return_type]" , "*[type]" ] ,
92
98
[ ":" , "->" ]
@@ -97,6 +103,7 @@ const nodeMatchers: Partial<
97
103
"typed_parameter.identifier!" ,
98
104
"parameters.identifier!" ,
99
105
"*[name]" ,
106
+ "match_statement[alternative][pattern]" ,
100
107
] ,
101
108
value : cascadingMatcher (
102
109
leadingMatcher (
@@ -118,12 +125,15 @@ const nodeMatchers: Partial<
118
125
">>=" ,
119
126
]
120
127
) ,
121
- patternMatcher ( "return_statement.~return!" )
128
+ patternMatcher ( "return_statement.~return!" ) ,
129
+ patternMatcher ( "match_statement[alternative][consequence]" )
122
130
) ,
123
131
argumentOrParameter : cascadingMatcher (
124
132
argumentMatcher ( "parameters" , "argument_list" ) ,
125
133
matcher ( patternFinder ( "call.generator_expression!" ) , childRangeSelector ( ) )
126
134
) ,
135
+ subject : "match_statement[subject]" ,
136
+ branch : "match_statement[alternative]" ,
127
137
} ;
128
138
129
139
export default createPatternMatchers ( nodeMatchers ) ;
0 commit comments