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

Method optional_offset_imm64

cranelift/reader/src/parser.rs:830–841  ·  view source on GitHub ↗

Match and consume an optional offset32 immediate. Note that this will match an empty string as an empty offset, and that if an offset is present, it must contain a sign.

(&mut self)

Source from the content-addressed store, hash-verified

828 // Note that this will match an empty string as an empty offset, and that if an offset is
829 // present, it must contain a sign.
830 fn optional_offset_imm64(&mut self) -> ParseResult<Imm64> {
831 if let Some(Token::Integer(text)) = self.token() {
832 if text.starts_with('+') || text.starts_with('-') {
833 self.consume();
834 // Lexer just gives us raw text that looks like an integer.
835 // Parse it as an `Offset32` to check for overflow and other issues.
836 return text.parse().map_err(|e| self.error(e));
837 }
838 }
839 // If no explicit offset is present, the offset is 0.
840 Ok(Imm64::new(0))
841 }
842
843 // Match and consume an Ieee16 immediate.
844 fn match_ieee16(&mut self, err_msg: &str) -> ParseResult<Ieee16> {

Callers 1

Calls 6

OkFunction · 0.85
tokenMethod · 0.80
newFunction · 0.50
consumeMethod · 0.45
parseMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected