checker: make pub field check an error
parent
53989daf9a
commit
d7c4630d33
|
@ -14,12 +14,14 @@ enum FileType {
|
|||
}
|
||||
|
||||
struct FilePermission {
|
||||
pub:
|
||||
read bool
|
||||
write bool
|
||||
execute bool
|
||||
}
|
||||
|
||||
struct FileMode {
|
||||
pub:
|
||||
typ FileType
|
||||
owner FilePermission
|
||||
group FilePermission
|
||||
|
|
|
@ -27,11 +27,12 @@ pub:
|
|||
module_path string
|
||||
mut:
|
||||
pref &pref.Preferences
|
||||
module_search_paths []string
|
||||
parsed_files []ast.File
|
||||
global_scope &ast.Scope
|
||||
out_name_c string
|
||||
out_name_js string
|
||||
pub mut:
|
||||
module_search_paths []string
|
||||
}
|
||||
|
||||
pub fn new_builder(pref &pref.Preferences) Builder {
|
||||
|
|
|
@ -1011,7 +1011,7 @@ pub fn (mut c Checker) selector_expr(selector_expr mut ast.SelectorExpr) table.T
|
|||
}
|
||||
if field := c.table.struct_find_field(typ_sym, field_name) {
|
||||
if typ_sym.mod != c.mod && !field.is_pub{
|
||||
c.warn('field `${typ_sym.name}.$field_name` is not public', selector_expr.pos)
|
||||
c.error('field `${typ_sym.name}.$field_name` is not public', selector_expr.pos)
|
||||
}
|
||||
return field.typ
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue