()
| 2680 | let expr = sub.parse_expression()?; |
| 2681 | if !matches!(sub.peek(), Some(Token::Eof) | None) { |
| 2682 | return Err(sub.error("unexpected trailing tokens in format string interpolation")); |
| 2683 | } |
| 2684 | self.next_lambda_id = sub.next_lambda_id; |
| 2685 | self.synthesized_declarations |
| 2686 | .append(&mut sub.synthesized_declarations); |
| 2687 | Ok(expr) |
| 2688 | } |
| 2689 | |
| 2690 | fn parse_lambda_expression(&mut self) -> Result<Expression, ParserError> { |
| 2691 | let params = self.parse_param_list()?; |
| 2692 | let return_type = if self.match_arrow() { |
| 2693 | Some(self.parse_return_type()?) |
| 2694 | } else { |
| 2695 | None |
| 2696 | }; |
| 2697 | if !self.check_lbrace() { |
| 2698 | return Err(self.error("expected lambda body block")); |
| 2699 | } |
| 2700 | let body = self.parse_block()?; |
| 2701 | let name = format!("__hll_lambda_{}", self.next_lambda_id); |
| 2702 | self.next_lambda_id += 1; |
| 2703 | self.synthesized_declarations.push(Declaration { |
| 2704 | exported: false, |
| 2705 | decl: DeclNode::Function { |
| 2706 | name: name.clone(), |
| 2707 | generics: Vec::new(), |
| 2708 | bounds: Vec::new(), |
| 2709 | params, |
| 2710 | return_type, |
| 2711 | body: Some(body), |
| 2712 | is_extern: false, |
| 2713 | is_import_interface: false, |
nothing calls this directly
no test coverage detected