MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / parse_abi_param

Method parse_abi_param

cranelift/reader/src/parser.rs:1429–1458  ·  view source on GitHub ↗

Parse a single argument type with flags.

(&mut self)

Source from the content-addressed store, hash-verified

1427
1428 // Parse a single argument type with flags.
1429 fn parse_abi_param(&mut self) -> ParseResult<AbiParam> {
1430 // abi-param ::= * type { flag }
1431 let mut arg = AbiParam::new(self.match_type("expected parameter type")?);
1432
1433 // abi-param ::= type * { flag }
1434 while let Some(Token::Identifier(s)) = self.token() {
1435 match s {
1436 "uext" => arg.extension = ArgumentExtension::Uext,
1437 "sext" => arg.extension = ArgumentExtension::Sext,
1438 "sarg" => {
1439 self.consume();
1440 self.match_token(Token::LPar, "expected '(' to begin sarg size")?;
1441 let size = self.match_uimm32("expected byte-size in sarg decl")?;
1442 self.match_token(Token::RPar, "expected ')' to end sarg size")?;
1443 arg.purpose = ArgumentPurpose::StructArgument(size.into());
1444 continue;
1445 }
1446 _ => {
1447 if let Ok(purpose) = s.parse() {
1448 arg.purpose = purpose;
1449 } else {
1450 break;
1451 }
1452 }
1453 }
1454 self.consume();
1455 }
1456
1457 Ok(arg)
1458 }
1459
1460 // Parse the function preamble.
1461 //

Callers 2

parse_abi_param_listMethod · 0.80
argument_typeFunction · 0.80

Calls 8

OkFunction · 0.85
match_typeMethod · 0.80
tokenMethod · 0.80
match_tokenMethod · 0.80
match_uimm32Method · 0.80
newFunction · 0.50
consumeMethod · 0.45
parseMethod · 0.45

Tested by 1

argument_typeFunction · 0.64