fn disassemble_sig_tok(
        &self,
        sig_tok: SignatureToken,
        type_param_context: &[SourceName<Location>],
    ) -> Result<String> {
        Ok(match sig_tok {
            SignatureToken::Bool => "bool".to_string(),
            SignatureToken::U64 => "u64".to_string(),
            SignatureToken::String => "string".to_string(),
            SignatureToken::ByteArray => "bytearray".to_string(),
            SignatureToken::Address => "address".to_string(),
            SignatureToken::Struct(struct_handle_idx, _) => self
                .source_mapper
                .bytecode
                .identifier_at(
                    self.source_mapper
                        .bytecode
                        .struct_handle_at(struct_handle_idx)
                        .name,
                )
                .to_string(),
            SignatureToken::Reference(sig_tok) => format!(
                "&{}",
                self.disassemble_sig_tok(*sig_tok, type_param_context)?
            ),
            SignatureToken::MutableReference(sig_tok) => format!(
                "&mut {}",
                self.disassemble_sig_tok(*sig_tok, type_param_context)?
            ),
            SignatureToken::TypeParameter(ty_param_index) => type_param_context
                .get(ty_param_index as usize)
                .ok_or_else(|| {
                    format_err!(
                        "Type parameter index out of bounds while disassembling type signature"
                    )
                })?
                .0
                .to_string(),
        })
    }
// These need to be in the context of a function or a struct definition since type parameters
// can refer to function/struct type parameters.
These need to be in the context of a function or a struct definition since type parameters
can refer to function/struct type parameters.
These need to be in the context of a function or a struct definition since type parameters can refer to function / struct type parameters .
fn disassemble_sig_tok(
        &self,
        sig_tok: SignatureToken,
        type_param_context: &[SourceName<Location>],
    ) -> Result<String> {
        Ok(match sig_tok {
            SignatureToken::Bool => "bool".to_string(),
            SignatureToken::U64 => "u64".to_string(),
            SignatureToken::String => "string".to_string(),
            SignatureToken::ByteArray => "bytearray".to_string(),
            SignatureToken::Address => "address".to_string(),
            SignatureToken::Struct(struct_handle_idx, _) => self
                .source_mapper
                .bytecode
                .identifier_at(
                    self.source_mapper
                        .bytecode
                        .struct_handle_at(struct_handle_idx)
                        .name,
                )
                .to_string(),
            SignatureToken::Reference(sig_tok) => format!(
                "&{}",
                self.disassemble_sig_tok(*sig_tok, type_param_context)?
            ),
            SignatureToken::MutableReference(sig_tok) => format!(
                "&mut {}",
                self.disassemble_sig_tok(*sig_tok, type_param_context)?
            ),
            SignatureToken::TypeParameter(ty_param_index) => type_param_context
                .get(ty_param_index as usize)
                .ok_or_else(|| {
                    format_err!(
                        "Type parameter index out of bounds while disassembling type signature"
                    )
                })?
                .0
                .to_string(),
        })
    }
fn disassemble_sig_tok ( & self , sig_tok : SignatureToken , type_param_context : & [ SourceName < Location > ] , ) -> Result < String > { Ok ( match sig_tok { SignatureToken :: Bool => " " . to_string ( ) , SignatureToken :: U64 => " " . to_string ( ) , SignatureToken :: String => " " . to_string ( ) , SignatureToken :: ByteArray => " " . to_string ( ) , SignatureToken :: Address => " " . to_string ( ) , SignatureToken :: Struct ( struct_handle_idx , _ ) => self . source_mapper . bytecode . identifier_at ( self . source_mapper . bytecode . struct_handle_at ( struct_handle_idx ) . name , ) . to_string ( ) , SignatureToken :: Reference ( sig_tok ) => format ! ( " " self disassemble_sig_tok ( sig_tok type_param_context ) ) , SignatureToken :: MutableReference ( sig_tok ) => format ! ( " " self disassemble_sig_tok ( sig_tok type_param_context ) ) , SignatureToken :: TypeParameter ( ty_param_index ) => type_param_context . get ( ty_param_index as usize ) . ok_or_else ( | | { format_err ! ( " " ) } ) ? . 0 . to_string ( ) , } ) }
These need to be in the context of a function or a struct definition since type parameters
can refer to function/struct type parameters.
These need to be in the context of a function or a struct definition since type parameters can refer to function / struct type parameters .
&self
sig_tok
SignatureToken
type_param_context
&[SourceName<Location>]
&self
sig_tok
SignatureToken
type_param_context
&[SourceName<Location>]