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

pull/12795/head
Leo Developer 2021-12-11 14:21:26 +01:00 committed by GitHub
parent 7c7cdf8ce7
commit 9bf777c1ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {
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 {
f.write("\$env('$node.args_var')")
} else if node.is_pkgconfig {

View File

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