(&mut self)
| 572 | receiver.name == "self" |
| 573 | && matches!( |
| 574 | &receiver.ty, |
| 575 | Type::Pointer(inner) |
| 576 | if matches!(inner.as_ref(), Type::Named { name, .. } if name == "Self") |
| 577 | ) |
| 578 | }); |
| 579 | if !receiver_ok { |
| 580 | return Err(self.error("interface method's first parameter must be `self: Self*`")); |
| 581 | } |
| 582 | |
| 583 | methods.push(InterfaceMethod { |
| 584 | name: method_name, |
| 585 | params, |
| 586 | return_type, |
| 587 | }); |
| 588 | self.consume_terminators(); |
| 589 | } |
| 590 | |
| 591 | self.expect_rbrace()?; |
| 592 | Ok(DeclNode::Interface { name, methods }) |
| 593 | } |
| 594 | |
| 595 | // Parse an impl block; function members desugar to flat `Type_name` |
| 596 | // functions, `const`/`type` members become one `AssociatedItems` node. |
| 597 | fn parse_impl_block(&mut self, exported: bool) -> Result<Vec<Declaration>, ParserError> { |
no test coverage detected