(&mut self)
| 363 | loop { |
| 364 | // A virtual `>` still belongs to the enclosing generic type. Suffixes |
| 365 | // after `>>` therefore apply only after that outer close is consumed. |
| 366 | if self.pending_gt_from_shr { |
| 367 | break; |
| 368 | } |
| 369 | |
| 370 | if self.match_star() { |
| 371 | ty = Type::Pointer(Box::new(ty)); |
| 372 | continue; |
| 373 | } |
| 374 | |
| 375 | if self.match_lbracket() { |
| 376 | // T[] is a slice; T[N] is a fixed array. |
| 377 | if self.match_rbracket() { |
| 378 | ty = Type::Slice(Box::new(ty)); |
| 379 | continue; |
| 380 | } |
| 381 | let size = self.parse_array_length()?; |
| 382 | self.expect_rbracket()?; |
| 383 | ty = Type::Array(size, Box::new(ty)); |
| 384 | continue; |
| 385 | } |
| 386 | |
| 387 | break; |
| 388 | } |
| 389 | |
| 390 | Ok(ty) |
| 391 | } |
| 392 | |
| 393 | fn parse_variable_decl(&mut self) -> Result<DeclNode, ParserError> { |
| 394 | let name = self.expect_ident()?; |
| 395 | self.expect_colon()?; |
| 396 | let ty = self.parse_type()?; |
| 397 | let init = if self.match_assign() { |
| 398 | Some(self.parse_expression()?) |
| 399 | } else { |
| 400 | return Err(self |
no test coverage detected