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

Method optional

cranelift/reader/src/parser.rs:543–550  ·  view source on GitHub ↗

If the next token is a `want`, consume it, otherwise do nothing.

(&mut self, want: Token<'a>)

Source from the content-addressed store, hash-verified

541
542 // If the next token is a `want`, consume it, otherwise do nothing.
543 fn optional(&mut self, want: Token<'a>) -> bool {
544 if self.token() == Some(want) {
545 self.consume();
546 true
547 } else {
548 false
549 }
550 }
551
552 // Match and consume a specific identifier string.
553 // Used for pseudo-keywords like "stack_slot" that only appear in certain contexts.

Callers 15

match_uimm128Method · 0.80
optional_debug_tagsMethod · 0.80
parse_signatureMethod · 0.80
parse_abi_param_listMethod · 0.80
parse_function_declMethod · 0.80
parse_basic_blockMethod · 0.80
parse_block_paramsMethod · 0.80
parse_inst_resultsMethod · 0.80
parse_instructionMethod · 0.80
parse_value_listMethod · 0.80

Calls 2

tokenMethod · 0.80
consumeMethod · 0.45

Tested by

no test coverage detected