mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-04 15:45:25 +00:00
Add HIR Expr machinery
This commit is contained in:
parent
a6f33b4ca5
commit
136aba1cf3
9 changed files with 542 additions and 4 deletions
|
@ -65,6 +65,14 @@ impl Path {
|
|||
}
|
||||
}
|
||||
|
||||
/// Converts an `ast::NameRef` into a single-identifier `Path`.
|
||||
pub fn from_name_ref(name_ref: ast::NameRef) -> Path {
|
||||
Path {
|
||||
kind: PathKind::Plain,
|
||||
segments: vec![name_ref.as_name()],
|
||||
}
|
||||
}
|
||||
|
||||
/// `true` is this path is a single identifier, like `foo`
|
||||
pub fn is_ident(&self) -> bool {
|
||||
self.kind == PathKind::Plain && self.segments.len() == 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue