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

v.gen.c: fix compilation with -prod, for files using $embed_file() (regression after parallel cgen in 85b58b0)

This commit is contained in:
Delyan Angelov 2021-10-05 15:06:17 +03:00
parent b4d1429ef0
commit 92f2e5bad2
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -301,7 +301,7 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string {
done_optionals: global_g.done_optionals done_optionals: global_g.done_optionals
is_autofree: global_g.pref.autofree is_autofree: global_g.pref.autofree
} }
g.gen() g.gen_file()
return g return g
} }
) )
@ -310,6 +310,7 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string {
global_g.timers.start('cgen unification') global_g.timers.start('cgen unification')
// tg = thread gen // tg = thread gen
for g in pp.get_results<Gen>() { for g in pp.get_results<Gen>() {
global_g.embedded_files << g.embedded_files
global_g.out.write(g.out) or { panic(err) } global_g.out.write(g.out) or { panic(err) }
global_g.cheaders.write(g.cheaders) or { panic(err) } global_g.cheaders.write(g.cheaders) or { panic(err) }
global_g.includes.write(g.includes) or { panic(err) } global_g.includes.write(g.includes) or { panic(err) }
@ -380,7 +381,7 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string {
} else { } else {
for file in files { for file in files {
global_g.file = file global_g.file = file
global_g.gen() global_g.gen_file()
global_g.inits[file.mod.name].write(global_g.init) or { panic(err) } global_g.inits[file.mod.name].write(global_g.init) or { panic(err) }
global_g.init = strings.new_builder(100) global_g.init = strings.new_builder(100)
global_g.cleanups[file.mod.name].write(global_g.cleanup) or { panic(err) } global_g.cleanups[file.mod.name].write(global_g.cleanup) or { panic(err) }
@ -521,7 +522,7 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string {
return b.str() return b.str()
} }
pub fn (mut g Gen) gen() { pub fn (mut g Gen) gen_file() {
g.timers.start('cgen_file $g.file.path') g.timers.start('cgen_file $g.file.path')
if g.pref.is_vlines { if g.pref.is_vlines {