aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_proc_macro/src/lib.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/crates/ra_proc_macro/src/lib.rs b/crates/ra_proc_macro/src/lib.rs
index a7a84249f..b7fb641c3 100644
--- a/crates/ra_proc_macro/src/lib.rs
+++ b/crates/ra_proc_macro/src/lib.rs
@@ -2,8 +2,8 @@
2//! 2//!
3//! We separate proc-macro expanding logic to an extern program to allow 3//! We separate proc-macro expanding logic to an extern program to allow
4//! different implementations (e.g. wasm or dylib loading). And this crate 4//! different implementations (e.g. wasm or dylib loading). And this crate
5//! is used for provide basic infra-structure for commnicate between two 5//! is used to provide basic infrastructure for communication between two
6//! process: Client (RA itself), Server (the external program) 6//! processes: Client (RA itself), Server (the external program)
7 7
8use ra_mbe::ExpandError; 8use ra_mbe::ExpandError;
9use ra_tt::Subtree; 9use ra_tt::Subtree;
@@ -18,7 +18,7 @@ trait ProcMacroExpander: std::fmt::Debug + Send + Sync + std::panic::RefUnwindSa
18 18
19#[derive(Debug, Clone, PartialEq, Eq)] 19#[derive(Debug, Clone, PartialEq, Eq)]
20pub struct ProcMacroProcessExpander { 20pub struct ProcMacroProcessExpander {
21 process_path: PathBuf, 21 process: Arc<ProcMacroProcessSrv>,
22} 22}
23 23
24impl ProcMacroExpander for ProcMacroProcessExpander { 24impl ProcMacroExpander for ProcMacroProcessExpander {
@@ -34,7 +34,7 @@ impl ProcMacroExpander for ProcMacroProcessExpander {
34 34
35#[derive(Debug, Clone)] 35#[derive(Debug, Clone)]
36pub struct ProcMacro { 36pub struct ProcMacro {
37 expander: Arc<Box<dyn ProcMacroExpander>>, 37 expander: Arc<dyn ProcMacroExpander>,
38 name: String, 38 name: String,
39} 39}
40 40
@@ -56,15 +56,20 @@ impl ProcMacro {
56} 56}
57 57
58#[derive(Debug, Clone, PartialEq, Eq)] 58#[derive(Debug, Clone, PartialEq, Eq)]
59pub struct ProcMacroProcessSrv {
60 path: PathBuf,
61}
62
63#[derive(Debug, Clone, PartialEq, Eq)]
59pub enum ProcMacroClient { 64pub enum ProcMacroClient {
60 Process { expander: Arc<ProcMacroProcessExpander> }, 65 Process { process: Arc<ProcMacroProcessSrv> },
61 Dummy, 66 Dummy,
62} 67}
63 68
64impl ProcMacroClient { 69impl ProcMacroClient {
65 pub fn extern_process(process_path: &Path) -> ProcMacroClient { 70 pub fn extern_process(process_path: &Path) -> ProcMacroClient {
66 let expander = ProcMacroProcessExpander { process_path: process_path.into() }; 71 let process = ProcMacroProcessSrv { path: process_path.into() };
67 ProcMacroClient::Process { expander: Arc::new(expander) } 72 ProcMacroClient::Process { process: Arc::new(process) }
68 } 73 }
69 74
70 pub fn dummy() -> ProcMacroClient { 75 pub fn dummy() -> ProcMacroClient {