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
pub fn new<T: ImportResolver<'a>>(
context: AsgContext<'a>,
program: &Program,
import_resolver: &mut T
) -> Result<Program<'a>, AsgConvertError>
pub fn new<T: ImportResolver<'a>>(
context: AsgContext<'a>,
program: &Program,
import_resolver: &mut T
) -> Result<Program<'a>, AsgConvertError>
Returns a new Leo program ASG from the given Leo program AST and its imports.
Stages:
- resolve imports into super scope
- finalize declared types
- finalize declared functions
- resolve all asg nodes
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Program<'a>
impl<'a> !UnwindSafe for Program<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more