aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/path.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-04-02 11:26:09 +0100
committerAleksey Kladov <[email protected]>2019-04-02 11:26:09 +0100
commit49f13d3a9bb5bf3ab92c3fbf23ad79cb001b76e0 (patch)
tree55a59317e363ba5aa419366643502ce3656e1bb2 /crates/ra_hir/src/path.rs
parentab19ff16e55d4d64445fc2809e52d913ad492040 (diff)
fix a panic with glob-import missing a source map
Diffstat (limited to 'crates/ra_hir/src/path.rs')
-rw-r--r--crates/ra_hir/src/path.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 6cc8104f4..5449cddfd 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -46,7 +46,7 @@ impl Path {
46 /// Calls `cb` with all paths, represented by this use item. 46 /// Calls `cb` with all paths, represented by this use item.
47 pub fn expand_use_item<'a>( 47 pub fn expand_use_item<'a>(
48 item: &'a ast::UseItem, 48 item: &'a ast::UseItem,
49 mut cb: impl FnMut(Path, Option<&'a ast::PathSegment>, Option<Name>), 49 mut cb: impl FnMut(Path, &'a ast::UseTree, bool, Option<Name>),
50 ) { 50 ) {
51 if let Some(tree) = item.use_tree() { 51 if let Some(tree) = item.use_tree() {
52 expand_use_tree(None, tree, &mut cb); 52 expand_use_tree(None, tree, &mut cb);
@@ -156,7 +156,7 @@ impl From<Name> for Path {
156fn expand_use_tree<'a>( 156fn expand_use_tree<'a>(
157 prefix: Option<Path>, 157 prefix: Option<Path>,
158 tree: &'a ast::UseTree, 158 tree: &'a ast::UseTree,
159 cb: &mut impl FnMut(Path, Option<&'a ast::PathSegment>, Option<Name>), 159 cb: &mut impl FnMut(Path, &'a ast::UseTree, bool, Option<Name>),
160) { 160) {
161 if let Some(use_tree_list) = tree.use_tree_list() { 161 if let Some(use_tree_list) = tree.use_tree_list() {
162 let prefix = match tree.path() { 162 let prefix = match tree.path() {
@@ -181,18 +181,15 @@ fn expand_use_tree<'a>(
181 if let Some(segment) = ast_path.segment() { 181 if let Some(segment) = ast_path.segment() {
182 if segment.kind() == Some(ast::PathSegmentKind::SelfKw) { 182 if segment.kind() == Some(ast::PathSegmentKind::SelfKw) {
183 if let Some(prefix) = prefix { 183 if let Some(prefix) = prefix {
184 cb(prefix, Some(segment), alias); 184 cb(prefix, tree, false, alias);
185 return; 185 return;
186 } 186 }
187 } 187 }
188 } 188 }
189 } 189 }
190 if let Some(path) = convert_path(prefix, ast_path) { 190 if let Some(path) = convert_path(prefix, ast_path) {
191 if tree.has_star() { 191 let is_glob = tree.has_star();
192 cb(path, None, alias) 192 cb(path, tree, is_glob, alias)
193 } else if let Some(segment) = ast_path.segment() {
194 cb(path, Some(segment), alias)
195 };
196 } 193 }
197 // FIXME: report errors somewhere 194 // FIXME: report errors somewhere
198 // We get here if we do 195 // We get here if we do