Add fn signature query

This commit is contained in:
Florian Diebold 2019-01-06 01:00:34 +01:00
parent e5a6cf8153
commit 98957f4e6f
8 changed files with 86 additions and 7 deletions

View file

@ -67,10 +67,7 @@ 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()],
}
name_ref.as_name().into()
}
/// `true` is this path is a single identifier, like `foo`
@ -92,6 +89,15 @@ impl Path {
}
}
impl From<Name> for Path {
fn from(name: Name) -> Path {
Path {
kind: PathKind::Plain,
segments: vec![name],
}
}
}
fn expand_use_tree(
prefix: Option<Path>,
tree: ast::UseTree,