aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/path.rs
diff options
context:
space:
mode:
authorzombiefungus <[email protected]>2020-02-02 13:04:06 +0000
committerzombiefungus <[email protected]>2020-02-02 13:04:24 +0000
commitf4f71e361ee632a7a09b633934a9c0a11f4a9be7 (patch)
treeddc461410065761d4f4397e96ea915ea9264609a /crates/ra_hir_def/src/path.rs
parent7d527159457420d55f1ee2f70615098a10176b91 (diff)
include requested changes
Diffstat (limited to 'crates/ra_hir_def/src/path.rs')
-rw-r--r--crates/ra_hir_def/src/path.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs
index 27ccf6643..fb7692191 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)]
38pub enum ImportAlias {
39 /// Unnamed alias, as in `use Foo as _;`
40 Underscore,
41 /// Named alias
42 Alias(Name),
43}
44
37impl ModPath { 45impl 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,12 +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( 68 mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option<ImportAlias>),
61 ModPath,
62 &ast::UseTree,
63 /* is_glob */ bool,
64 crate::nameres::raw::ImportAlias,
65 ),
66 ) { 69 ) {
67 if let Some(tree) = item_src.value.use_tree() { 70 if let Some(tree) = item_src.value.use_tree() {
68 lower::lower_use_tree(None, tree, hygiene, &mut cb); 71 lower::lower_use_tree(None, tree, hygiene, &mut cb);