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

bring back local modules

This commit is contained in:
Alexander Medvednikov
2019-08-04 00:03:52 +02:00
parent 9eb385d9ee
commit 01531369f7
2 changed files with 29 additions and 15 deletions

View File

@@ -981,15 +981,7 @@ fn (v mut V) add_v_files_to_compile() {
// for mod in v.table.imports {
for i := 0; i < v.table.imports.len; i++ {
mod := v.table.imports[i]
mod_path := v.module_path(mod)
mut import_path := '$ModPath/$mod_path'
//println('ip=$import_path')
if !os.dir_exists(import_path){
import_path = '$v.lang_dir/vlib/$mod_path'
if !os.dir_exists(import_path){
panic('module "$mod" not found')
}
}
import_path := v.find_module_path(mod)
vfiles := v.v_files_from_dir(import_path)
if vfiles.len == 0 {
panic('cannot import module $mod (no .v files in "$import_path").')
@@ -1019,18 +1011,16 @@ fn (v mut V) add_v_files_to_compile() {
if mod == v.mod {
continue
}
mod_p := v.module_path(mod)
mut module_path := '$ModPath/$mod_p'
mod_path := v.find_module_path(mod)
// If we are in default mode, we don't parse vlib .v files, but header .vh files in
// TmpPath/vlib
// These were generated by vfmt
/*
if v.pref.build_mode == .default_mode || v.pref.build_mode == .build {
module_path = '$ModPath/vlib/$mod_p'
}
if !os.dir_exists(module_path) {
module_path = '$v.lang_dir/vlib/$mod_p'
}
vfiles := v.v_files_from_dir(module_path)
*/
vfiles := v.v_files_from_dir(mod_path)
for file in vfiles {
if !file in v.files {
v.files << file