Skip to content

Commit 817278f

Browse files
committed
Move project loading into qsc_project
1 parent 672db35 commit 817278f

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/qsc_project/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ async-trait = { workspace = true }
1919
qsc_linter = { path = "../qsc_linter" }
2020
qsc_circuit = { path = "../qsc_circuit" }
2121
qsc_data_structures = { path = "../qsc_data_structures" }
22+
qsc_qasm = { path = "../qsc_qasm" }
2223
rustc-hash = { workspace = true }
2324
futures = { workspace = true }
2425
log = { workspace = true }

compiler/qsc_project/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ mod error;
1313
mod fs;
1414
mod js;
1515
mod manifest;
16+
pub mod openqasm;
1617
mod project;
1718

1819
pub use error::StdFsError;

language_service/src/openqasm.rs renamed to compiler/qsc_project/src/openqasm.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
use std::{path::Path, sync::Arc};
55

6-
use qsc::qasm::parser::ast::StmtKind;
7-
use qsc_project::{FileSystemAsync, Project};
6+
use super::{FileSystemAsync, Project};
7+
use qsc_qasm::parser::ast::StmtKind;
88
use rustc_hash::FxHashMap;
99

1010
pub async fn load_project<T>(project_host: &T, doc_uri: &Arc<str>) -> Project
@@ -34,7 +34,7 @@ where
3434
Ok((file, source)) => {
3535
loaded_files.insert(file, source.clone());
3636

37-
let (program, _errors) = qsc::qasm::parser::parse(source.as_ref());
37+
let (program, _errors) = qsc_qasm::parser::parse(source.as_ref());
3838

3939
let includes: Vec<Arc<str>> = program
4040
.statements
@@ -62,7 +62,7 @@ where
6262
}
6363
}
6464
Err(e) => {
65-
errors.push(qsc::project::Error::FileSystem {
65+
errors.push(super::project::Error::FileSystem {
6666
about_path: doc_uri.to_string(),
6767
error: e.to_string(),
6868
});
@@ -77,7 +77,7 @@ where
7777
name: get_file_name_from_uri(doc_uri),
7878
lints: Vec::default(),
7979
errors,
80-
project_type: qsc_project::ProjectType::OpenQASM(sources),
80+
project_type: super::ProjectType::OpenQASM(sources),
8181
}
8282
}
8383

language_service/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub mod definition;
99
pub mod format;
1010
pub mod hover;
1111
mod name_locator;
12-
pub mod openqasm;
1312
pub mod protocol;
1413
mod qsc_utils;
1514
pub mod references;

language_service/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'a> CompilationStateUpdater<'a> {
210210
) -> Result<Option<Project>, Vec<project::Error>> {
211211
if is_openqasm_file(doc_uri) {
212212
return Ok(Some(
213-
crate::openqasm::load_project(&*self.project_host, doc_uri).await,
213+
qsc_project::openqasm::load_project(&*self.project_host, doc_uri).await,
214214
));
215215
}
216216
self.load_manifest(doc_uri).await

wasm/src/project_system.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ impl ProjectLoader {
200200
}
201201

202202
pub async fn load_openqasm_project(&self, file_path: String) -> Result<IProjectConfig, String> {
203-
let project_config = qsls::openqasm::load_project(&self.0, &file_path.clone().into()).await;
203+
let project_config =
204+
qsc_project::openqasm::load_project(&self.0, &file_path.clone().into()).await;
204205
// Will return error if project has errors
205206
project_config.try_into()
206207
}

0 commit comments

Comments
 (0)