Struct leo_asg::program::Program[][src]

pub struct Program<'a> {
    pub context: AsgContext<'a>,
    pub id: u32,
    pub name: String,
    pub imported_modules: IndexMap<String, Program<'a>>,
    pub functions: IndexMap<String, &'a Function<'a>>,
    pub circuits: IndexMap<String, &'a Circuit<'a>>,
    pub scope: &'a Scope<'a>,
}

Stores the Leo program abstract semantic graph (ASG).

Fields

context: AsgContext<'a>id: u32

The unique id of the program.

name: String

The program file name.

imported_modules: IndexMap<String, Program<'a>>

The packages imported by this program. these should generally not be accessed directly, but through scoped imports

functions: IndexMap<String, &'a Function<'a>>

Maps function name => function code block.

circuits: IndexMap<String, &'a Circuit<'a>>

Maps circuit name => circuit code block.

scope: &'a Scope<'a>

Bindings for names and additional program context.

Implementations

impl<'a> Program<'a>[src]

pub fn new<T: ImportResolver<'a>>(
    context: AsgContext<'a>,
    program: &Program,
    import_resolver: &mut T
) -> Result<Program<'a>, AsgConvertError>
[src]

Returns a new Leo program ASG from the given Leo program AST and its imports.

Stages:

  1. resolve imports into super scope
  2. finalize declared types
  3. finalize declared functions
  4. resolve all asg nodes

Trait Implementations

impl<'a> Clone for Program<'a>[src]

impl<'a> Into<Program> for &Program<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Program<'a>

impl<'a> !Send for Program<'a>

impl<'a> !Sync for Program<'a>

impl<'a> Unpin for Program<'a>

impl<'a> !UnwindSafe for Program<'a>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.