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

Function gen_bool_accessor

cranelift/codegen/meta/src/gen_inst.rs:578–597  ·  view source on GitHub ↗
(
    all_inst: &AllInstructions,
    get_attr: T,
    name: &'static str,
    doc: &'static str,
    fmt: &mut Formatter,
)

Source from the content-addressed store, hash-verified

576}
577
578fn gen_bool_accessor<T: Fn(&Instruction) -> bool>(
579 all_inst: &AllInstructions,
580 get_attr: T,
581 name: &'static str,
582 doc: &'static str,
583 fmt: &mut Formatter,
584) {
585 fmt.doc_comment(doc);
586 fmt.add_block(&format!("pub fn {name}(self) -> bool"), |fmt| {
587 let mut m = Match::new("self");
588 for inst in all_inst.iter() {
589 if get_attr(inst) {
590 m.arm_no_fields(format!("Self::{}", inst.camel_name), "true");
591 }
592 }
593 m.arm_no_fields("_", "false");
594 fmt.add_match(m);
595 });
596 fmt.empty_line();
597}
598
599fn gen_opcodes(all_inst: &AllInstructions, fmt: &mut Formatter) {
600 fmt.doc_comment(

Callers 1

gen_opcodesFunction · 0.85

Calls 7

doc_commentMethod · 0.80
arm_no_fieldsMethod · 0.80
add_matchMethod · 0.80
empty_lineMethod · 0.80
newFunction · 0.50
add_blockMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected