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

Method parse_cranelift_features

cranelift/reader/src/parser.rs:1179–1197  ·  view source on GitHub ↗

Parse a list of expected features that Cranelift should be compiled with, or without.

(&mut self)

Source from the content-addressed store, hash-verified

1177
1178 /// Parse a list of expected features that Cranelift should be compiled with, or without.
1179 pub fn parse_cranelift_features(&mut self) -> ParseResult<Vec<Feature<'a>>> {
1180 let mut list = Vec::new();
1181 while self.token() == Some(Token::Identifier("feature")) {
1182 self.consume();
1183 let has = !self.optional(Token::Bang);
1184 match (self.token(), has) {
1185 (Some(Token::String(flag)), true) => list.push(Feature::With(flag)),
1186 (Some(Token::String(flag)), false) => list.push(Feature::Without(flag)),
1187 (tok, _) => {
1188 return err!(
1189 self.loc,
1190 format!("Expected feature flag string, got {:?}", tok)
1191 );
1192 }
1193 }
1194 self.consume();
1195 }
1196 Ok(list)
1197 }
1198
1199 /// Parse a list of function definitions.
1200 ///

Callers 1

parse_testFunction · 0.80

Calls 6

OkFunction · 0.85
tokenMethod · 0.80
optionalMethod · 0.80
newFunction · 0.50
consumeMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected