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

Method optional_memflags

cranelift/reader/src/parser.rs:902–925  ·  view source on GitHub ↗

Match and a consume a possibly empty sequence of memory operation flags.

(&mut self)

Source from the content-addressed store, hash-verified

900
901 // Match and a consume a possibly empty sequence of memory operation flags.
902 fn optional_memflags(&mut self) -> ParseResult<MemFlagsData> {
903 let mut flags = MemFlagsData::new();
904 loop {
905 match self.token() {
906 Some(Token::Identifier(text)) => match flags.set_by_name(text) {
907 Ok(true) => {
908 self.consume();
909 }
910 Ok(false) => break,
911 Err(msg) => return err!(self.loc, msg),
912 },
913 Some(Token::AliasRegion(n)) => {
914 if flags.alias_region().is_some() {
915 return err!(self.loc, "cannot set more than one alias region");
916 }
917 let region = ir::AliasRegion::new(n as usize);
918 flags.set_alias_region(Some(region));
919 self.consume();
920 }
921 _ => break,
922 }
923 }
924 Ok(flags)
925 }
926
927 // Match and consume an identifier.
928 fn match_any_identifier(&mut self, err_msg: &str) -> ParseResult<&'a str> {

Callers 2

parse_inst_operandsMethod · 0.80

Calls 8

OkFunction · 0.85
tokenMethod · 0.80
set_by_nameMethod · 0.80
set_alias_regionMethod · 0.80
newFunction · 0.50
consumeMethod · 0.45
is_someMethod · 0.45
alias_regionMethod · 0.45

Tested by

no test coverage detected