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:
parent
466c80f80a
commit
7451178c45
@ -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 != '' {
|
||||
|
5
vlib/v/fmt/tests/comptime_call_keep.vv
Normal file
5
vlib/v/fmt/tests/comptime_call_keep.vv
Normal file
@ -0,0 +1,5 @@
|
||||
$if linux {
|
||||
$compile_error("This won't be formatted correctly by v fmt :')")
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user