implementing Display for enums too.

This commit is contained in:
Fireassember 2020-03-11 22:54:24 +02:00
parent 787043496a
commit 31eec5e80c
2 changed files with 643 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -69,8 +69,8 @@ fn generate_ast(grammar: AstSrc<'_>) -> Result<String> {
}
impl std::fmt::Display for #name {
fn fmt(..) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax())
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
@ -120,6 +120,12 @@ fn generate_ast(grammar: AstSrc<'_>) -> Result<String> {
}
)*
impl std::fmt::Display for #name {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl AstNode for #name {
fn can_cast(kind: SyntaxKind) -> bool {
match kind {