cgen: fix module builds when -usecache is on by default

pull/7424/head
joe-conigliaro 2020-12-20 22:03:27 +11:00
parent 4b45f2eaab
commit 3b2083801b
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
2 changed files with 2 additions and 2 deletions

View File

@ -969,7 +969,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
println('build module `$g.module_built` fn `$node.name`') println('build module `$g.module_built` fn `$node.name`')
} }
} }
if g.pref.use_cache { if g.pref.use_cache && g.pref.build_mode != .build_module {
// We are using prebuilt modules, we do not need to generate // We are using prebuilt modules, we do not need to generate
// their functions in main.c. // their functions in main.c.
if node.mod != 'main' && node.mod != 'help' && !should_bundle_module { if node.mod != 'main' && node.mod != 'help' && !should_bundle_module {

View File

@ -113,7 +113,7 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl, skip bool) {
arg_start_pos := g.out.len arg_start_pos := g.out.len
fargs, fargtypes := g.fn_args(it.params, it.is_variadic) fargs, fargtypes := g.fn_args(it.params, it.is_variadic)
arg_str := g.out.after(arg_start_pos) arg_str := g.out.after(arg_start_pos)
if it.no_body || (g.pref.use_cache && it.is_builtin) || skip { if it.no_body || ((g.pref.use_cache && g.pref.build_mode != .build_module) && it.is_builtin) || skip {
// Just a function header. Builtin function bodies are defined in builtin.o // Just a function header. Builtin function bodies are defined in builtin.o
g.definitions.writeln(');') // // NO BODY') g.definitions.writeln(');') // // NO BODY')
g.writeln(');') g.writeln(');')