diff --git a/vlib/builtin/map.v b/vlib/builtin/map.v index 0ef6ba7afd..410c8dd861 100644 --- a/vlib/builtin/map.v +++ b/vlib/builtin/map.v @@ -4,8 +4,8 @@ module builtin import strings -import hash.wyhash as hash -//import hash +//import hash.wyhash as hash +import hash /* This is a highly optimized hashmap implementation. It has several traits that diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 3992970a90..48f2b9913f 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -220,8 +220,10 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string b.write(g.stringliterals.str()) } if g.auto_str_funcs.len > 0 { - b.writeln('\n// V auto str functions:') - b.write(g.auto_str_funcs.str()) + if g.pref.build_mode != .build_module { + b.writeln('\n// V auto str functions:') + b.write(g.auto_str_funcs.str()) + } } b.writeln('\n// V out') b.write(g.out.str()) @@ -733,6 +735,11 @@ fn (mut g Gen) stmt(node ast.Stmt) { println('build module `$g.module_built` fn `$node.name`') } } + if g.pref.use_cache { + if node.mod != 'main' { + skip = true + } + } keep_fn_decl := g.fn_decl g.fn_decl = node if node.name == 'main.main' { @@ -4164,6 +4171,9 @@ fn styp_to_str_fn_name(styp string) string { [inline] fn (mut g Gen) gen_str_for_type(typ table.Type) string { + if g.pref.build_mode == .build_module { + return '' + } styp := g.typ(typ) return g.gen_str_for_type_with_styp(typ, styp) } diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index 78809e66f6..40cfa4fcde 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -15,9 +15,6 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl, skip bool) { // if g.fileis('vweb.v') { // println('\ngen_fn_decl() $it.name $it.is_generic $g.cur_generic_type') // } - if g.pref.use_cache && skip { - return - } if it.is_generic && g.cur_generic_type == 0 { // need the cur_generic_type check to avoid inf. recursion // loop thru each generic type and generate a function for gen_type in g.table.fn_gen_types[it.name] { @@ -108,7 +105,7 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl, skip bool) { g.write(fn_header) } fargs, fargtypes := g.fn_args(it.args, it.is_variadic) - if it.no_body || (g.pref.use_cache && it.is_builtin) { + if it.no_body || (g.pref.use_cache && it.is_builtin) || skip { // Just a function header. Builtin function bodies are defined in builtin.o g.definitions.writeln('); // NO BODY') g.writeln(');')