diff --git a/cmd/tools/vtest-fixed.v b/cmd/tools/vtest-fixed.v index 3da91fcd04..28c538240f 100644 --- a/cmd/tools/vtest-fixed.v +++ b/cmd/tools/vtest-fixed.v @@ -7,7 +7,6 @@ import v.pref const ( skip_test_files = [ 'vlib/arrays/arrays_test.v', - 'vlib/builtin/map_test.v', 'vlib/cli/command_test.v', 'vlib/cli/flag_test.v', 'vlib/clipboard/clipboard_test.v', // Linux only diff --git a/cmd/v/v.v b/cmd/v/v.v index 8d1a21097f..6e2c23fb00 100644 --- a/cmd/v/v.v +++ b/cmd/v/v.v @@ -129,6 +129,7 @@ fn parse_args(args []string) (&pref.Preferences, string) { '-stats' { res.is_stats = true } '-obfuscate' { res.obfuscate = true } '-translated' { res.translated = true } + '-showcc' { res.show_cc = true } //'-x64' { res.translated = true } '-os' { //TODO Remove `tmp` variable when it doesn't error out in C. diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index d7d86bb166..766096f3c4 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -16,6 +16,13 @@ pub fn (node &FnDecl) str(t &table.Table) string { } mut receiver := '' if node.is_method { + mut styp := t.type_to_str(node.receiver.typ) + mut m := if node.rec_mut { 'mut ' } else { '' } + if node.rec_mut { + styp = styp[1..] // remove & + } + receiver = '($node.receiver.name $m$styp) ' + /* sym := t.get_type_symbol(node.receiver.typ) name := sym.name.after('.') mut m := if node.rec_mut { 'mut ' } else { '' } @@ -23,6 +30,7 @@ pub fn (node &FnDecl) str(t &table.Table) string { m = '&' } receiver = '($node.receiver.name $m$name) ' +*/ } name := node.name.after('.') if node.is_c { @@ -35,8 +43,8 @@ pub fn (node &FnDecl) str(t &table.Table) string { continue } is_last_arg := i == node.args.len - 1 - should_add_type := is_last_arg || node.args[i + 1].typ != arg.typ || (node.is_variadic && i == - node.args.len - 2) + should_add_type := is_last_arg || node.args[i + 1].typ != arg.typ || (node.is_variadic && + i == node.args.len - 2) f.write(arg.name) mut s := t.type_to_str(arg.typ) if arg.is_mut { diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 6391ac2973..4fa1962192 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -323,7 +323,7 @@ start: // TODO remove cmd := '${v.pref.ccompiler} $args' // Run - if v.pref.is_verbose { + if v.pref.is_verbose || v.pref.show_cc { println('\n==========') println(cmd) } diff --git a/vlib/v/builder/cflags.v b/vlib/v/builder/cflags.v index 9df94c0612..94a609620c 100644 --- a/vlib/v/builder/cflags.v +++ b/vlib/v/builder/cflags.v @@ -4,6 +4,7 @@ module builder import os + // parsed cflag struct CFlag { mod string // the module in which the flag was given @@ -23,9 +24,8 @@ fn (v &Builder) get_os_cflags() []CFlag { if v.pref.compile_defines.len > 0 { ctimedefines << v.pref.compile_defines } - -// QTODO -/* + // QTODO + /* for flag in v.table.cflags { if flag.os == '' || (flag.os == 'linux' && v.pref.os == .linux) || (flag.os == 'darwin' && v.pref.os == .mac) || (flag.os == 'freebsd' && v.pref.os == .freebsd) || (flag.os == 'windows' && v.pref.os == .windows) || (flag.os == 'mingw' && v.pref.os == .windows && v.pref.ccompiler != 'msvc') || (flag.os == 'solaris' && v.pref.os == .solaris) { flags << flag @@ -34,7 +34,7 @@ fn (v &Builder) get_os_cflags() []CFlag { flags << flag } } - */ +*/ return flags } @@ -152,7 +152,6 @@ fn (table mut Table) parse_cflag(cflag string, mod string, ctimedefines []string return true } */ - // TODO: implement msvc specific c_options_before_target and c_options_after_target ... fn (cflags []CFlag) c_options_before_target_msvc() string { return '' @@ -204,4 +203,3 @@ fn (cflags []CFlag) c_options_only_object_files() string { } return args.join(' ') } - diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index f16538c595..b1f44206d5 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -327,8 +327,7 @@ pub fn (p mut Parser) top_stmt() ast.Stmt { p.next() p.next() return p.top_stmt() - } - else { + } else { p.error('bad top level statement ' + p.tok.str()) return ast.Stmt{} } diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 7f54fde510..fc56c820a9 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -42,6 +42,7 @@ pub mut: is_debug bool // false by default, turned on by -g or -cg, it tells v to pass -g to the C backend compiler. is_vlines bool // turned on by -g, false by default (it slows down .tmp.c generation slightly). is_keep_c bool // -keep_c , tell v to leave the generated .tmp.c alone (since by default v will delete them after c backend finishes) + show_cc bool // -showcc, print cc command // NB: passing -cg instead of -g will set is_vlines to false and is_g to true, thus making v generate cleaner C files, // which are sometimes easier to debug / inspect manually than the .tmp.c files by plain -g (when/if v line number generation breaks). is_cache bool // turns on v usage of the module cache to speed up compilation.