Skip to content

Commit

Permalink
julefmt: improve short variable declaration support
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Aug 12, 2024
1 parent ac91290 commit 1fd3e60
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 @@ -7,6 +7,7 @@ use ast for std::jule::ast::{
}
use lex for std::jule::lex::{
Token,
TokenId,
TokenKind,
}
use std::jule::types::{TypeKind}
Expand Down Expand Up @@ -666,7 +667,7 @@ impl formatter {
self.write("static ")
} else if d.Constant {
self.write("const ")
} else {
} else if d.Setter == nil || d.Setter.Id == TokenId.Eq {
self.write("let ")
}
}
Expand All @@ -682,7 +683,9 @@ impl formatter {
self.formatType(d.Kind)
}
if d.Expr != nil {
self.write(" = ")
self.write(" ")
self.write(d.Setter.Kind)
self.write(" ")
self.formatExpr(d.Expr)
}
}
Expand Down

0 comments on commit 1fd3e60

Please sign in to comment.