Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, file_manager_with_stdlib, prepare_crate, prepare_dependency, CompileOptions,
Expand All @@ -12,7 +15,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 @@ -152,10 +155,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()
}

#[wasm_bindgen]
pub fn compile_program(
entry_point: String,
Expand Down Expand Up @@ -309,14 +308,13 @@ fn add_noir_lib(context: &mut Context, library_name: &CrateName) -> CrateId {

#[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,9 +1,10 @@
use crate::compile::{
file_manager_with_source_map, parse_all, JsCompileContractResult, JsCompileProgramResult,
file_manager_with_source_map, JsCompileContractResult, JsCompileProgramResult,
PathToFileSourceMap,
};
use crate::errors::{CompileError, JsCompileError};
use nargo::artifacts::contract::{ContractArtifact, ContractFunctionArtifact};
use nargo::parse_all;
use noirc_driver::{
add_dep, compile_contract, compile_main, prepare_crate, prepare_dependency, CompileOptions,
NOIR_ARTIFACT_VERSION_STRING,
Expand Down Expand Up @@ -265,10 +266,11 @@ fn prepare_compiler_context(

#[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