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

fmt: fix formatting of the comptime call (#18945)

This commit is contained in:
yuyi 2023-07-22 23:11:36 +08:00 committed by GitHub
parent 466c80f80a
commit 7451178c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -1977,7 +1977,11 @@ pub fn (mut f Fmt) comptime_call(node ast.ComptimeCall) {
f.write("\$pkgconfig('${node.args_var}')")
}
node.method_name in ['compile_error', 'compile_warn'] {
f.write("\$${node.method_name}('${node.args_var}')")
if node.args_var.contains("'") {
f.write('\$${node.method_name}("${node.args_var}")')
} else {
f.write("\$${node.method_name}('${node.args_var}')")
}
}
node.method_name == 'res' {
if node.args_var != '' {

View File

@ -0,0 +1,5 @@
$if linux {
$compile_error("This won't be formatted correctly by v fmt :')")
}
fn main() {}