mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: keep braces around @ escaped fields in string interpolation (#8488)
This commit is contained in:
@ -165,6 +165,10 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
SelectorExpr {
|
SelectorExpr {
|
||||||
|
if sub_expr.field_name[0] == `@` {
|
||||||
|
needs_braces = true
|
||||||
|
break
|
||||||
|
}
|
||||||
sub_expr = sub_expr.expr
|
sub_expr = sub_expr.expr
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,5 @@ fn main() {
|
|||||||
println('a: $a $b xxx')
|
println('a: $a $b xxx')
|
||||||
eprintln('e: $e')
|
eprintln('e: $e')
|
||||||
_ = ' ${foo.method(bar).str()} '
|
_ = ' ${foo.method(bar).str()} '
|
||||||
|
println('(${some_struct.@type}, $some_struct.y)')
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user