Skip to content

Commit

Permalink
chore: remove duplicate parse_all function
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Feb 22, 2024
1 parent 601fd9a commit 853cf36
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 9 additions & 11 deletions compiler/wasm/src/compile.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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};
Expand Down Expand Up @@ -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<SsaReport> },
Program { program: ProgramArtifact, warnings: Vec<SsaReport> },
Expand Down Expand Up @@ -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> {
Expand Down
6 changes: 4 additions & 2 deletions compiler/wasm/src/compile_new.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 853cf36

Please sign in to comment.