From 14a1125d33ccddda85c7c3e8e8edd4d0ece81d5c Mon Sep 17 00:00:00 2001 From: gluaxspeed Date: Wed, 18 Aug 2021 02:46:40 -0700 Subject: [PATCH] formatting --- asg/src/lib.rs | 5 +---- asg/src/program/mod.rs | 6 +----- ast/src/reducer/reconstructing_reducer.rs | 6 +----- compiler/src/phases/reducing_director.rs | 2 +- imports/src/parser/import_parser.rs | 6 +----- imports/src/parser/parse_package.rs | 9 ++------- 6 files changed, 7 insertions(+), 27 deletions(-) diff --git a/asg/src/lib.rs b/asg/src/lib.rs index 2617ca23b3..aa6cd0f8fa 100644 --- a/asg/src/lib.rs +++ b/asg/src/lib.rs @@ -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>( - context: AsgContext<'a>, - ast: Y, - ) -> Result { + pub fn new>(context: AsgContext<'a>, ast: Y) -> Result { Ok(Self { context, asg: Program::new(context, ast.as_ref())?, diff --git a/asg/src/program/mod.rs b/asg/src/program/mod.rs index ff05772d27..a0057bdf7a 100644 --- a/asg/src/program/mod.rs +++ b/asg/src/program/mod.rs @@ -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> { + pub fn new(context: AsgContext<'a>, program: &leo_ast::Program) -> Result> { let mut imported_functions: IndexMap> = IndexMap::new(); let mut imported_circuits: IndexMap> = IndexMap::new(); let mut imported_global_consts: IndexMap> = IndexMap::new(); diff --git a/ast/src/reducer/reconstructing_reducer.rs b/ast/src/reducer/reconstructing_reducer.rs index 085aecdbe1..4ffcf77908 100644 --- a/ast/src/reducer/reconstructing_reducer.rs +++ b/ast/src/reducer/reconstructing_reducer.rs @@ -438,11 +438,7 @@ pub trait ReconstructingReducer { Ok((identifier, import)) } - fn reduce_circuit_member( - &mut self, - _circuit_member: &CircuitMember, - new: CircuitMember, - ) -> Result { + fn reduce_circuit_member(&mut self, _circuit_member: &CircuitMember, new: CircuitMember) -> Result { Ok(new) } diff --git a/compiler/src/phases/reducing_director.rs b/compiler/src/phases/reducing_director.rs index 9aae498b94..977d971069 100644 --- a/compiler/src/phases/reducing_director.rs +++ b/compiler/src/phases/reducing_director.rs @@ -620,7 +620,7 @@ impl CombineAstAsgDirector { 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) { diff --git a/imports/src/parser/import_parser.rs b/imports/src/parser/import_parser.rs index 936317ec93..2998bbc18c 100644 --- a/imports/src/parser/import_parser.rs +++ b/imports/src/parser/import_parser.rs @@ -42,11 +42,7 @@ impl ImportParser { } impl ImportResolver for ImportParser { - fn resolve_package( - &mut self, - package_segments: &[&str], - span: &Span, - ) -> Result> { + fn resolve_package(&mut self, package_segments: &[&str], span: &Span) -> Result> { let full_path = package_segments.join("."); if self.partial_imports.contains(&full_path) { return Err(ImportError::recursive_imports(full_path, span).into()); diff --git a/imports/src/parser/parse_package.rs b/imports/src/parser/parse_package.rs index 009eba3e9f..c53eac5335 100644 --- a/imports/src/parser/parse_package.rs +++ b/imports/src/parser/parse_package.rs @@ -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 { + pub(crate) fn parse_package(&mut self, mut path: PathBuf, segments: &[&str], span: &Span) -> Result { let error_path = path.clone(); let package_name = segments[0];