Introduce closure_id method on CoroutineKind
This commit is contained in:
parent
f967532a47
commit
8361a7288e
4 changed files with 24 additions and 24 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue