MCPcopy Create free account
hub / github.com/diem/move / new

Method new

language/tools/move-bytecode-viewer/src/bytecode_viewer.rs:30–49  ·  view source on GitHub ↗
(source_map: SourceMap, module: &'a CompiledModule)

Source from the content-addressed store, hash-verified

28
29impl<'a> BytecodeViewer<'a> {
30 pub fn new(source_map: SourceMap, module: &'a CompiledModule) -> Self {
31 let view = BinaryIndexedView::Module(module);
32 let source_mapping = SourceMapping::new(source_map, view);
33 let options = DisassemblerOptions {
34 print_code: true,
35 print_basic_blocks: true,
36 ..Default::default()
37 };
38 let disassembled_string = Disassembler::new(source_mapping, options)
39 .disassemble()
40 .unwrap();
41
42 let mut base_viewer = Self {
43 lines: disassembled_string.lines().map(|x| x.to_string()).collect(),
44 line_map: HashMap::new(),
45 view,
46 };
47 base_viewer.build_mapping();
48 base_viewer
49 }
50
51 fn build_mapping(&mut self) {
52 let regex = Regex::new(r"^(\d+):.*").unwrap();

Callers

nothing calls this directly

Calls 5

to_stringMethod · 0.80
build_mappingMethod · 0.80
ModuleClass · 0.50
disassembleMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected