@@ -164,8 +164,8 @@ fn highlight_exit_points(
164
164
match anc {
165
165
ast:: Fn ( fn_) => hl( sema, fn_. body( ) . map( ast:: Expr :: BlockExpr ) ) ,
166
166
ast:: ClosureExpr ( closure) => hl( sema, closure. body( ) ) ,
167
- ast:: EffectExpr ( effect ) => if matches!( effect . effect ( ) , ast:: Effect :: Async ( _) | ast:: Effect :: Try ( _) | ast:: Effect :: Const ( _) ) {
168
- hl( sema, effect . block_expr ( ) . map ( ast :: Expr :: BlockExpr ) )
167
+ ast:: BlockExpr ( block_expr ) => if matches!( block_expr . modifier ( ) , Some ( ast:: BlockModifier :: Async ( _) | ast:: BlockModifier :: Try ( _) | ast:: BlockModifier :: Const ( _) ) ) {
168
+ hl( sema, Some ( block_expr . into ( ) ) )
169
169
} else {
170
170
continue ;
171
171
} ,
@@ -180,7 +180,7 @@ fn highlight_break_points(token: SyntaxToken) -> Option<Vec<HighlightedRange>> {
180
180
fn hl (
181
181
token : Option < SyntaxToken > ,
182
182
label : Option < ast:: Label > ,
183
- body : Option < ast:: BlockExpr > ,
183
+ body : Option < ast:: StmtList > ,
184
184
) -> Option < Vec < HighlightedRange > > {
185
185
let mut highlights = Vec :: new ( ) ;
186
186
let range = cover_range (
@@ -204,7 +204,7 @@ fn highlight_break_points(token: SyntaxToken) -> Option<Vec<HighlightedRange>> {
204
204
ast:: LoopExpr ( l) => l. label( ) . and_then( |it| it. lifetime( ) ) ,
205
205
ast:: ForExpr ( f) => f. label( ) . and_then( |it| it. lifetime( ) ) ,
206
206
ast:: WhileExpr ( w) => w. label( ) . and_then( |it| it. lifetime( ) ) ,
207
- ast:: EffectExpr ( b) => Some ( b. label( ) . and_then( |it| it. lifetime( ) ) ?) ,
207
+ ast:: BlockExpr ( b) => Some ( b. label( ) . and_then( |it| it. lifetime( ) ) ?) ,
208
208
_ => return None ,
209
209
}
210
210
} ;
@@ -218,16 +218,16 @@ fn highlight_break_points(token: SyntaxToken) -> Option<Vec<HighlightedRange>> {
218
218
for anc in token. ancestors ( ) . flat_map ( ast:: Expr :: cast) {
219
219
return match anc {
220
220
ast:: Expr :: LoopExpr ( l) if label_matches ( l. label ( ) ) => {
221
- hl ( l. loop_token ( ) , l. label ( ) , l. loop_body ( ) )
221
+ hl ( l. loop_token ( ) , l. label ( ) , l. loop_body ( ) . and_then ( |it| it . stmt_list ( ) ) )
222
222
}
223
223
ast:: Expr :: ForExpr ( f) if label_matches ( f. label ( ) ) => {
224
- hl ( f. for_token ( ) , f. label ( ) , f. loop_body ( ) )
224
+ hl ( f. for_token ( ) , f. label ( ) , f. loop_body ( ) . and_then ( |it| it . stmt_list ( ) ) )
225
225
}
226
226
ast:: Expr :: WhileExpr ( w) if label_matches ( w. label ( ) ) => {
227
- hl ( w. while_token ( ) , w. label ( ) , w. loop_body ( ) )
227
+ hl ( w. while_token ( ) , w. label ( ) , w. loop_body ( ) . and_then ( |it| it . stmt_list ( ) ) )
228
228
}
229
- ast:: Expr :: EffectExpr ( e) if e. label ( ) . is_some ( ) && label_matches ( e. label ( ) ) => {
230
- hl ( None , e. label ( ) , e. block_expr ( ) )
229
+ ast:: Expr :: BlockExpr ( e) if e. label ( ) . is_some ( ) && label_matches ( e. label ( ) ) => {
230
+ hl ( None , e. label ( ) , e. stmt_list ( ) )
231
231
}
232
232
_ => continue ,
233
233
} ;
@@ -258,7 +258,12 @@ fn highlight_yield_points(token: SyntaxToken) -> Option<Vec<HighlightedRange>> {
258
258
return match_ast ! {
259
259
match anc {
260
260
ast:: Fn ( fn_) => hl( fn_. async_token( ) , fn_. body( ) . map( ast:: Expr :: BlockExpr ) ) ,
261
- ast:: EffectExpr ( effect) => hl( effect. async_token( ) , effect. block_expr( ) . map( ast:: Expr :: BlockExpr ) ) ,
261
+ ast:: BlockExpr ( block_expr) => {
262
+ if block_expr. async_token( ) . is_none( ) {
263
+ continue ;
264
+ }
265
+ hl( block_expr. async_token( ) , Some ( block_expr. into( ) ) )
266
+ } ,
262
267
ast:: ClosureExpr ( closure) => hl( closure. async_token( ) , closure. body( ) ) ,
263
268
_ => continue ,
264
269
}
0 commit comments