From d0b6ed4441469acfb6bc6555d78abf12637b6cf4 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Wed, 18 Mar 2020 20:56:46 +0800 Subject: Add ProcMacroClient --- crates/ra_db/Cargo.toml | 1 + crates/ra_db/src/fixture.rs | 4 ++++ crates/ra_db/src/input.rs | 15 +++++++++++++++ crates/ra_db/src/lib.rs | 3 ++- 4 files changed, 22 insertions(+), 1 deletion(-) (limited to 'crates/ra_db') diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index 878c22ba9..82fd842a6 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml @@ -15,4 +15,5 @@ rustc-hash = "1.1.0" ra_syntax = { path = "../ra_syntax" } ra_cfg = { path = "../ra_cfg" } ra_prof = { path = "../ra_prof" } +ra_proc_macro = { path = "../ra_proc_macro" } test_utils = { path = "../test_utils" } diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs index 3464f43df..9d992886e 100644 --- a/crates/ra_db/src/fixture.rs +++ b/crates/ra_db/src/fixture.rs @@ -70,6 +70,7 @@ fn with_single_file(db: &mut dyn SourceDatabaseExt, ra_fixture: &str) -> FileId meta.cfg, meta.env, Default::default(), + Default::default(), ); crate_graph } else { @@ -81,6 +82,7 @@ fn with_single_file(db: &mut dyn SourceDatabaseExt, ra_fixture: &str) -> FileId CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); crate_graph }; @@ -130,6 +132,7 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option Option, + pub proc_macro: Vec, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -166,6 +171,7 @@ impl CrateGraph { cfg_options: CfgOptions, env: Env, extern_source: ExternSource, + proc_macro: Vec, ) -> CrateId { let data = CrateData { root_file_id: file_id, @@ -174,6 +180,7 @@ impl CrateGraph { cfg_options, env, extern_source, + proc_macro, dependencies: Vec::new(), }; let crate_id = CrateId(self.arena.len() as u32); @@ -345,6 +352,7 @@ mod tests { CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); let crate2 = graph.add_crate_root( FileId(2u32), @@ -353,6 +361,7 @@ mod tests { CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); let crate3 = graph.add_crate_root( FileId(3u32), @@ -361,6 +370,7 @@ mod tests { CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok()); assert!(graph.add_dep(crate2, CrateName::new("crate3").unwrap(), crate3).is_ok()); @@ -377,6 +387,7 @@ mod tests { CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); let crate2 = graph.add_crate_root( FileId(2u32), @@ -385,6 +396,7 @@ mod tests { CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); let crate3 = graph.add_crate_root( FileId(3u32), @@ -393,6 +405,7 @@ mod tests { CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok()); assert!(graph.add_dep(crate2, CrateName::new("crate3").unwrap(), crate3).is_ok()); @@ -408,6 +421,7 @@ mod tests { CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); let crate2 = graph.add_crate_root( FileId(2u32), @@ -416,6 +430,7 @@ mod tests { CfgOptions::default(), Env::default(), Default::default(), + Default::default(), ); assert!(graph .add_dep(crate1, CrateName::normalize_dashes("crate-name-with-dashes"), crate2) diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index bac24e218..5829ae465 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs @@ -12,9 +12,10 @@ pub use crate::{ cancellation::Canceled, input::{ CrateGraph, CrateId, CrateName, Dependency, Edition, Env, ExternSource, ExternSourceId, - FileId, SourceRoot, SourceRootId, + FileId, ProcMacroId, SourceRoot, SourceRootId, }, }; +pub use ra_proc_macro::ProcMacro; pub use relative_path::{RelativePath, RelativePathBuf}; pub use salsa; -- cgit v1.2.3