Struct leo_asg::scope::InnerScope[][src]

pub struct InnerScope {
    pub id: Uuid,
    pub parent_scope: Option<Scope>,
    pub function: Option<Arc<Function>>,
    pub circuit_self: Option<Arc<Circuit>>,
    pub variables: IndexMap<String, Variable>,
    pub functions: IndexMap<String, Arc<Function>>,
    pub circuits: IndexMap<String, Arc<Circuit>>,
    pub input: Option<Input>,
}

An abstract data type that track the current bindings for variables, functions, and circuits.

Fields

id: Uuid

The unique id of the scope.

parent_scope: Option<Scope>

The parent scope that this scope inherits.

function: Option<Arc<Function>>

The function definition that this scope occurs in.

circuit_self: Option<Arc<Circuit>>

The circuit definition that this scope occurs in.

variables: IndexMap<String, Variable>

Maps variable name => variable.

functions: IndexMap<String, Arc<Function>>

Maps function name => function.

circuits: IndexMap<String, Arc<Circuit>>

Maps circuit name => circuit.

input: Option<Input>

The main input to the program.

Implementations

impl InnerScope[src]

pub fn resolve_variable(&self, name: &str) -> Option<Variable>[src]

Returns a reference to the variable corresponding to the name.

If the current scope did not have this name present, then the parent scope is checked. If there is no parent scope, then None is returned.

pub fn resolve_current_function(&self) -> Option<Arc<Function>>[src]

Returns a reference to the current function.

If the current scope did not have a function present, then the parent scope is checked. If there is no parent scope, then None is returned.

pub fn resolve_input(&self) -> Option<Input>[src]

Returns a reference to the current input.

If the current scope did not have an input present, then the parent scope is checked. If there is no parent scope, then None is returned.

pub fn resolve_function(&self, name: &str) -> Option<Arc<Function>>[src]

Returns a reference to the function corresponding to the name.

If the current scope did not have this name present, then the parent scope is checked. If there is no parent scope, then None is returned.

pub fn resolve_circuit(&self, name: &str) -> Option<Arc<Circuit>>[src]

Returns a reference to the circuit corresponding to the name.

If the current scope did not have this name present, then the parent scope is checked. If there is no parent scope, then None is returned.

pub fn resolve_circuit_self(&self) -> Option<Arc<Circuit>>[src]

Returns a reference to the current circuit.

If the current scope did not have a circuit self present, then the parent scope is checked. If there is no parent scope, then None is returned.

pub fn make_subscope(scope: &Scope) -> Scope[src]

Returns a new scope given a parent scope.

pub fn resolve_ast_type(&self, type_: &Type) -> Result<Type, AsgConvertError>[src]

Returns the type returned by the current scope.

Trait Implementations

impl Debug for InnerScope[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.