formatting

This commit is contained in:
gluaxspeed 2021-08-18 02:46:40 -07:00
parent a66c123d17
commit 14a1125d33
6 changed files with 7 additions and 27 deletions

View File

@ -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())?,

View File

@ -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();

View File

@ -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)
}

View File

@ -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) {

View File

@ -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());

View File

@ -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];