Format class definitions (#5289)

This commit is contained in:
Micha Reiser 2023-06-22 11:09:43 +02:00 committed by GitHub
parent 7d4f8e59da
commit f7e1cf4b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 914 additions and 541 deletions

View file

@ -582,6 +582,12 @@ fn handle_trailing_end_of_line_condition_comment<'a>(
.as_deref()
.map(AnyNodeRef::from)
.or_else(|| Some(AnyNodeRef::from(args.as_ref()))),
AnyNodeRef::StmtClassDef(StmtClassDef {
bases, keywords, ..
}) => keywords
.last()
.map(AnyNodeRef::from)
.or_else(|| bases.last().map(AnyNodeRef::from)),
_ => None,
};
@ -622,8 +628,13 @@ fn handle_trailing_end_of_line_condition_comment<'a>(
TokenKind::RParen => {
// Skip over any closing parentheses
}
_ => {
unreachable!("Only ')' or ':' should follow the condition")
TokenKind::Comma => {
// Skip over any trailing comma
}
kind => {
unreachable!(
"Only ')' or ':' should follow the condition but encountered {kind:?}"
)
}
}
}