Struct move_model::model::ModuleEnv
source · pub struct ModuleEnv<'env> {
pub env: &'env GlobalEnv,
/* private fields */
}
Expand description
Represents a module environment.
Fields§
§env: &'env GlobalEnv
Reference to the outer env.
Implementations§
source§impl<'env> ModuleEnv<'env>
impl<'env> ModuleEnv<'env>
sourcepub fn get_name(&'env self) -> &'env ModuleName
pub fn get_name(&'env self) -> &'env ModuleName
Returns the name of this module.
sourcepub fn matches_name(&self, name: &str) -> bool
pub fn matches_name(&self, name: &str) -> bool
Returns true if either the full name or simple name of this module matches the given string
sourcepub fn get_full_name_str(&self) -> String
pub fn get_full_name_str(&self) -> String
Returns full name as a string.
sourcepub fn get_identifier(&'env self) -> Identifier
pub fn get_identifier(&'env self) -> Identifier
Returns the VM identifier for this module
sourcepub fn is_script_module(&self) -> bool
pub fn is_script_module(&self) -> bool
Returns true if this is a module representing a script.
sourcepub fn is_target(&self) -> bool
pub fn is_target(&self) -> bool
Returns true of this module is target of compilation. A non-target module is a dependency only but not explicitly requested to process.
sourcepub fn get_source_path(&self) -> &OsStr
pub fn get_source_path(&self) -> &OsStr
Returns the path to source file of this module.
sourcepub fn get_dependencies(&self) -> Vec<ModuleId> ⓘ
pub fn get_dependencies(&self) -> Vec<ModuleId> ⓘ
Return the set of language storage ModuleId’s that this module’s bytecode depends on (including itself), friend modules are excluded from the return result.
sourcepub fn get_friends(&self) -> Vec<ModuleId> ⓘ
pub fn get_friends(&self) -> Vec<ModuleId> ⓘ
Return the set of language storage ModuleId’s that this module declares as friends
sourcepub fn get_using_modules(&self, include_specs: bool) -> BTreeSet<ModuleId>
pub fn get_using_modules(&self, include_specs: bool) -> BTreeSet<ModuleId>
Returns the set of modules that use this one.
sourcepub fn get_used_modules(&self, include_specs: bool) -> BTreeSet<ModuleId>
pub fn get_used_modules(&self, include_specs: bool) -> BTreeSet<ModuleId>
Returns the set of modules this one uses.
sourcepub fn get_friend_modules(&self) -> BTreeSet<ModuleId>
pub fn get_friend_modules(&self) -> BTreeSet<ModuleId>
Returns the set of modules this one declares as friends.
sourcepub fn is_transitive_dependency(&self, module_id: ModuleId) -> bool
pub fn is_transitive_dependency(&self, module_id: ModuleId) -> bool
Returns true if the given module is a transitive dependency of this one. The transitive dependency set contains this module and all directly or indirectly used modules (without spec usage).
sourcepub fn get_spec_block_infos(&self) -> &[SpecBlockInfo]
pub fn get_spec_block_infos(&self) -> &[SpecBlockInfo]
Returns spec block documentation infos.
sourcepub fn symbol_pool(&self) -> &SymbolPool
pub fn symbol_pool(&self) -> &SymbolPool
Shortcut for accessing the symbol pool.
sourcepub fn get_verified_module(&'env self) -> &'env CompiledModule
pub fn get_verified_module(&'env self) -> &'env CompiledModule
Gets the underlying bytecode module.
sourcepub fn find_named_constant(
&'env self,
name: Symbol
) -> Option<NamedConstantEnv<'env>>
pub fn find_named_constant( &'env self, name: Symbol ) -> Option<NamedConstantEnv<'env>>
Gets a NamedConstantEnv
in this module by name
sourcepub fn get_named_constant(
&'env self,
id: NamedConstantId
) -> NamedConstantEnv<'env>
pub fn get_named_constant( &'env self, id: NamedConstantId ) -> NamedConstantEnv<'env>
Gets a NamedConstantEnv
in this module by the constant’s id
sourcepub fn into_named_constant(self, id: NamedConstantId) -> NamedConstantEnv<'env>
pub fn into_named_constant(self, id: NamedConstantId) -> NamedConstantEnv<'env>
Gets a NamedConstantEnv
by id
sourcepub fn get_named_constant_count(&self) -> usize
pub fn get_named_constant_count(&self) -> usize
Gets the number of named constants in this module.
sourcepub fn get_named_constants(
&'env self
) -> impl Iterator<Item = NamedConstantEnv<'env>>
pub fn get_named_constants( &'env self ) -> impl Iterator<Item = NamedConstantEnv<'env>>
Returns iterator over NamedConstantEnv
s in this module.
sourcepub fn into_named_constants(
self
) -> impl Iterator<Item = NamedConstantEnv<'env>>
pub fn into_named_constants( self ) -> impl Iterator<Item = NamedConstantEnv<'env>>
Returns an iterator over NamedConstantEnv
s in this module.
sourcepub fn find_function(&self, name: Symbol) -> Option<FunctionEnv<'env>>
pub fn find_function(&self, name: Symbol) -> Option<FunctionEnv<'env>>
Gets a FunctionEnv in this module by name.
sourcepub fn get_function(&'env self, id: FunId) -> FunctionEnv<'env>
pub fn get_function(&'env self, id: FunId) -> FunctionEnv<'env>
Gets a FunctionEnv by id.
sourcepub fn into_function(self, id: FunId) -> FunctionEnv<'env>
pub fn into_function(self, id: FunId) -> FunctionEnv<'env>
Gets a FunctionEnv by id.
sourcepub fn get_function_count(&self) -> usize
pub fn get_function_count(&self) -> usize
Gets the number of functions in this module.
sourcepub fn get_functions(&'env self) -> impl Iterator<Item = FunctionEnv<'env>>
pub fn get_functions(&'env self) -> impl Iterator<Item = FunctionEnv<'env>>
Returns iterator over FunctionEnvs in this module.
sourcepub fn into_functions(self) -> impl Iterator<Item = FunctionEnv<'env>>
pub fn into_functions(self) -> impl Iterator<Item = FunctionEnv<'env>>
Returns iterator over FunctionEnvs in this module.
sourcepub fn get_used_function(&self, idx: FunctionHandleIndex) -> FunctionEnv<'_>
pub fn get_used_function(&self, idx: FunctionHandleIndex) -> FunctionEnv<'_>
Gets FunctionEnv for a function used in this module, via the FunctionHandleIndex. The returned function might be from this or another module.
sourcepub fn try_get_function_id(&self, idx: FunctionDefinitionIndex) -> Option<FunId>
pub fn try_get_function_id(&self, idx: FunctionDefinitionIndex) -> Option<FunId>
Gets the function id from a definition index.
sourcepub fn get_function_def_idx(&self, fun_id: FunId) -> FunctionDefinitionIndex
pub fn get_function_def_idx(&self, fun_id: FunId) -> FunctionDefinitionIndex
Gets the function definition index for the given function id. This is always defined.
sourcepub fn find_struct(&self, name: Symbol) -> Option<StructEnv<'_>>
pub fn find_struct(&self, name: Symbol) -> Option<StructEnv<'_>>
Gets a StructEnv in this module by name.
sourcepub fn find_struct_by_identifier(
&self,
identifier: Identifier
) -> Option<StructId>
pub fn find_struct_by_identifier( &self, identifier: Identifier ) -> Option<StructId>
Gets a StructEnv in this module by identifier
sourcepub fn get_struct_id(&self, idx: StructDefinitionIndex) -> StructId
pub fn get_struct_id(&self, idx: StructDefinitionIndex) -> StructId
Gets the struct id from a definition index which must be valid for this environment.
sourcepub fn get_struct(&self, id: StructId) -> StructEnv<'_>
pub fn get_struct(&self, id: StructId) -> StructEnv<'_>
Gets a StructEnv by id.
pub fn get_struct_by_def_idx(&self, idx: StructDefinitionIndex) -> StructEnv<'_>
sourcepub fn into_struct(self, id: StructId) -> StructEnv<'env>
pub fn into_struct(self, id: StructId) -> StructEnv<'env>
Gets a StructEnv by id, consuming this module env.
sourcepub fn get_struct_count(&self) -> usize
pub fn get_struct_count(&self) -> usize
Gets the number of structs in this module.
sourcepub fn get_structs(&'env self) -> impl Iterator<Item = StructEnv<'env>>
pub fn get_structs(&'env self) -> impl Iterator<Item = StructEnv<'env>>
Returns iterator over structs in this module.
sourcepub fn into_structs(self) -> impl Iterator<Item = StructEnv<'env>>
pub fn into_structs(self) -> impl Iterator<Item = StructEnv<'env>>
Returns iterator over structs in this module.
sourcepub fn globalize_signature(&self, sig: &SignatureToken) -> Type
pub fn globalize_signature(&self, sig: &SignatureToken) -> Type
Globalizes a signature local to this module.
sourcepub fn globalize_signatures(&self, sigs: &[SignatureToken]) -> Vec<Type> ⓘ
pub fn globalize_signatures(&self, sigs: &[SignatureToken]) -> Vec<Type> ⓘ
Globalizes a list of signatures.
sourcepub fn get_type_actuals(&self, idx: Option<SignatureIndex>) -> Vec<Type> ⓘ
pub fn get_type_actuals(&self, idx: Option<SignatureIndex>) -> Vec<Type> ⓘ
Gets a list of type actuals associated with the index in the bytecode.
sourcepub fn get_constant(&self, idx: ConstantPoolIndex) -> &VMConstant
pub fn get_constant(&self, idx: ConstantPoolIndex) -> &VMConstant
Retrieve a constant from the pool
sourcepub fn get_constant_value(&self, constant: &VMConstant) -> MoveValue
pub fn get_constant_value(&self, constant: &VMConstant) -> MoveValue
Converts a constant to the specified type. The type must correspond to the expected
cannonical representation as defined in move_core_types::values
sourcepub fn self_address(&self) -> &AccountAddress
pub fn self_address(&self) -> &AccountAddress
Return the AccountAdress
of this module
sourcepub fn get_address_identifier(&self, idx: AddressIdentifierIndex) -> BigUint
pub fn get_address_identifier(&self, idx: AddressIdentifierIndex) -> BigUint
Retrieve an address identifier from the pool
sourcepub fn get_spec_vars(
&'env self
) -> impl Iterator<Item = (&'env SpecVarId, &'env SpecVarDecl)>
pub fn get_spec_vars( &'env self ) -> impl Iterator<Item = (&'env SpecVarId, &'env SpecVarDecl)>
Returns specification variables of this module.
sourcepub fn get_spec_var(&self, id: SpecVarId) -> &SpecVarDecl
pub fn get_spec_var(&self, id: SpecVarId) -> &SpecVarDecl
Gets spec var by id.
sourcepub fn find_spec_var(&self, name: Symbol) -> Option<&SpecVarDecl>
pub fn find_spec_var(&self, name: Symbol) -> Option<&SpecVarDecl>
Find spec var by name.
sourcepub fn get_spec_funs(
&'env self
) -> impl Iterator<Item = (&'env SpecFunId, &'env SpecFunDecl)>
pub fn get_spec_funs( &'env self ) -> impl Iterator<Item = (&'env SpecFunId, &'env SpecFunDecl)>
Returns specification functions of this module.
sourcepub fn get_spec_fun(&self, id: SpecFunId) -> &SpecFunDecl
pub fn get_spec_fun(&self, id: SpecFunId) -> &SpecFunDecl
Gets spec fun by id.
sourcepub fn spec_fun_is_used(&self, spec_fun_id: SpecFunId) -> bool
pub fn spec_fun_is_used(&self, spec_fun_id: SpecFunId) -> bool
Returns whether a spec fun is ever called or not.
sourcepub fn get_spec_funs_of_name(
&self,
name: Symbol
) -> impl Iterator<Item = (&'env SpecFunId, &'env SpecFunDecl)>
pub fn get_spec_funs_of_name( &self, name: Symbol ) -> impl Iterator<Item = (&'env SpecFunId, &'env SpecFunDecl)>
Get all spec fun overloads with the given name.
sourcepub fn disassemble(&self) -> String
pub fn disassemble(&self) -> String
Disassemble the module bytecode