Format Function definitions (#4951)

This commit is contained in:
Micha Reiser 2023-06-08 18:07:33 +02:00 committed by GitHub
parent 07cc4bcb0f
commit 68969240c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 2601 additions and 1223 deletions

View file

@ -112,3 +112,22 @@ impl<'a> From<&'a StmtAsyncFunctionDef> for AnyFunctionDefinition<'a> {
Self::AsyncFunctionDefinition(value)
}
}
impl<'a> From<AnyFunctionDefinition<'a>> for AnyNodeRef<'a> {
fn from(value: AnyFunctionDefinition<'a>) -> Self {
match value {
AnyFunctionDefinition::FunctionDefinition(function_def) => {
AnyNodeRef::StmtFunctionDef(function_def)
}
AnyFunctionDefinition::AsyncFunctionDefinition(async_def) => {
AnyNodeRef::StmtAsyncFunctionDef(async_def)
}
}
}
}
impl<'a> From<&'a AnyFunctionDefinition<'a>> for AnyNodeRef<'a> {
fn from(value: &'a AnyFunctionDefinition<'a>) -> Self {
(*value).into()
}
}