From d4db61b9a151a2a46c4067e61b0a4b1a9e3c73ec Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 29 Dec 2018 22:59:18 +0100 Subject: Resolve the self parameter during type inference --- crates/ra_hir/src/path.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/ra_hir/src/path.rs') 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 { self.kind == PathKind::Plain && self.segments.len() == 1 } + /// `true` if this path is just a standalone `self` + pub fn is_self(&self) -> bool { + self.kind == PathKind::Self_ && self.segments.len() == 0 + } + /// If this path is a single identifier, like `foo`, return its name. pub fn as_ident(&self) -> Option<&Name> { if self.kind != PathKind::Plain || self.segments.len() > 1 { -- cgit v1.2.3