MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / parse_generic_params

Method parse_generic_params

crates/hll-to-ir/src/parser.rs:1370–1407  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

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 ) =>

Callers 4

parse_declarationMethod · 0.80
parse_struct_declMethod · 0.80
parse_enum_declMethod · 0.80
parse_function_declMethod · 0.80

Calls 8

match_ltMethod · 0.80
check_gt_or_shrMethod · 0.80
pushMethod · 0.80
expect_identMethod · 0.80
match_commaMethod · 0.80
match_gtMethod · 0.80
advanceMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected