diff options
author | Florian Diebold <[email protected]> | 2019-12-05 14:10:33 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-12-05 16:23:09 +0000 |
commit | 18f6a995d0fc1f45099f3cc810a5d55d5401b41b (patch) | |
tree | 808cb0f025b488f59935007802d1bb85f1cf0044 /crates/ra_hir_def/src/path.rs | |
parent | 4c0bd068da39e74c66104206e27c270454e3562e (diff) |
Add expansion infrastructure for derive macros
Diffstat (limited to 'crates/ra_hir_def/src/path.rs')
-rw-r--r-- | crates/ra_hir_def/src/path.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 3030dcdf6..e547b2f03 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs | |||
@@ -199,6 +199,11 @@ impl Path { | |||
199 | name_ref.as_name().into() | 199 | name_ref.as_name().into() |
200 | } | 200 | } |
201 | 201 | ||
202 | /// Converts an `tt::Ident` into a single-identifier `Path`. | ||
203 | pub(crate) fn from_tt_ident(ident: &tt::Ident) -> Path { | ||
204 | ident.as_name().into() | ||
205 | } | ||
206 | |||
202 | /// `true` is this path is a single identifier, like `foo` | 207 | /// `true` is this path is a single identifier, like `foo` |
203 | pub fn is_ident(&self) -> bool { | 208 | pub fn is_ident(&self) -> bool { |
204 | self.kind == PathKind::Plain && self.segments.len() == 1 | 209 | self.kind == PathKind::Plain && self.segments.len() == 1 |