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

vfmt: fix eating .zlib in $embed_file('v.png', .zlib) (#12794)

This commit is contained in:
Leo Developer
2021-12-11 14:21:26 +01:00
committed by GitHub
parent 7c7cdf8ce7
commit 9bf777c1ee
2 changed files with 6 additions and 1 deletions

View File

@ -1700,7 +1700,11 @@ pub fn (mut f Fmt) comptime_call(node ast.ComptimeCall) {
} }
} else { } else {
if node.is_embed { if node.is_embed {
f.write("\$embed_file('$node.embed_file.rpath')") if node.embed_file.compression_type == 'none' {
f.write("\$embed_file('$node.embed_file.rpath')")
} else {
f.write("\$embed_file('$node.embed_file.rpath', .$node.embed_file.compression_type)")
}
} else if node.is_env { } else if node.is_env {
f.write("\$env('$node.args_var')") f.write("\$env('$node.args_var')")
} else if node.is_pkgconfig { } else if node.is_pkgconfig {

View File

@ -5,4 +5,5 @@ fn main() {
eprintln('content: ${ptr_str(content)}') eprintln('content: ${ptr_str(content)}')
eprintln(unsafe { the_png.data().vbytes(the_png.len) }.hex()) eprintln(unsafe { the_png.data().vbytes(the_png.len) }.hex())
println(the_png) println(the_png)
the_other_png := $embed_file('v.png', .zlib)
} }