Skip to content

Commit

Permalink
julefmt: fix while-next iteration formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 29, 2024
1 parent aa814fd commit 88fffc3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/format.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1065,8 +1065,10 @@ impl ScopeFormatter {
match type it.kind {
| &ast::WhileKind:
let mut wk = (&ast::WhileKind)(it.kind)
self.fmt.pop_row_comments_by_c(wk.expr.token.row, wk.expr.token.column)
self.fmt.format_expr(wk.expr)
if wk.expr != nil {
self.fmt.pop_row_comments_by_c(wk.expr.token.row, wk.expr.token.column)
self.fmt.format_expr(wk.expr)
}
if wk.next != nil {
self.write("; ")
self.format_stmt(wk.next)
Expand Down

0 comments on commit 88fffc3

Please sign in to comment.