fmt: keep {} in string interpolation for chained CallExprs (#8422)
parent
2774db077d
commit
a044441224
|
@ -158,6 +158,9 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) {
|
||||||
CallExpr {
|
CallExpr {
|
||||||
if sub_expr.args.len != 0 {
|
if sub_expr.args.len != 0 {
|
||||||
needs_braces = true
|
needs_braces = true
|
||||||
|
} else if sub_expr.left is CallExpr {
|
||||||
|
sub_expr = sub_expr.left
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@ fn main() {
|
||||||
d := 'a: ${a:5s} b: ${b:-5s} i: ${i:20d}'
|
d := 'a: ${a:5s} b: ${b:-5s} i: ${i:20d}'
|
||||||
println('a: $a $b xxx')
|
println('a: $a $b xxx')
|
||||||
eprintln('e: $e')
|
eprintln('e: $e')
|
||||||
println(d)
|
_ = ' ${foo.method(bar).str()} '
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue