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 global_consts: IndexMap<String, &'a DefinitionStatement<'a>>,
    pub circuits: IndexMap<String, &'a Circuit<'a>>,
    pub scope: &'a Scope<'a>,
}
Expand description

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.

global_consts: IndexMap<String, &'a DefinitionStatement<'a>>

Maps global constant name => global const code block.

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

Maps circuit name => circuit code block.

scope: &'a Scope<'a>

Implementations

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.