Struct bytecode::mut_ref_instrumentation::FunctionEnv
pub struct FunctionEnv<'env> {
pub module_env: ModuleEnv<'env>,
/* private fields */
}
Fields§
§module_env: ModuleEnv<'env>
Reference to enclosing module.
Implementations§
§impl<'env> FunctionEnv<'env>
impl<'env> FunctionEnv<'env>
pub fn get_name(&self) -> Symbol
pub fn get_name(&self) -> Symbol
Returns the name of this function.
pub fn get_full_name_str(&self) -> String
pub fn get_full_name_str(&self) -> String
Gets full name as string.
pub fn get_identifier(&'env self) -> Identifier
pub fn get_identifier(&'env self) -> Identifier
Returns the VM identifier for this function
pub fn get_id(&self) -> FunId
pub fn get_id(&self) -> FunId
Gets the id of this function.
pub fn get_qualified_id(&self) -> QualifiedId<FunId>
pub fn get_qualified_id(&self) -> QualifiedId<FunId>
Gets the qualified id of this function.
pub fn get_def_idx(&self) -> FunctionDefinitionIndex
pub fn get_def_idx(&self) -> FunctionDefinitionIndex
Gets the definition index of this function.
pub fn symbol_pool(&self) -> &SymbolPool
pub fn symbol_pool(&self) -> &SymbolPool
Shortcut for accessing the symbol pool.
pub fn get_spec_loc(&self) -> Loc
pub fn get_spec_loc(&self) -> Loc
Returns the location of the specification block of this function. If the function has none, returns that of the function itself.
pub fn get_bytecode_loc(&self, offset: u16) -> Loc
pub fn get_bytecode_loc(&self, offset: u16) -> Loc
Returns the location of the bytecode at the given offset.
pub fn get_bytecode(&self) -> &[Bytecode]
pub fn get_bytecode(&self) -> &[Bytecode]
Returns the bytecode associated with this function.
pub fn is_pragma_true(&self, name: &str, default: impl FnOnce() -> bool) -> bool
pub fn is_pragma_true(&self, name: &str, default: impl FnOnce() -> bool) -> bool
Returns the value of a boolean pragma for this function. This first looks up a pragma in this function, then the enclosing module, and finally uses the provided default. value
pub fn is_pragma_false(&self, name: &str) -> bool
pub fn is_pragma_false(&self, name: &str) -> bool
Returns true if the value of a boolean pragma for this function is false.
pub fn is_num_pragma_set(&self, name: &str) -> bool
pub fn is_num_pragma_set(&self, name: &str) -> bool
Returns whether the value of a numeric pragma is explicitly set for this function.
pub fn get_num_pragma(&self, name: &str, default: impl FnOnce() -> usize) -> usize
pub fn get_num_pragma(&self, name: &str, default: impl FnOnce() -> usize) -> usize
Returns the value of a numeric pragma for this function. This first looks up a pragma in this function, then the enclosing module, and finally uses the provided default. value
pub fn get_ident_pragma(&self, name: &str) -> Option<Rc<String>>
pub fn get_ident_pragma(&self, name: &str) -> Option<Rc<String>>
Returns the value of a pragma representing an identifier for this function. If such pragma is not specified for this function, None is returned.
pub fn get_func_env_from_pragma(&self, name: &str) -> Option<FunctionEnv<'env>>
pub fn get_func_env_from_pragma(&self, name: &str) -> Option<FunctionEnv<'env>>
Returns the FunctionEnv of the function identified by the pragma, if the pragma exists and its value represents a function in the system.
pub fn is_intrinsic(&self) -> bool
pub fn is_intrinsic(&self) -> bool
Returns true if this function has the pragma intrinsic set to true.
pub fn is_native_or_intrinsic(&self) -> bool
pub fn visibility(&self) -> Visibility
pub fn visibility(&self) -> Visibility
Return the visibility of this function
pub fn visibility_str(&self) -> &str
pub fn visibility_str(&self) -> &str
Return the visibility string for this function. Useful for formatted printing.
pub fn is_exposed(&self) -> bool
pub fn is_exposed(&self) -> bool
Return whether this function is exposed outside of the module.
pub fn has_unknown_callers(&self) -> bool
pub fn has_unknown_callers(&self) -> bool
Return whether this function is exposed outside of the module.
pub fn are_invariants_disabled_in_body(&self) -> bool
pub fn are_invariants_disabled_in_body(&self) -> bool
Returns true if invariants are declared disabled in body of function
pub fn are_invariants_disabled_at_call(&self) -> bool
pub fn are_invariants_disabled_at_call(&self) -> bool
Returns true if invariants are declared disabled in body of function
pub fn is_mutating(&self) -> bool
pub fn is_mutating(&self) -> bool
Returns true if this function mutates any references (i.e. has &mut parameters).
pub fn get_friend_name(&self) -> Option<Rc<String>>
pub fn get_friend_name(&self) -> Option<Rc<String>>
Returns the name of the friend(the only allowed caller) of this function, if there is one.
pub fn has_friend(&self) -> bool
pub fn has_friend(&self) -> bool
Returns true if a friend is specified for this function.
pub fn get_friend_env(&self) -> Option<FunctionEnv<'env>>
pub fn get_friend_env(&self) -> Option<FunctionEnv<'env>>
Returns the FunctionEnv of the friend function if the friend is specified and the friend was compiled into the environment.
pub fn get_transitive_friend(&self) -> FunctionEnv<'env>
pub fn get_transitive_friend(&self) -> FunctionEnv<'env>
Returns the FunctionEnv of the transitive friend of the function.
For example, if f
has a friend g
and g
has a friend h
, then
f
’s transitive friend is h
.
If a friend is not specified then the function itself is returned.
pub fn get_type_parameters(&self) -> Vec<TypeParameter, Global> ⓘ
pub fn get_type_parameters(&self) -> Vec<TypeParameter, Global> ⓘ
Returns the type parameters associated with this function.
pub fn get_named_type_parameters(&self) -> Vec<TypeParameter, Global> ⓘ
pub fn get_named_type_parameters(&self) -> Vec<TypeParameter, Global> ⓘ
Returns the type parameters with the real names.
pub fn get_parameter_count(&self) -> usize
pub fn get_type_parameter_count(&self) -> usize
pub fn get_type_parameter_count(&self) -> usize
Return the number of type parameters for self
pub fn is_parameter(&self, idx: usize) -> bool
pub fn is_parameter(&self, idx: usize) -> bool
Return true
if idx is a formal parameter index
pub fn get_parameter_types(&self) -> Vec<Type, Global> ⓘ
pub fn get_parameter_types(&self) -> Vec<Type, Global> ⓘ
Returns the parameter types associated with this function
pub fn get_parameters(&self) -> Vec<Parameter, Global> ⓘ
pub fn get_parameters(&self) -> Vec<Parameter, Global> ⓘ
Returns the regular parameters associated with this function.
pub fn get_return_types(&self) -> Vec<Type, Global> ⓘ
pub fn get_return_types(&self) -> Vec<Type, Global> ⓘ
Returns return types of this function.
pub fn get_return_type(&self, idx: usize) -> Type
pub fn get_return_type(&self, idx: usize) -> Type
Returns return type at given index.
pub fn get_return_count(&self) -> usize
pub fn get_return_count(&self) -> usize
Returns the number of return values of this function.
pub fn get_local_name(&self, idx: usize) -> Symbol
pub fn get_local_name(&self, idx: usize) -> Symbol
Get the name to be used for a local. If the local is an argument, use that for naming, otherwise generate a unique name.
pub fn is_temporary(&self, idx: usize) -> bool
pub fn is_temporary(&self, idx: usize) -> bool
Returns true if the index is for a temporary, not user declared local.
pub fn get_local_count(&self) -> usize
pub fn get_local_count(&self) -> usize
Gets the number of proper locals of this function. Those are locals which are declared
by the user and also have a user assigned name which can be discovered via get_local_name
.
Note we may have more anonymous locals generated e.g by the ‘stackless’ transformation.
pub fn get_local_type(&self, idx: usize) -> Type
pub fn get_local_type(&self, idx: usize) -> Type
Gets the type of the local at index. This must use an index in the range as determined by
get_local_count
.
pub fn get_spec(&'env self) -> &'env Spec
pub fn get_spec(&'env self) -> &'env Spec
Returns associated specification.
pub fn get_acquires_global_resources(&'env self) -> Vec<StructId, Global> ⓘ
pub fn get_acquires_global_resources(&'env self) -> Vec<StructId, Global> ⓘ
Returns the acquired global resource types.
pub fn get_modify_targets(
&self
) -> BTreeMap<QualifiedId<StructId>, Vec<Exp, Global>, Global>
pub fn get_modify_targets( &self ) -> BTreeMap<QualifiedId<StructId>, Vec<Exp, Global>, Global>
Computes the modified targets of the spec clause, as a map from resource type names to resource indices (list of types and address).
pub fn should_verify(&self, default_scope: &VerificationScope) -> bool
pub fn should_verify(&self, default_scope: &VerificationScope) -> bool
Determine whether the function is target of verification.
pub fn matches_name(&self, name: &str) -> bool
pub fn matches_name(&self, name: &str) -> bool
Returns true if either the name or simple name of this function matches the given string
pub fn is_explicitly_not_verified(&self, scope: &VerificationScope) -> bool
pub fn is_explicitly_not_verified(&self, scope: &VerificationScope) -> bool
Determine whether this function is explicitly deactivated for verification.
pub fn get_calling_functions(&self) -> BTreeSet<QualifiedId<FunId>, Global>
pub fn get_calling_functions(&self) -> BTreeSet<QualifiedId<FunId>, Global>
Get the functions that call this one
pub fn get_called_functions(&self) -> BTreeSet<QualifiedId<FunId>, Global>
pub fn get_called_functions(&self) -> BTreeSet<QualifiedId<FunId>, Global>
Get the functions that this one calls
pub fn get_simple_name_string(&self) -> Rc<String>
pub fn get_simple_name_string(&self) -> Rc<String>
Returns the function name excluding the address and the module name
pub fn get_name_string(&self) -> Rc<str>
pub fn get_name_string(&self) -> Rc<str>
Returns the function name with the module name excluding the address
pub fn get_type_display_ctxt(&self) -> TypeDisplayContext<'_>
pub fn get_type_display_ctxt(&self) -> TypeDisplayContext<'_>
Produce a TypeDisplayContext to print types within the scope of this env
Trait Implementations§
§impl<'env> Clone for FunctionEnv<'env>
impl<'env> Clone for FunctionEnv<'env>
§fn clone(&self) -> FunctionEnv<'env>
fn clone(&self) -> FunctionEnv<'env>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more