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

module cache fixes; do not allow function names starting with _

This commit is contained in:
Alexander Medvednikov
2019-10-09 23:38:33 +03:00
parent 0796e1dd69
commit 2411b8d1e7
18 changed files with 95 additions and 42 deletions

View File

@@ -72,6 +72,18 @@ fn v_type_str(typ_ string) string {
typ_
}
typ = typ.replace('Option_', '?')
if typ.contains('_V_MulRet') {
words := typ.replace('_V_MulRet_', '').split('_V_')
typ = '('
for i in 0 .. words.len {
typ += words[i]
if i != words.len - 1 {
typ += ','
}
}
typ += ')'
return typ
}
//println('"$typ"')
if typ == '*void' {
return 'voidptr'
@@ -132,13 +144,16 @@ fn (v &V) generate_vh() {
file.writeln('\n')
}
// Types
file.writeln('// Types2')
file.writeln('// Types')
for _, typ in v.table.typesmap {
//println(typ.name)
if typ.mod != v.mod && typ.mod != ''{ // int, string etc mod == ''
//println('skipping type "$typ.name"')
continue
}
if typ.name.contains('_V_MulRet') {
continue
}
mut name := typ.name
if typ.name.contains('__') {
name = typ.name.all_after('__')
@@ -179,7 +194,7 @@ fn (v &V) generate_vh() {
if f.mod == v.mod || f.mod == ''{
fns << f
} else {
println('skipping fn $f.name mod=$f.mod')
//println('skipping fn $f.name mod=$f.mod')
}
}
for _, f in fns {
@@ -199,7 +214,7 @@ fn (v &V) generate_vh() {
file.writeln('\n// Methods //////////////////')
for _, typ in v.table.typesmap {
if typ.mod != v.mod { //&& typ.mod != '' {
println('skipping method typ $typ.name mod=$typ.mod')
//println('skipping method typ $typ.name mod=$typ.mod')
continue
}
for method in typ.methods {