Skip to content

Commit

Permalink
julefmt: add support for latest type-enum syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Apr 10, 2024
1 parent 74636bc commit f26db7c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/format.jule
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,18 @@ impl Formatter {

fn enum_item[T](&self, mut &item: T) {
self.write(self.indent)
self.write(item.ident)
match type T {
| &ast::EnumItemDecl:
self.write(item.ident)
if !item.auto_expr() {
self.write(": ")
self.format_expr(item.expr)
}
| &ast::TypeEnumItemDecl:
self.write(": ")
if item.ident != "" {
self.write(item.ident)
self.write(": ")
}
self.format_type(item.kind)
}
self.write(",")
Expand Down

0 comments on commit f26db7c

Please sign in to comment.