Add HIR Expr machinery
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user