Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions vlib/v/fmt/fmt.v
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,6 @@ fn (f &Fmt) should_insert_newline_before_node(node ast.Node, prev_node ast.Node)
ast.Import {
return false
}
ast.Block {
if node is ast.Block && !node.is_unsafe && node.pos.line_nr - prev_line_nr > 0 {
return true
} else {
return false
}
}
ast.ConstDecl {
if node !is ast.ConstDecl && !(node is ast.ExprStmt && node.expr is ast.Comment) {
return true
Expand Down
8 changes: 8 additions & 0 deletions vlib/v/fmt/tests/block_with_blank_line_keep.vv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn main() {
{
println('(1/3) My first small scope')
//
}

println('hello')
}
2 changes: 1 addition & 1 deletion vlib/v/parser/parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ fn (mut p Parser) stmt(is_top_level bool) ast.Stmt {
}
} else {
stmts := p.parse_block()
pos.last_line = p.prev_tok.line_nr
pos.update_last_line(p.prev_tok.line_nr)
return ast.Block{
stmts: stmts
pos: pos
Expand Down