checker: make an error using non `pub` fns from other modules

pull/5073/head
Delyan Angelov 2020-05-27 12:00:08 +03:00
parent ebbf42dadb
commit 481f103dc9
3 changed files with 4 additions and 8 deletions

View File

@ -940,10 +940,7 @@ pub fn (s string) trim_suffix(str string) string {
return s
}
// fn print_cur_thread() {
// //C.printf("tid = %08x \n", pthread_self());
// }
fn compare_strings(a, b &string) int {
pub fn compare_strings(a, b &string) int {
if a.lt(b) {
return -1
}

View File

@ -911,9 +911,8 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type {
call_expr.pos)
}
}
if !f.is_pub && f.language == .v && !c.is_builtin_mod && !c.pref.is_test && f.mod != c.mod &&
f.name != '' && f.mod != '' {
c.warn('function `$f.name` is private. curmod=$c.mod fmod=$f.mod', call_expr.pos)
if !f.is_pub && f.language == .v && f.name.len > 0 && f.mod.len > 0 && f.mod != c.mod {
c.error('function `$f.name` is private. curmod=$c.mod fmod=$f.mod', call_expr.pos)
}
call_expr.return_type = f.return_type
if f.return_type == table.void_type && f.ctdefine.len > 0 && f.ctdefine !in c.pref.compile_defines {

View File

@ -174,7 +174,7 @@ pub fn color_compare_files(diff_cmd, file1, file2 string) string {
return ''
}
fn color_compare_strings(diff_cmd string, expected string, found string) string {
pub fn color_compare_strings(diff_cmd string, expected string, found string) string {
cdir := os.cache_dir()
ctime := time.sys_mono_now()
e_file := os.join_path(cdir, '${ctime}.expected.txt')