parser: only check visibility of init function not method

pull/2318/head
joe-conigliaro 2019-10-13 09:19:32 +11:00 committed by Alexander Medvednikov
parent bf21108fdb
commit 343dced36d
1 changed files with 1 additions and 1 deletions

View File

@ -223,7 +223,7 @@ fn (p mut Parser) fn_decl() {
} }
f.fn_name_token_idx = p.cur_tok_index() f.fn_name_token_idx = p.cur_tok_index()
// init fn // init fn
if f.name == 'init' && f.is_public { if f.name == 'init' && !f.is_method && f.is_public {
p.error('init function cannot be public') p.error('init function cannot be public')
} }
// C function header def? (fn C.NSMakeRect(int,int,int,int)) // C function header def? (fn C.NSMakeRect(int,int,int,int))