Struct leo_asg::scope::Scope [−][src]
An abstract data type that track the current bindings for variables, functions, and circuits.
Fields
context: AsgContext<'a>
id: u32
The unique id of the scope.
parent_scope: Cell<Option<&'a Scope<'a>>>
The parent scope that this scope inherits.
function: Cell<Option<&'a Function<'a>>>
The function definition that this scope occurs in.
circuit_self: Cell<Option<&'a Circuit<'a>>>
The circuit definition that this scope occurs in.
variables: RefCell<IndexMap<String, &'a Variable<'a>>>
Maps variable name => variable.
functions: RefCell<IndexMap<String, &'a Function<'a>>>
Maps function name => function.
circuits: RefCell<IndexMap<String, &'a Circuit<'a>>>
Maps circuit name => circuit.
input: Cell<Option<Input<'a>>>
The main input to the program.
Implementations
impl<'a> Scope<'a>
[src]
pub fn resolve_variable(&self, name: &str) -> Option<&'a Variable<'a>>
[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<&'a 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<'a>>
[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<&'a Function<'a>>
[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<&'a Circuit<'a>>
[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<&'a Circuit<'a>>
[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(self: &'a Scope<'a>) -> &'a Scope<'a>
[src]
Returns a new scope given a parent scope.
pub fn resolve_ast_type(
&self,
type_: &Type
) -> Result<Type<'a>, AsgConvertError>
[src]
&self,
type_: &Type
) -> Result<Type<'a>, AsgConvertError>
Returns the type returned by the current scope.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Scope<'a>
impl<'a> !Send for Scope<'a>
impl<'a> !Sync for Scope<'a>
impl<'a> Unpin for Scope<'a>
impl<'a> !UnwindSafe for Scope<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,