1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: keep {} in string interpolation for chained CallExprs (#8422)

This commit is contained in:
Lukas Neubert 2021-01-30 11:58:19 +01:00 committed by GitHub
parent 2774db077d
commit a044441224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -158,6 +158,9 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) {
CallExpr {
if sub_expr.args.len != 0 {
needs_braces = true
} else if sub_expr.left is CallExpr {
sub_expr = sub_expr.left
continue
}
break
}

View File

@ -9,5 +9,5 @@ fn main() {
d := 'a: ${a:5s} b: ${b:-5s} i: ${i:20d}'
println('a: $a $b xxx')
eprintln('e: $e')
println(d)
_ = ' ${foo.method(bar).str()} '
}