aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/path.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 1b3fb4306..e04d00900 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -86,25 +86,22 @@ fn expand_use_tree(
86 }, 86 },
87 }; 87 };
88 for child_tree in use_tree_list.use_trees() { 88 for child_tree in use_tree_list.use_trees() {
89 expand_use_tree(prefix.clone(), child_tree, cb);
90 }
91 } else {
92 if let Some(ast_path) = tree.path() {
89 // Handle self in a path. 93 // Handle self in a path.
90 // E.g. `use something::{self, <...>}` 94 // E.g. `use something::{self, <...>}`
91 if let Some(path) = child_tree.path() { 95 if ast_path.qualifier().is_none() {
92 if path.qualifier().is_none() { 96 if let Some(segment) = ast_path.segment() {
93 if let Some(segment) = path.segment() { 97 if segment.kind() == Some(ast::PathSegmentKind::SelfKw) {
94 if segment.kind() == Some(ast::PathSegmentKind::SelfKw) { 98 if let Some(prefix) = prefix {
95 /* TODO: Work out what on earth range means in this callback */ 99 cb(prefix, Some(segment.syntax().range()));
96 if let Some(prefix) = prefix.clone() { 100 return;
97 cb(prefix, Some(segment.syntax().range()));
98 continue;
99 }
100 } 101 }
101 } 102 }
102 } 103 }
103 } 104 }
104 expand_use_tree(prefix.clone(), child_tree, cb);
105 }
106 } else {
107 if let Some(ast_path) = tree.path() {
108 if let Some(path) = convert_path(prefix, ast_path) { 105 if let Some(path) = convert_path(prefix, ast_path) {
109 let range = if tree.has_star() { 106 let range = if tree.has_star() {
110 None 107 None
@@ -114,6 +111,8 @@ fn expand_use_tree(
114 }; 111 };
115 cb(path, range) 112 cb(path, range)
116 } 113 }
114 // TODO: report errors somewhere
115 // We get here if we do
117 } 116 }
118 } 117 }
119} 118}