1
Fork 0

Merge Async and Gen into CoroutineKind

This commit is contained in:
Eric Holk 2023-11-30 14:54:39 -08:00
parent 3887b1645a
commit 48d5f1f0f2
No known key found for this signature in database
GPG key ID: 8EA6B43ED4CE0911
25 changed files with 442 additions and 238 deletions

View file

@ -1490,9 +1490,15 @@ impl<'a> State<'a> {
}
}
fn print_asyncness(&mut self, asyncness: ast::Async) {
if asyncness.is_async() {
self.word_nbsp("async");
fn print_coro_kind(&mut self, coro_kind: ast::CoroutineKind) {
match coro_kind {
ast::CoroutineKind::None => {}
ast::CoroutineKind::Gen { .. } => {
self.word_nbsp("gen");
}
ast::CoroutineKind::Async { .. } => {
self.word_nbsp("async");
}
}
}
@ -1685,7 +1691,7 @@ impl<'a> State<'a> {
fn print_fn_header_info(&mut self, header: ast::FnHeader) {
self.print_constness(header.constness);
self.print_asyncness(header.asyncness);
self.print_coro_kind(header.coro_kind);
self.print_unsafety(header.unsafety);
match header.ext {

View file

@ -413,7 +413,7 @@ impl<'a> State<'a> {
binder,
capture_clause,
constness,
asyncness,
coro_kind,
movability,
fn_decl,
body,
@ -423,7 +423,7 @@ impl<'a> State<'a> {
self.print_closure_binder(binder);
self.print_constness(*constness);
self.print_movability(*movability);
self.print_asyncness(*asyncness);
self.print_coro_kind(*coro_kind);
self.print_capture_clause(*capture_clause);
self.print_fn_params_and_ret(fn_decl, true);