1
0
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:
Lukas Neubert
2021-02-01 10:04:57 +01:00
committed by GitHub
parent 8b0401a46f
commit 43676330ba
2 changed files with 5 additions and 0 deletions

View File

@ -165,6 +165,10 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) {
break
}
SelectorExpr {
if sub_expr.field_name[0] == `@` {
needs_braces = true
break
}
sub_expr = sub_expr.expr
continue
}

View File

@ -10,4 +10,5 @@ fn main() {
println('a: $a $b xxx')
eprintln('e: $e')
_ = ' ${foo.method(bar).str()} '
println('(${some_struct.@type}, $some_struct.y)')
}