diff options
Diffstat (limited to 'crates/ra_hir_def/src/path.rs')
-rw-r--r-- | crates/ra_hir_def/src/path.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index a150b899f..246032c13 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs | |||
@@ -34,6 +34,14 @@ pub enum PathKind { | |||
34 | DollarCrate(CrateId), | 34 | DollarCrate(CrateId), |
35 | } | 35 | } |
36 | 36 | ||
37 | #[derive(Debug, Clone, PartialEq, Eq)] | ||
38 | pub enum ImportAlias { | ||
39 | /// Unnamed alias, as in `use Foo as _;` | ||
40 | Underscore, | ||
41 | /// Named alias | ||
42 | Alias(Name), | ||
43 | } | ||
44 | |||
37 | impl ModPath { | 45 | impl ModPath { |
38 | pub fn from_src(path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { | 46 | pub fn from_src(path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { |
39 | lower::lower_path(path, hygiene).map(|it| it.mod_path) | 47 | lower::lower_path(path, hygiene).map(|it| it.mod_path) |
@@ -57,7 +65,7 @@ impl ModPath { | |||
57 | pub(crate) fn expand_use_item( | 65 | pub(crate) fn expand_use_item( |
58 | item_src: InFile<ast::UseItem>, | 66 | item_src: InFile<ast::UseItem>, |
59 | hygiene: &Hygiene, | 67 | hygiene: &Hygiene, |
60 | mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option<Name>), | 68 | mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option<ImportAlias>), |
61 | ) { | 69 | ) { |
62 | if let Some(tree) = item_src.value.use_tree() { | 70 | if let Some(tree) = item_src.value.use_tree() { |
63 | lower::lower_use_tree(None, tree, hygiene, &mut cb); | 71 | lower::lower_use_tree(None, tree, hygiene, &mut cb); |