Merge Async and Gen into CoroutineKind
This commit is contained in:
@@ -157,8 +157,8 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
|
||||
fn visit_fn(&mut self, fn_kind: FnKind<'a>, span: Span, _: NodeId) {
|
||||
if let FnKind::Fn(_, _, sig, _, generics, body) = fn_kind {
|
||||
// FIXME(eholk): handle `async gen fn`
|
||||
if let (Async::Yes { closure_id, .. }, _) | (_, Gen::Yes { closure_id, .. }) =
|
||||
(sig.header.asyncness, sig.header.genness)
|
||||
if let CoroutineKind::Async { closure_id, .. } | CoroutineKind::Gen { closure_id, .. } =
|
||||
sig.header.coro_kind
|
||||
{
|
||||
self.visit_generics(generics);
|
||||
|
||||
@@ -284,11 +284,12 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
|
||||
// Async closures desugar to closures inside of closures, so
|
||||
// we must create two defs.
|
||||
let closure_def = self.create_def(expr.id, kw::Empty, DefKind::Closure, expr.span);
|
||||
match closure.asyncness {
|
||||
Async::Yes { closure_id, .. } => {
|
||||
match closure.coro_kind {
|
||||
CoroutineKind::Async { closure_id, .. }
|
||||
| CoroutineKind::Gen { closure_id, .. } => {
|
||||
self.create_def(closure_id, kw::Empty, DefKind::Closure, expr.span)
|
||||
}
|
||||
Async::No => closure_def,
|
||||
CoroutineKind::None => closure_def,
|
||||
}
|
||||
}
|
||||
ExprKind::Gen(_, _, _) => {
|
||||
|
||||
Reference in New Issue
Block a user