1
Fork 0

Introduce closure_id method on CoroutineKind

This commit is contained in:
Michael Goulet 2023-12-08 21:38:00 +00:00
parent f967532a47
commit 8361a7288e
4 changed files with 24 additions and 24 deletions

View file

@ -2450,6 +2450,14 @@ impl CoroutineKind {
matches!(self, CoroutineKind::Gen { .. })
}
pub fn closure_id(self) -> NodeId {
match self {
CoroutineKind::Async { closure_id, .. }
| CoroutineKind::Gen { closure_id, .. }
| CoroutineKind::AsyncGen { closure_id, .. } => closure_id,
}
}
/// In this case this is an `async` or `gen` return, the `NodeId` for the generated `impl Trait`
/// item.
pub fn return_id(self) -> (NodeId, Span) {