aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/path.rs')
-rw-r--r--crates/ra_hir/src/path.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 93f7203fe..9fdfa0d13 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -70,6 +70,11 @@ impl Path {
70 self.kind == PathKind::Plain && self.segments.len() == 1 70 self.kind == PathKind::Plain && self.segments.len() == 1
71 } 71 }
72 72
73 /// `true` if this path is just a standalone `self`
74 pub fn is_self(&self) -> bool {
75 self.kind == PathKind::Self_ && self.segments.len() == 0
76 }
77
73 /// If this path is a single identifier, like `foo`, return its name. 78 /// If this path is a single identifier, like `foo`, return its name.
74 pub fn as_ident(&self) -> Option<&Name> { 79 pub fn as_ident(&self) -> Option<&Name> {
75 if self.kind != PathKind::Plain || self.segments.len() > 1 { 80 if self.kind != PathKind::Plain || self.segments.len() > 1 {