(&mut self)
| 692 | } |
| 693 | |
| 694 | fn method_declaration(&mut self) -> Option<Stmt<'gc>> { |
| 695 | let method_vis = if self.match_token(TokenType::Pub) { |
| 696 | Visibility::Public |
| 697 | } else { |
| 698 | Visibility::Private |
| 699 | }; |
| 700 | let method = if self.match_token(TokenType::AI) { |
| 701 | self.consume(TokenType::Fn, "Expect 'fn' after 'ai'."); |
| 702 | self.func_declaration( |
| 703 | FunctionType::Method { |
| 704 | is_ai: true, |
| 705 | is_static: false, |
| 706 | }, |
| 707 | method_vis, |
| 708 | )? |
| 709 | } else if self.match_token(TokenType::Fn) { |
| 710 | self.func_declaration( |
| 711 | FunctionType::Method { |
| 712 | is_ai: false, |
| 713 | is_static: false, |
| 714 | }, |
| 715 | method_vis, |
| 716 | )? |
| 717 | } else { |
| 718 | self.error_at_current("Expect 'fn' or 'ai fn' modifier for method."); |
| 719 | return None; |
| 720 | }; |
| 721 | Some(method) |
| 722 | } |
| 723 | |
| 724 | fn func_declaration( |
| 725 | &mut self, |
no test coverage detected