From 343dced36d718579c009aeafb1d79a1f107e58da Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sun, 13 Oct 2019 09:19:32 +1100 Subject: [PATCH] parser: only check visibility of init function not method --- compiler/fn.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/fn.v b/compiler/fn.v index a4c5bf4d78..b4d820429f 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -223,7 +223,7 @@ fn (p mut Parser) fn_decl() { } f.fn_name_token_idx = p.cur_tok_index() // 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') } // C function header def? (fn C.NSMakeRect(int,int,int,int))