vvet: fix segfault on `v vet .`

pull/5977/head
Delyan Angelov 2020-07-25 15:57:57 +03:00
parent d5b837e808
commit a552674254
2 changed files with 9 additions and 3 deletions

View File

@ -10,13 +10,13 @@ const (
] ]
skip_on_musl = []string{} skip_on_musl = []string{}
skip_on_ubuntu_musl = [ skip_on_ubuntu_musl = [
// 'vlib/v/gen/js/jsgen_test.v',
'vlib/net/http/cookie_test.v', 'vlib/net/http/cookie_test.v',
'vlib/net/http/http_test.v', 'vlib/net/http/http_test.v',
'vlib/net/websocket/ws_test.v', 'vlib/net/websocket/ws_test.v',
'vlib/sqlite/sqlite_test.v', 'vlib/sqlite/sqlite_test.v',
'vlib/orm/orm_test.v', 'vlib/orm/orm_test.v',
'vlib/clipboard/clipboard_test.v', 'vlib/clipboard/clipboard_test.v',
// 'vlib/v/gen/js/jsgen_test.v',
] ]
skip_on_linux = []string{} skip_on_linux = []string{}
skip_on_non_linux = [ skip_on_non_linux = [

View File

@ -120,7 +120,7 @@ pub fn new_scanner(text string, comments_mode CommentsMode, pref &pref.Preferenc
pub fn new_vet_scanner(text string, comments_mode CommentsMode, pref &pref.Preferences, vet_errors &[]string) &Scanner { pub fn new_vet_scanner(text string, comments_mode CommentsMode, pref &pref.Preferences, vet_errors &[]string) &Scanner {
is_fmt := pref.is_fmt is_fmt := pref.is_fmt
s := &Scanner{ mut s := &Scanner{
pref: pref pref: pref
text: text text: text
is_print_line_on_error: true is_print_line_on_error: true
@ -130,6 +130,7 @@ pub fn new_vet_scanner(text string, comments_mode CommentsMode, pref &pref.Prefe
comments_mode: comments_mode comments_mode: comments_mode
vet_errors: vet_errors vet_errors: vet_errors
} }
s.file_path = 'internal_memory'
return s return s
} }
@ -1360,7 +1361,12 @@ pub fn (s &Scanner) error(msg string) {
} }
fn (mut s Scanner) vet_error(msg string) { fn (mut s Scanner) vet_error(msg string) {
s.vet_errors << '$s.file_path:$s.line_nr: $msg' eline := '$s.file_path:$s.line_nr: $msg'
if s.vet_errors == 0 {
eprintln(eline)
return
}
s.vet_errors << eline
} }
pub fn verror(s string) { pub fn verror(s string) {