From f1fdafcdffcea58f3b1f9737b261125425aaf93b Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 12 Jul 2020 22:44:38 +0300 Subject: [PATCH] pref: add -check-syntax for just parsing files, without checking them --- vlib/v/builder/c.v | 3 +++ vlib/v/builder/cc.v | 6 ++++++ vlib/v/pref/pref.v | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/vlib/v/builder/c.v b/vlib/v/builder/c.v index 34f57fddd2..f9698fd8df 100644 --- a/vlib/v/builder/c.v +++ b/vlib/v/builder/c.v @@ -13,6 +13,9 @@ pub fn (mut b Builder) gen_c(v_files []string) string { t1 := time.ticks() parse_time := t1 - t0 b.info('PARSE: ${parse_time}ms') + if b.pref.only_check_syntax { + return '' + } // b.generic_struct_insts_to_concrete() b.checker.check_files(b.parsed_files) diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 910f42c059..e83f35966d 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -76,6 +76,12 @@ fn (mut v Builder) cc() { if v.pref.is_verbose { println('builder.cc() pref.out_name="$v.pref.out_name"') } + if v.pref.only_check_syntax { + if v.pref.is_verbose { + println('builder.cc returning early, since pref.only_check_syntax is true') + } + return + } v.build_thirdparty_obj_files() vexe := pref.vexe_path() vdir := os.dir(vexe) diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index e3a31708b3..0e4ea9aa47 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -115,6 +115,7 @@ pub mut: is_parallel bool error_limit int is_vweb bool // skip _ var warning in templates + only_check_syntax bool // when true, just parse the files, then stop, before running checker } pub fn parse_args(args []string) (&Preferences, string) { @@ -126,6 +127,9 @@ pub fn parse_args(args []string) (&Preferences, string) { arg := args[i] current_args := args[i..] match arg { + '-check-syntax' { + res.only_check_syntax = true + } '-v' { res.is_verbose = true }