diff options
Diffstat (limited to 'crates/ra_analysis/src/macros.rs')
-rw-r--r-- | crates/ra_analysis/src/macros.rs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/crates/ra_analysis/src/macros.rs b/crates/ra_analysis/src/macros.rs deleted file mode 100644 index 21ec36cd6..000000000 --- a/crates/ra_analysis/src/macros.rs +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /// Begining of macro expansion. | ||
2 | /// | ||
3 | /// This code should be moved out of ra_analysis into hir (?) ideally. | ||
4 | use std::sync::Arc; | ||
5 | |||
6 | use ra_syntax::{ast, AstNode, TextUnit}; | ||
7 | use hir::MacroDatabase; | ||
8 | |||
9 | use crate::{db::RootDatabase, FileId}; | ||
10 | |||
11 | pub(crate) fn expand( | ||
12 | db: &RootDatabase, | ||
13 | _file_id: FileId, | ||
14 | macro_call: ast::MacroCall, | ||
15 | ) -> Option<(TextUnit, Arc<hir::MacroExpansion>)> { | ||
16 | let path = macro_call.path()?; | ||
17 | if path.qualifier().is_some() { | ||
18 | return None; | ||
19 | } | ||
20 | let name_ref = path.segment()?.name_ref()?; | ||
21 | if name_ref.text() != "ctry" { | ||
22 | return None; | ||
23 | } | ||
24 | let arg = macro_call.token_tree()?.syntax(); | ||
25 | |||
26 | let def = hir::MacroDef::CTry; | ||
27 | let input = hir::MacroInput { | ||
28 | text: arg.text().to_string(), | ||
29 | }; | ||
30 | let exp = db.expand_macro(def, input)?; | ||
31 | Some((arg.range().start(), exp)) | ||
32 | } | ||