builder: use verror for not found modules

pull/4893/head
yuyi 2020-05-14 15:59:29 +08:00 committed by GitHub
parent 74005b4362
commit 70b76a8e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -67,12 +67,13 @@ pub fn (mut b Builder) parse_imports() {
// break
// println('module_search_paths:')
// println(b.module_search_paths)
panic('cannot import module "$mod" (not found)')
verror('cannot import module "$mod" (not found)')
break
}
v_files := b.v_files_from_dir(import_path)
if v_files.len == 0 {
// v.parsers[i].error_with_token_index('cannot import module "$mod" (no .v files in "$import_path")', v.parsers[i].import_table.get_import_tok_idx(mod))
panic('cannot import module "$mod" (no .v files in "$import_path")')
verror('cannot import module "$mod" (no .v files in "$import_path")')
}
// Add all imports referenced by these libs
parsed_files := parser.parse_files(v_files, b.table, b.pref, b.global_scope)

View File

@ -0,0 +1 @@
builder error: cannot import module "notexist" (not found)

View File

@ -0,0 +1,4 @@
import notexist
fn main() {
println('hello, world')
}