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

compiler: enhance non-pub struct fields error message

This commit is contained in:
Nicolas Sauzede 2019-10-14 09:15:21 +02:00 committed by Alexander Medvednikov
parent 2d127cb694
commit eb031b6800

View File

@ -2189,7 +2189,13 @@ struct $f.parent_fn {
if field.access_mod == .private && !p.builtin_mod && !p.pref.translated && p.mod != typ.mod && p.file_path_id != 'vgen' {
// println('$typ.name :: $field.name ')
// println(field.access_mod)
p.error_with_token_index('cannot refer to unexported field `$struct_field` (type `$typ.name`)', fname_tidx)
p.error_with_token_index('cannot refer to unexported field `$struct_field` (type `$typ.name`)\n' +
'declare the field with `pub:`
struct $typ.name {
pub:
$struct_field $field.typ
}
', fname_tidx)
}
p.gen(dot + struct_field)
p.next()