Struct bytecode_source_map::source_map::SourceMap
source · pub struct SourceMap {
pub module_name_opt: Option<(AccountAddress, Identifier)>,
pub constant_map: BTreeMap<ConstantName, TableIndex>,
/* private fields */
}
Fields§
§module_name_opt: Option<(AccountAddress, Identifier)>
The name <address.module_name> for module that this source map is for None if it is a script
constant_map: BTreeMap<ConstantName, TableIndex>
Implementations§
source§impl SourceMap
impl SourceMap
pub fn new(module_name_opt: Option<ModuleIdent>) -> Self
pub fn add_top_level_function_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, location: Loc ) -> Result<()>
pub fn add_function_type_parameter_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, name: SourceName ) -> Result<()>
pub fn get_function_type_parameter_name( &self, fdef_idx: FunctionDefinitionIndex, type_parameter_idx: usize ) -> Result<SourceName>
pub fn add_code_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, start_offset: CodeOffset, location: Loc ) -> Result<()>
pub fn add_nop_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, label: NopLabel, start_offset: CodeOffset ) -> Result<()>
sourcepub fn get_code_location(
&self,
fdef_idx: FunctionDefinitionIndex,
offset: CodeOffset
) -> Result<Loc>
pub fn get_code_location( &self, fdef_idx: FunctionDefinitionIndex, offset: CodeOffset ) -> Result<Loc>
Given a function definition and a code offset within that function definition, this returns the location in the source code associated with the instruction at that offset.
pub fn add_local_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, name: SourceName ) -> Result<()>
pub fn add_parameter_mapping( &mut self, fdef_idx: FunctionDefinitionIndex, name: SourceName ) -> Result<()>
pub fn get_parameter_or_local_name( &self, fdef_idx: FunctionDefinitionIndex, index: u64 ) -> Result<SourceName>
pub fn add_top_level_struct_mapping( &mut self, struct_def_idx: StructDefinitionIndex, location: Loc ) -> Result<()>
pub fn add_const_mapping( &mut self, const_idx: ConstantPoolIndex, name: ConstantName ) -> Result<()>
pub fn add_struct_field_mapping( &mut self, struct_def_idx: StructDefinitionIndex, location: Loc ) -> Result<()>
pub fn get_struct_field_name( &self, struct_def_idx: StructDefinitionIndex, field_idx: MemberCount ) -> Option<Loc>
pub fn add_struct_type_parameter_mapping( &mut self, struct_def_idx: StructDefinitionIndex, name: SourceName ) -> Result<()>
pub fn get_struct_type_parameter_name( &self, struct_def_idx: StructDefinitionIndex, type_parameter_idx: usize ) -> Result<SourceName>
pub fn get_function_source_map( &self, fdef_idx: FunctionDefinitionIndex ) -> Result<&FunctionSourceMap>
pub fn get_struct_source_map( &self, struct_def_idx: StructDefinitionIndex ) -> Result<&StructSourceMap>
sourcepub fn dummy_from_view(
view: &BinaryIndexedView<'_>,
default_loc: Loc
) -> Result<Self>
pub fn dummy_from_view( view: &BinaryIndexedView<'_>, default_loc: Loc ) -> Result<Self>
Create a ‘dummy’ source map for a compiled module or script. This is useful for e.g. disassembling with generated or real names depending upon if the source map is available or not.
Trait Implementations§
source§impl<'de> Deserialize<'de> for SourceMap
impl<'de> Deserialize<'de> for SourceMap
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more