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

make all necessary structs public

This commit is contained in:
Alexander Medvednikov
2019-10-24 12:47:21 +03:00
parent dce3275df4
commit 4a88a28a3b
9 changed files with 34 additions and 26 deletions

View File

@ -1100,6 +1100,9 @@ fn (p mut Parser) get_type() string {
p.error('unknown type `$typ`')
}
}
else if !t.is_public && t.mod != p.mod && t.name != '' {
p.warn('type `$t.name` is private')
}
}
if typ == 'void' {
p.error('unknown type `$typ`')
@ -3179,6 +3182,9 @@ fn (p mut Parser) array_init() string {
fn (p mut Parser) struct_init(typ string) string {
p.is_struct_init = true
t := p.table.find_type(typ)
if !t.is_public && t.mod != p.mod {
p.warn('type `$t.name` is private')
}
if p.gen_struct_init(typ, t) { return typ }
p.scanner.fmt_out.cut(typ.len)
ptr := typ.contains('*')
@ -4120,7 +4126,7 @@ fn (p mut Parser) js_decode() string {
p.gen('json__jsdecode_$typ($cjson_tmp, &$tmp); cJSON_Delete($cjson_tmp);')
opt_type := 'Option_$typ'
p.cgen.typedefs << 'typedef Option $opt_type;'
p.table.register_type(opt_type)
p.table.register_builtin(opt_type)
return opt_type
}
else if op == 'encode' {