(&mut self)
| 1368 | let (fields, rest) = self.parse_struct_literal_fields()?; |
| 1369 | expr = Expression::Primary(PrimaryExpr::NamedStructLiteral { |
| 1370 | name, |
| 1371 | type_args, |
| 1372 | fields, |
| 1373 | rest, |
| 1374 | }); |
| 1375 | continue; |
| 1376 | } |
| 1377 | |
| 1378 | let type_arguments = self.try_parse_call_type_arguments(); |
| 1379 | |
| 1380 | if type_arguments.is_some() || self.match_lparen() { |
| 1381 | // A non-identifier callee (field access, index, deref) is an |
| 1382 | // indirect call through a function-pointer value. |
| 1383 | let name = match expr { |
| 1384 | Expression::Primary(PrimaryExpr::Identifier(name)) => name, |
| 1385 | Expression::Primary(PrimaryExpr::FieldAccess { expr: base, field }) if matches!(base.as_ref(), Expression::Primary(PrimaryExpr::Identifier(name)) if self.type_names.contains(name)) => |
| 1386 | { |
| 1387 | if type_arguments.is_some() { |
| 1388 | return Err(self.error( |
| 1389 | "type arguments on associated function calls are not supported", |
| 1390 | )); |
| 1391 | } |
| 1392 | let Expression::Primary(PrimaryExpr::Identifier(type_name)) = *base else { |
| 1393 | unreachable!(); |
| 1394 | }; |
| 1395 | let arguments = self.parse_argument_list_after_open_paren()?; |
| 1396 | expr = Expression::Primary(PrimaryExpr::FunctionCall { |
| 1397 | name: format!("{type_name}_{field}"), |
| 1398 | type_arguments: Vec::new(), |
| 1399 | arguments, |
| 1400 | }); |
| 1401 | continue; |
| 1402 | } |
| 1403 | // `alias.member<T>(...)`: a qualified generic call. The dotted name |
| 1404 | // resolves against the module alias table before monomorphization. |
| 1405 | Expression::Primary(PrimaryExpr::FieldAccess { expr: base, field }) |
| 1406 | if type_arguments.is_some() |
| 1407 | && matches!( |
| 1408 | base.as_ref(), |
| 1409 | Expression::Primary(PrimaryExpr::Identifier(_)) |
| 1410 | ) => |
no test coverage detected