(&mut self)
| 668 | name: format!("{type_name}_{name}"), |
| 669 | generics: merged_generics, |
| 670 | bounds: merged_bounds, |
| 671 | params, |
| 672 | return_type, |
| 673 | body, |
| 674 | is_extern: false, |
| 675 | is_import_interface: false, |
| 676 | }, |
| 677 | exported, |
| 678 | }); |
| 679 | self.consume_terminators(); |
| 680 | } |
| 681 | |
| 682 | self.expect_rbrace()?; |
| 683 | if !consts.is_empty() || !aliases.is_empty() { |
| 684 | if exported { |
| 685 | return Err(self.error( |
| 686 | "associated constants and type aliases cannot be exported; keep the impl private", |
| 687 | )); |
| 688 | } |
| 689 | methods.push(Declaration { |
| 690 | decl: DeclNode::AssociatedItems { |
| 691 | owner: type_name, |
| 692 | generics: owner_generics, |
| 693 | consts, |
| 694 | aliases, |
| 695 | }, |
| 696 | exported: false, |
| 697 | }); |
| 698 | } |
| 699 | Ok(methods) |
| 700 | } |
| 701 | |
| 702 | fn parse_param_list(&mut self) -> Result<Vec<Parameter>, ParserError> { |
| 703 | self.expect_lparen()?; |
| 704 | let mut params = Vec::new(); |
| 705 | |
| 706 | if self.match_rparen() { |
| 707 | return Ok(params); |
| 708 | } |
| 709 | |
| 710 | loop { |
| 711 | let name = self.expect_ident()?; |
| 712 | self.expect_colon()?; |
| 713 | let ty = self.parse_type()?; |
| 714 | params.push(Parameter { name, ty }); |
| 715 | |
| 716 | if self.match_comma() { |
| 717 | if self.check_rparen() { |
| 718 | break; |
no test coverage detected