mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 23:23:50 +03:00
formatting
This commit is contained in:
parent
a66c123d17
commit
14a1125d33
@ -89,10 +89,7 @@ pub struct Asg<'a> {
|
||||
|
||||
impl<'a> Asg<'a> {
|
||||
/// Creates a new ASG from a given AST and import resolver.
|
||||
pub fn new<Y: AsRef<leo_ast::Program>>(
|
||||
context: AsgContext<'a>,
|
||||
ast: Y,
|
||||
) -> Result<Self> {
|
||||
pub fn new<Y: AsRef<leo_ast::Program>>(context: AsgContext<'a>, ast: Y) -> Result<Self> {
|
||||
Ok(Self {
|
||||
context,
|
||||
asg: Program::new(context, ast.as_ref())?,
|
||||
|
@ -28,7 +28,6 @@ use crate::{node::FromAst, ArenaNode, AsgContext, DefinitionStatement, Input, Sc
|
||||
// use leo_ast::{PackageAccess, PackageOrPackages};
|
||||
use leo_errors::{AsgError, Result};
|
||||
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
||||
@ -68,10 +67,7 @@ impl<'a> Program<'a> {
|
||||
/// 3. finalize declared functions
|
||||
/// 4. resolve all asg nodes
|
||||
///
|
||||
pub fn new(
|
||||
context: AsgContext<'a>,
|
||||
program: &leo_ast::Program,
|
||||
) -> Result<Program<'a>> {
|
||||
pub fn new(context: AsgContext<'a>, program: &leo_ast::Program) -> Result<Program<'a>> {
|
||||
let mut imported_functions: IndexMap<String, &'a Function<'a>> = IndexMap::new();
|
||||
let mut imported_circuits: IndexMap<String, &'a Circuit<'a>> = IndexMap::new();
|
||||
let mut imported_global_consts: IndexMap<String, &'a DefinitionStatement<'a>> = IndexMap::new();
|
||||
|
@ -438,11 +438,7 @@ pub trait ReconstructingReducer {
|
||||
Ok((identifier, import))
|
||||
}
|
||||
|
||||
fn reduce_circuit_member(
|
||||
&mut self,
|
||||
_circuit_member: &CircuitMember,
|
||||
new: CircuitMember,
|
||||
) -> Result<CircuitMember> {
|
||||
fn reduce_circuit_member(&mut self, _circuit_member: &CircuitMember, new: CircuitMember) -> Result<CircuitMember> {
|
||||
Ok(new)
|
||||
}
|
||||
|
||||
|
@ -620,7 +620,7 @@ impl<R: ReconstructingReducer, O: CombinerOptions> CombineAstAsgDirector<R, O> {
|
||||
for ((ast_ident, ast_program), (_asg_ident, asg_program)) in ast.imports.iter().zip(&asg.imported_modules) {
|
||||
imports.insert(ast_ident.clone(), self.reduce_program(ast_program, asg_program)?);
|
||||
}
|
||||
|
||||
|
||||
self.ast_reducer.swap_in_circuit();
|
||||
let mut circuits = IndexMap::new();
|
||||
for ((ast_ident, ast_circuit), (_asg_ident, asg_circuit)) in ast.circuits.iter().zip(&asg.circuits) {
|
||||
|
@ -42,11 +42,7 @@ impl ImportParser {
|
||||
}
|
||||
|
||||
impl ImportResolver for ImportParser {
|
||||
fn resolve_package(
|
||||
&mut self,
|
||||
package_segments: &[&str],
|
||||
span: &Span,
|
||||
) -> Result<Option<Program>> {
|
||||
fn resolve_package(&mut self, package_segments: &[&str], span: &Span) -> Result<Option<Program>> {
|
||||
let full_path = package_segments.join(".");
|
||||
if self.partial_imports.contains(&full_path) {
|
||||
return Err(ImportError::recursive_imports(full_path, span).into());
|
||||
|
@ -35,7 +35,7 @@ impl ImportParser {
|
||||
return self.parse_package(package.path(), remaining_segments, span);
|
||||
}
|
||||
|
||||
Self::parse_import_file(package, span)
|
||||
Self::parse_import_file(package, span)
|
||||
}
|
||||
|
||||
///
|
||||
@ -43,12 +43,7 @@ impl ImportParser {
|
||||
///
|
||||
/// Inserts the Leo syntax tree into the `ImportParser`.
|
||||
///
|
||||
pub(crate) fn parse_package(
|
||||
&mut self,
|
||||
mut path: PathBuf,
|
||||
segments: &[&str],
|
||||
span: &Span,
|
||||
) -> Result<Program> {
|
||||
pub(crate) fn parse_package(&mut self, mut path: PathBuf, segments: &[&str], span: &Span) -> Result<Program> {
|
||||
let error_path = path.clone();
|
||||
let package_name = segments[0];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user