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

v2: add missing table/modules.v

This commit is contained in:
joe-conigliaro 2020-02-19 13:11:55 +11:00
parent b62a90a212
commit f91bded9b3

20
vlib/v/table/modules.v Normal file
View File

@ -0,0 +1,20 @@
module table
import os
// Once we have a module format we can read from module file instead
// this is not optimal
pub fn (table &Table) qualify_module(mod string, file_path string) string {
for m in table.imports {
println('TABLE IMPORT: $m')
if m.contains('.') && m.contains(mod) {
m_parts := m.split('.')
m_path := m_parts.join(os.path_separator)
println('IMPORT B: $m - $m_path')
if mod == m_parts[m_parts.len - 1] && file_path.contains(m_path) {
return m
}
}
}
return mod
}