From 853cf3690251cda47d57a2d80e673585e7274bde Mon Sep 17 00:00:00 2001 From: TomAFrench Date: Thu, 22 Feb 2024 16:32:24 +0000 Subject: [PATCH] chore: remove duplicate `parse_all` function --- compiler/wasm/src/compile.rs | 20 +++++++++----------- compiler/wasm/src/compile_new.rs | 6 ++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/wasm/src/compile.rs b/compiler/wasm/src/compile.rs index c8b1680bc0..d52cd6e17f 100644 --- a/compiler/wasm/src/compile.rs +++ b/compiler/wasm/src/compile.rs @@ -1,9 +1,12 @@ use fm::FileManager; use gloo_utils::format::JsValueSerdeExt; use js_sys::{JsString, Object}; -use nargo::artifacts::{ - contract::{ContractArtifact, ContractFunctionArtifact}, - program::ProgramArtifact, +use nargo::{ + artifacts::{ + contract::{ContractArtifact, ContractFunctionArtifact}, + program::ProgramArtifact, + }, + parse_all, }; use noirc_driver::{ add_dep, compile_contract, compile_main, file_manager_with_stdlib, prepare_crate, @@ -13,7 +16,7 @@ use noirc_driver::{ use noirc_evaluator::errors::SsaReport; use noirc_frontend::{ graph::{CrateId, CrateName}, - hir::{def_map::parse_file, Context, ParsedFiles}, + hir::Context, }; use serde::Deserialize; use std::{collections::HashMap, path::Path}; @@ -140,10 +143,6 @@ impl PathToFileSourceMap { } } -pub(crate) fn parse_all(fm: &FileManager) -> ParsedFiles { - fm.as_file_map().all_file_ids().map(|&file_id| (file_id, parse_file(fm, file_id))).collect() -} - pub enum CompileResult { Contract { contract: ContractArtifact, warnings: Vec }, Program { program: ProgramArtifact, warnings: Vec }, @@ -291,14 +290,13 @@ pub(crate) fn generate_contract_artifact(contract: CompiledContract) -> CompileR #[cfg(test)] mod test { + use nargo::parse_all; use noirc_driver::prepare_crate; use noirc_frontend::{graph::CrateName, hir::Context}; use crate::compile::PathToFileSourceMap; - use super::{ - file_manager_with_source_map, parse_all, process_dependency_graph, DependencyGraph, - }; + use super::{file_manager_with_source_map, process_dependency_graph, DependencyGraph}; use std::{collections::HashMap, path::Path}; fn setup_test_context(source_map: PathToFileSourceMap) -> Context<'static, 'static> { diff --git a/compiler/wasm/src/compile_new.rs b/compiler/wasm/src/compile_new.rs index f8fbed4f47..50548dbf0a 100644 --- a/compiler/wasm/src/compile_new.rs +++ b/compiler/wasm/src/compile_new.rs @@ -1,8 +1,9 @@ use crate::compile::{ - file_manager_with_source_map, generate_contract_artifact, generate_program_artifact, parse_all, + file_manager_with_source_map, generate_contract_artifact, generate_program_artifact, JsCompileResult, PathToFileSourceMap, }; use crate::errors::{CompileError, JsCompileError}; +use nargo::parse_all; use noirc_driver::{ add_dep, compile_contract, compile_main, prepare_crate, prepare_dependency, CompileOptions, }; @@ -230,10 +231,11 @@ pub fn compile_( #[cfg(test)] mod test { + use nargo::parse_all; use noirc_driver::prepare_crate; use noirc_frontend::hir::Context; - use crate::compile::{file_manager_with_source_map, parse_all, PathToFileSourceMap}; + use crate::compile::{file_manager_with_source_map, PathToFileSourceMap}; use std::path::Path;