Skip to content

Commit

Permalink
julefmt: improve slice literal support
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 24, 2024
1 parent 21d92e9 commit dc7388f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/format.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,7 @@ impl ExprFormatter {
self.write("}")
}

fn brace_lit(self, mut lit: &ast::BraceLit) {
self.write("{")
fn responsive_exprs[T](self, mut &lit: T) {
self.fmt.add_indent()
let mut row = lit.token.row
let mut lined = false
Expand All @@ -1221,6 +1220,11 @@ impl ExprFormatter {
self.write("\n")
self.write(self.fmt.indent)
}
}

fn brace_lit(self, mut lit: &ast::BraceLit) {
self.write("{")
self.responsive_exprs[&ast::BraceLit](lit)
self.write("}")
}

Expand All @@ -1232,7 +1236,7 @@ impl ExprFormatter {

fn slice(self, mut s: &ast::SliceExpr) {
self.write("[")
self.args_data(s.elems)
self.responsive_exprs[&ast::SliceExpr](s)
self.write("]")
}

Expand Down

0 comments on commit dc7388f

Please sign in to comment.