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>

pub fn get_name(&self) -> Symbol

Returns the name of this function.

pub fn get_full_name_str(&self) -> String

Gets full name as string.

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

Returns the VM identifier for this function

pub fn get_id(&self) -> FunId

Gets the id of this function.

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

Gets the qualified id of this function.

pub fn get_doc(&self) -> &str

Get documentation associated with this function.

pub fn get_def_idx(&self) -> FunctionDefinitionIndex

Gets the definition index of this function.

pub fn symbol_pool(&self) -> &SymbolPool

Shortcut for accessing the symbol pool.

pub fn get_loc(&self) -> Loc

Returns the location of this function.

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

Returns the location of the bytecode at the given offset.

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

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

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

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

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>>

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>>

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_native(&self) -> bool

Returns true if this function is native.

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 is_opaque(&self) -> bool

Returns true if this function is opaque.

pub fn visibility(&self) -> Visibility

Return the visibility of this function

pub fn visibility_str(&self) -> &str

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

pub fn is_exposed(&self) -> bool

Return whether this function is exposed outside of the module.

pub fn has_unknown_callers(&self) -> bool

Return whether this function is exposed outside of the module.

pub fn is_script(&self) -> bool

Returns true if the function is a script function

pub fn is_friend(&self) -> bool

Return true if this function is a friend function

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

Returns true if invariants are declared disabled in body of function

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>>

Returns the name of the friend(the only allowed caller) of this function, if there is one.

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>>

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>

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>

Returns the type parameters associated with this function.

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

Return the number of type parameters for self

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>

Returns the parameter types associated with this function

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>

Returns return types of this function.

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

Returns return type at given index.

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

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

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

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

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

Returns associated specification.

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>

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

Determine whether the function is target of verification.

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

Determine whether this function is explicitly deactivated for verification.

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>

Get the functions that this one calls

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>

Returns the function name with the module name excluding the address

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>

§

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
§

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

§

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

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> Same<T> for T

§

type Output = T

Should always be Self
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