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

pull/5816/head
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()
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)

View File

@ -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)

View File

@ -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
}