mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-04 15:45:25 +00:00
Resolve the self parameter during type inference
This commit is contained in:
parent
111126ed3c
commit
d4db61b9a1
3 changed files with 19 additions and 4 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue