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