diff options
author | Jonas Schievink <[email protected]> | 2021-05-29 19:32:57 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-05-29 19:32:57 +0100 |
commit | 8c639a87bdbd08b10d4eb84d00f25ba7bcd56be0 (patch) | |
tree | 127d90ba4f4eac66081f9b78a2d53d2d713a0593 /crates/hir | |
parent | f6da603c7fe56c19a275dc7bab1f30fe1ad39707 (diff) |
Thread proc-macro types through the HIR
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/lib.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 01b2de515..975ae4869 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -1282,10 +1282,16 @@ impl BuiltinType { | |||
1282 | 1282 | ||
1283 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 1283 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
1284 | pub enum MacroKind { | 1284 | pub enum MacroKind { |
1285 | /// `macro_rules!` or Macros 2.0 macro. | ||
1285 | Declarative, | 1286 | Declarative, |
1286 | ProcMacro, | 1287 | /// A built-in or custom derive. |
1287 | Derive, | 1288 | Derive, |
1289 | /// A built-in function-like macro. | ||
1288 | BuiltIn, | 1290 | BuiltIn, |
1291 | /// A procedural attribute macro. | ||
1292 | Attr, | ||
1293 | /// A function-like procedural macro. | ||
1294 | ProcMacro, | ||
1289 | } | 1295 | } |
1290 | 1296 | ||
1291 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 1297 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
@@ -1315,11 +1321,13 @@ impl MacroDef { | |||
1315 | pub fn kind(&self) -> MacroKind { | 1321 | pub fn kind(&self) -> MacroKind { |
1316 | match self.id.kind { | 1322 | match self.id.kind { |
1317 | MacroDefKind::Declarative(_) => MacroKind::Declarative, | 1323 | MacroDefKind::Declarative(_) => MacroKind::Declarative, |
1318 | MacroDefKind::BuiltIn(_, _) => MacroKind::BuiltIn, | 1324 | MacroDefKind::BuiltIn(_, _) | MacroDefKind::BuiltInEager(_, _) => MacroKind::BuiltIn, |
1319 | MacroDefKind::BuiltInDerive(_, _) => MacroKind::Derive, | 1325 | MacroDefKind::BuiltInDerive(_, _) => MacroKind::Derive, |
1320 | MacroDefKind::BuiltInEager(_, _) => MacroKind::BuiltIn, | 1326 | MacroDefKind::ProcMacro(_, base_db::ProcMacroKind::CustomDerive, _) => { |
1321 | // FIXME might be a derive | 1327 | MacroKind::Derive |
1322 | MacroDefKind::ProcMacro(_, _) => MacroKind::ProcMacro, | 1328 | } |
1329 | MacroDefKind::ProcMacro(_, base_db::ProcMacroKind::Attr, _) => MacroKind::Attr, | ||
1330 | MacroDefKind::ProcMacro(_, base_db::ProcMacroKind::FuncLike, _) => MacroKind::ProcMacro, | ||
1323 | } | 1331 | } |
1324 | } | 1332 | } |
1325 | } | 1333 | } |