mirror of
https://github.com/vlang/v.git
synced 2025-09-10 07:47:20 -04:00
This commit is contained in:
parent
5d4e89f888
commit
4205697d88
@ -1613,7 +1613,9 @@ pub fn (mut f Fmt) return_stmt(node ast.Return) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.writeln('')
|
if !f.single_line_if {
|
||||||
|
f.writeln('')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut f Fmt) sql_stmt(node ast.SqlStmt) {
|
pub fn (mut f Fmt) sql_stmt(node ast.SqlStmt) {
|
||||||
|
8
vlib/v/fmt/tests/if_ternary_return_keep.vv
Normal file
8
vlib/v/fmt/tests/if_ternary_return_keep.vv
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module main
|
||||||
|
|
||||||
|
fn g() ?int {
|
||||||
|
return 123
|
||||||
|
}
|
||||||
|
|
||||||
|
x := if ff := g() { ff } else { return }
|
||||||
|
println(x)
|
@ -155,9 +155,7 @@ fn test_go_call_closure() {
|
|||||||
fn test_closures_with_ifstmt() {
|
fn test_closures_with_ifstmt() {
|
||||||
a := 1
|
a := 1
|
||||||
f := fn [a] (x int) int {
|
f := fn [a] (x int) int {
|
||||||
if a > x { return 1
|
if a > x { return 1 } else { return -1 }
|
||||||
} else { return -1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
g := fn [a] () int {
|
g := fn [a] () int {
|
||||||
if true {
|
if true {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user