aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/path
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-19 15:57:22 +0000
committerAleksey Kladov <[email protected]>2019-12-19 15:57:22 +0000
commit43ed3d1196164c96d025745c42f261930b832911 (patch)
tree255ae36f65ba173694bf66b3c79d8db0c8d88b82 /crates/ra_hir_def/src/path
parent1e32412e28d6668af5c6fe85b4fc921fb1de9a98 (diff)
Handle start imports in import groups
Diffstat (limited to 'crates/ra_hir_def/src/path')
-rw-r--r--crates/ra_hir_def/src/path/lower/lower_use.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/path/lower/lower_use.rs b/crates/ra_hir_def/src/path/lower/lower_use.rs
index 062c02063..3218eaf0a 100644
--- a/crates/ra_hir_def/src/path/lower/lower_use.rs
+++ b/crates/ra_hir_def/src/path/lower/lower_use.rs
@@ -9,6 +9,7 @@ use hir_expand::{
9 name::{AsName, Name}, 9 name::{AsName, Name},
10}; 10};
11use ra_syntax::ast::{self, NameOwner}; 11use ra_syntax::ast::{self, NameOwner};
12use test_utils::tested_by;
12 13
13use crate::path::{ModPath, PathKind}; 14use crate::path::{ModPath, PathKind};
14 15
@@ -34,6 +35,7 @@ pub(crate) fn lower_use_tree(
34 } 35 }
35 } else { 36 } else {
36 let alias = tree.alias().and_then(|a| a.name()).map(|a| a.as_name()); 37 let alias = tree.alias().and_then(|a| a.name()).map(|a| a.as_name());
38 let is_glob = tree.has_star();
37 if let Some(ast_path) = tree.path() { 39 if let Some(ast_path) = tree.path() {
38 // Handle self in a path. 40 // Handle self in a path.
39 // E.g. `use something::{self, <...>}` 41 // E.g. `use something::{self, <...>}`
@@ -48,11 +50,15 @@ pub(crate) fn lower_use_tree(
48 } 50 }
49 } 51 }
50 if let Some(path) = convert_path(prefix, ast_path, hygiene) { 52 if let Some(path) = convert_path(prefix, ast_path, hygiene) {
51 let is_glob = tree.has_star();
52 cb(path, &tree, is_glob, alias) 53 cb(path, &tree, is_glob, alias)
53 } 54 }
54 // FIXME: report errors somewhere 55 // FIXME: report errors somewhere
55 // We get here if we do 56 // We get here if we do
57 } else if is_glob {
58 tested_by!(glob_enum_group);
59 if let Some(prefix) = prefix {
60 cb(prefix, &tree, is_glob, None)
61 }
56 } 62 }
57 } 63 }
58} 64}