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

pref: add -check-syntax for just parsing files, without checking them

This commit is contained in:
Delyan Angelov 2020-07-12 22:44:38 +03:00
parent b5b5176f9b
commit f1fdafcdff
3 changed files with 13 additions and 0 deletions

View File

@ -13,6 +13,9 @@ pub fn (mut b Builder) gen_c(v_files []string) string {
t1 := time.ticks() t1 := time.ticks()
parse_time := t1 - t0 parse_time := t1 - t0
b.info('PARSE: ${parse_time}ms') b.info('PARSE: ${parse_time}ms')
if b.pref.only_check_syntax {
return ''
}
// //
b.generic_struct_insts_to_concrete() b.generic_struct_insts_to_concrete()
b.checker.check_files(b.parsed_files) b.checker.check_files(b.parsed_files)

View File

@ -76,6 +76,12 @@ fn (mut v Builder) cc() {
if v.pref.is_verbose { if v.pref.is_verbose {
println('builder.cc() pref.out_name="$v.pref.out_name"') 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() v.build_thirdparty_obj_files()
vexe := pref.vexe_path() vexe := pref.vexe_path()
vdir := os.dir(vexe) vdir := os.dir(vexe)

View File

@ -115,6 +115,7 @@ pub mut:
is_parallel bool is_parallel bool
error_limit int error_limit int
is_vweb bool // skip _ var warning in templates 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) { pub fn parse_args(args []string) (&Preferences, string) {
@ -126,6 +127,9 @@ pub fn parse_args(args []string) (&Preferences, string) {
arg := args[i] arg := args[i]
current_args := args[i..] current_args := args[i..]
match arg { match arg {
'-check-syntax' {
res.only_check_syntax = true
}
'-v' { '-v' {
res.is_verbose = true res.is_verbose = true
} }