pub struct FunctionEnv<'env> {
    pub module_env: ModuleEnv<'env>,
    /* private fields */
}

Fields§

§module_env: ModuleEnv<'env>

Reference to enclosing module.

Implementations§

source§

impl<'env> FunctionEnv<'env>

source

pub fn get_name(&self) -> Symbol

Returns the name of this function.

source

pub fn get_full_name_str(&self) -> String

Gets full name as string.

source

pub fn get_identifier(&'env self) -> Identifier

Returns the VM identifier for this function

source

pub fn get_id(&self) -> FunId

Gets the id of this function.

source

pub fn get_qualified_id(&self) -> QualifiedId<FunId>

Gets the qualified id of this function.

source

pub fn get_doc(&self) -> &str

Get documentation associated with this function.

source

pub fn get_def_idx(&self) -> FunctionDefinitionIndex

Gets the definition index of this function.

source

pub fn symbol_pool(&self) -> &SymbolPool

Shortcut for accessing the symbol pool.

source

pub fn get_loc(&self) -> Loc

Returns the location of this function.

source

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.

source

pub fn get_bytecode_loc(&self, offset: u16) -> Loc

Returns the location of the bytecode at the given offset.

source

pub fn get_bytecode(&self) -> &[Bytecode]

Returns the bytecode associated with this function.

source

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

source

pub fn is_pragma_false(&self, name: &str) -> bool

Returns true if the value of a boolean pragma for this function is false.

source

pub fn is_num_pragma_set(&self, name: &str) -> bool

Returns whether the value of a numeric pragma is explicitly set for this function.

source

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

source

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.

source

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.

source

pub fn is_native(&self) -> bool

Returns true if this function is native.

source

pub fn is_intrinsic(&self) -> bool

Returns true if this function has the pragma intrinsic set to true.

source

pub fn is_native_or_intrinsic(&self) -> bool

source

pub fn is_opaque(&self) -> bool

Returns true if this function is opaque.

source

pub fn visibility(&self) -> FunctionVisibility

Return the visibility of this function

source

pub fn visibility_str(&self) -> &str

Return the visibility string for this function. Useful for formatted printing.

source

pub fn is_exposed(&self) -> bool

Return whether this function is exposed outside of the module.

source

pub fn has_unknown_callers(&self) -> bool

Return whether this function is exposed outside of the module.

source

pub fn is_script(&self) -> bool

Returns true if the function is a script function

source

pub fn is_friend(&self) -> bool

Return true if this function is a friend function

source

pub fn are_invariants_disabled_in_body(&self) -> bool

Returns true if invariants are declared disabled in body of function

source

pub fn are_invariants_disabled_at_call(&self) -> bool

Returns true if invariants are declared disabled in body of function

source

pub fn is_mutating(&self) -> bool

Returns true if this function mutates any references (i.e. has &mut parameters).

source

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.

source

pub fn has_friend(&self) -> bool

Returns true if a friend is specified for this function.

source

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.

source

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.

source

pub fn get_type_parameters(&self) -> Vec<TypeParameter>

Returns the type parameters associated with this function.

source

pub fn get_named_type_parameters(&self) -> Vec<TypeParameter>

Returns the type parameters with the real names.

source

pub fn get_parameter_count(&self) -> usize

source

pub fn get_type_parameter_count(&self) -> usize

Return the number of type parameters for self

source

pub fn is_parameter(&self, idx: usize) -> bool

Return true if idx is a formal parameter index

source

pub fn get_parameter_types(&self) -> Vec<Type>

Returns the parameter types associated with this function

source

pub fn get_parameters(&self) -> Vec<Parameter>

Returns the regular parameters associated with this function.

source

pub fn get_return_types(&self) -> Vec<Type>

Returns return types of this function.

source

pub fn get_return_type(&self, idx: usize) -> Type

Returns return type at given index.

source

pub fn get_return_count(&self) -> usize

Returns the number of return values of this function.

source

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.

source

pub fn is_temporary(&self, idx: usize) -> bool

Returns true if the index is for a temporary, not user declared local.

source

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.

source

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.

source

pub fn get_spec(&'env self) -> &'env Spec

Returns associated specification.

source

pub fn get_acquires_global_resources(&'env self) -> Vec<StructId>

Returns the acquired global resource types.

source

pub fn get_modify_targets(&self) -> BTreeMap<QualifiedId<StructId>, Vec<Exp>>

Computes the modified targets of the spec clause, as a map from resource type names to resource indices (list of types and address).

source

pub fn should_verify(&self, default_scope: &VerificationScope) -> bool

Determine whether the function is target of verification.

source

pub fn matches_name(&self, name: &str) -> bool

Returns true if either the name or simple name of this function matches the given string

source

pub fn is_explicitly_not_verified(&self, scope: &VerificationScope) -> bool

Determine whether this function is explicitly deactivated for verification.

source

pub fn get_calling_functions(&self) -> BTreeSet<QualifiedId<FunId>>

Get the functions that call this one

source

pub fn get_called_functions(&self) -> BTreeSet<QualifiedId<FunId>>

Get the functions that this one calls

source

pub fn get_simple_name_string(&self) -> Rc<String>

Returns the function name excluding the address and the module name

source

pub fn get_name_string(&self) -> Rc<str>

Returns the function name with the module name excluding the address

source

pub fn get_type_display_ctxt(&self) -> TypeDisplayContext<'_>

Produce a TypeDisplayContext to print types within the scope of this env

Trait Implementations§

source§

impl<'env> Clone for FunctionEnv<'env>

source§

fn clone(&self) -> FunctionEnv<'env>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'env> Debug for FunctionEnv<'env>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'env> !RefUnwindSafe for FunctionEnv<'env>

§

impl<'env> !Send for FunctionEnv<'env>

§

impl<'env> !Sync for FunctionEnv<'env>

§

impl<'env> Unpin for FunctionEnv<'env>

§

impl<'env> !UnwindSafe for FunctionEnv<'env>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V