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

Method parse_run_invocation

cranelift/reader/src/parser.rs:2551–2574  ·  view source on GitHub ↗

Parse the invocation of a CLIF function. This is different from parsing a CLIF `call`; it is used in parsing run commands like `run: %fn(42, 4.2) == false`. invocation ::= name "(" [data-value-list] ")"

(&mut self, sig: &Signature)

Source from the content-addressed store, hash-verified

2549 ///
2550 /// invocation ::= name "(" [data-value-list] ")"
2551 fn parse_run_invocation(&mut self, sig: &Signature) -> ParseResult<Invocation> {
2552 if let Some(Token::Name(name)) = self.token() {
2553 self.consume();
2554 self.match_token(
2555 Token::LPar,
2556 "expected invocation parentheses, e.g. %fn(...)",
2557 )?;
2558
2559 let arg_types = sig
2560 .params
2561 .iter()
2562 .map(|abi| abi.value_type)
2563 .collect::<Vec<_>>();
2564 let args = self.parse_data_value_list(&arg_types)?;
2565
2566 self.match_token(
2567 Token::RPar,
2568 "expected invocation parentheses, e.g. %fn(...)",
2569 )?;
2570 Ok(Invocation::new(name, args))
2571 } else {
2572 Err(self.error("expected a function name, e.g. %my_fn"))
2573 }
2574 }
2575
2576 /// Parse a comparison operator for run commands.
2577 ///

Callers 1

parse_run_commandMethod · 0.80

Calls 9

OkFunction · 0.85
tokenMethod · 0.80
match_tokenMethod · 0.80
parse_data_value_listMethod · 0.80
newFunction · 0.50
consumeMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected