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

Method from_unit

language/tools/move-disassembler/src/disassembler.rs:84–98  ·  view source on GitHub ↗
(unit: &'a CompiledUnit)

Source from the content-addressed store, hash-verified

82 }
83
84 pub fn from_unit(unit: &'a CompiledUnit) -> Self {
85 let options = DisassemblerOptions::new();
86 let source_map = unit.source_map().clone();
87 let index_view = match unit {
88 CompiledUnit::Module(NamedCompiledModule { module, .. }) => {
89 BinaryIndexedView::Module(module)
90 }
91 CompiledUnit::Script(NamedCompiledScript { script, .. }) => {
92 BinaryIndexedView::Script(script)
93 }
94 };
95
96 let source_mapping = SourceMapping::new(source_map, index_view);
97 Disassembler::new(source_mapping, options)
98 }
99
100 pub fn add_coverage_map(&mut self, coverage_map: ExecCoverageMap) {
101 self.coverage_map = Some(coverage_map);

Callers

nothing calls this directly

Calls 4

source_mapMethod · 0.80
ModuleClass · 0.50
ScriptClass · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected