@@ -10,8 +10,8 @@ use proc_macro2::{Span, TokenStream as TokenStream2, TokenTree as TokenTree2};
10
10
use quote:: { quote, ToTokens } ;
11
11
use syn:: {
12
12
fold:: { self , Fold } ,
13
- token, ArgCaptured , Error , Expr , ExprForLoop , ExprMacro , FnArg , FnDecl , Ident , Item , ItemFn ,
14
- Pat , PatIdent , ReturnType , TypeTuple ,
13
+ token, ArgCaptured , Error , Expr , ExprForLoop , ExprMacro , ExprYield , FnArg , FnDecl , Ident , Item ,
14
+ ItemFn , Pat , PatIdent , ReturnType , TypeTuple ,
15
15
} ;
16
16
17
17
#[ macro_use]
@@ -276,9 +276,6 @@ impl Expand {
276
276
} }
277
277
}
278
278
279
- /* TODO: If this is enabled, it can be used for `yield` instead of `stream_yield!`.
280
- Raw `yield` is simpler, but it may be preferable to distinguish it from `yield` called
281
- in other scopes.
282
279
/// Expands `yield expr` in `async_stream` scope.
283
280
fn expand_yield ( & self , expr : ExprYield ) -> ExprYield {
284
281
if self . 0 != Stream {
@@ -292,7 +289,6 @@ impl Expand {
292
289
} ;
293
290
ExprYield { attrs, yield_token, expr : Some ( Box :: new ( expr) ) }
294
291
}
295
- */
296
292
297
293
/// Expands a macro.
298
294
fn expand_macro ( & mut self , mut expr : ExprMacro ) -> Expr {
@@ -307,10 +303,6 @@ impl Expand {
307
303
} else {
308
304
unreachable ! ( )
309
305
}
310
- } else if self . 0 != Stream && expr. mac . path . is_ident ( "stream_yield" ) {
311
- // TODO: Should we remove real `stream_yield!` macro and replace `stream_yield!` call in
312
- // here? -- or should we use `yield` instead of ``?
313
- return outside_of_async_stream_error ! ( expr, "stream_yield!" ) ;
314
306
}
315
307
316
308
Expr :: Macro ( expr)
@@ -360,7 +352,7 @@ impl Fold for Expand {
360
352
361
353
let expr = match fold:: fold_expr ( self , expr) {
362
354
Expr :: ForLoop ( expr) => self . expand_for_await ( expr) ,
363
- // Expr::Yield(expr) => Expr::Yield(self.expand_yield(expr)),
355
+ Expr :: Yield ( expr) => Expr :: Yield ( self . expand_yield ( expr) ) ,
364
356
Expr :: Macro ( expr) => self . expand_macro ( expr) ,
365
357
expr => expr,
366
358
} ;
0 commit comments