aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-03-26 16:00:11 +0000
committerAleksey Kladov <[email protected]>2019-03-26 16:11:01 +0000
commite28db444dfdc797002bd3561940cde2659b831de (patch)
tree1be9aba5d9d7f7ebf684208f4de702a44c54bae8 /crates/ra_hir/src/nameres
parentb17217b34afbdbdc6b1d8ec480fcf06ec4bd587e (diff)
rename
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r--crates/ra_hir/src/nameres/raw.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs
index 984478adc..0936229ac 100644
--- a/crates/ra_hir/src/nameres/raw.rs
+++ b/crates/ra_hir/src/nameres/raw.rs
@@ -12,7 +12,7 @@ use ra_syntax::{
12 12
13use crate::{ 13use crate::{
14 DefDatabase, Name, AsName, Path, HirFileId, ModuleSource, 14 DefDatabase, Name, AsName, Path, HirFileId, ModuleSource,
15 SourceFileItems, FileAstId, 15 AstIdMap, FileAstId,
16}; 16};
17 17
18/// `RawItems` is a set of top-level items in a file (except for impls). 18/// `RawItems` is a set of top-level items in a file (except for impls).
@@ -60,7 +60,7 @@ impl RawItems {
60 ) -> (Arc<RawItems>, Arc<ImportSourceMap>) { 60 ) -> (Arc<RawItems>, Arc<ImportSourceMap>) {
61 let mut collector = RawItemsCollector { 61 let mut collector = RawItemsCollector {
62 raw_items: RawItems::default(), 62 raw_items: RawItems::default(),
63 source_file_items: db.file_items(file_id.into()), 63 source_ast_id_map: db.ast_id_map(file_id.into()),
64 source_map: ImportSourceMap::default(), 64 source_map: ImportSourceMap::default(),
65 }; 65 };
66 let source_file = db.hir_parse(file_id); 66 let source_file = db.hir_parse(file_id);
@@ -167,7 +167,7 @@ pub(super) struct MacroData {
167 167
168struct RawItemsCollector { 168struct RawItemsCollector {
169 raw_items: RawItems, 169 raw_items: RawItems,
170 source_file_items: Arc<SourceFileItems>, 170 source_ast_id_map: Arc<AstIdMap>,
171 source_map: ImportSourceMap, 171 source_map: ImportSourceMap,
172} 172}
173 173
@@ -200,25 +200,25 @@ impl RawItemsCollector {
200 return; 200 return;
201 } 201 }
202 ast::ModuleItemKind::StructDef(it) => { 202 ast::ModuleItemKind::StructDef(it) => {
203 (DefKind::Struct(self.source_file_items.ast_id(it)), it.name()) 203 (DefKind::Struct(self.source_ast_id_map.ast_id(it)), it.name())
204 } 204 }
205 ast::ModuleItemKind::EnumDef(it) => { 205 ast::ModuleItemKind::EnumDef(it) => {
206 (DefKind::Enum(self.source_file_items.ast_id(it)), it.name()) 206 (DefKind::Enum(self.source_ast_id_map.ast_id(it)), it.name())
207 } 207 }
208 ast::ModuleItemKind::FnDef(it) => { 208 ast::ModuleItemKind::FnDef(it) => {
209 (DefKind::Function(self.source_file_items.ast_id(it)), it.name()) 209 (DefKind::Function(self.source_ast_id_map.ast_id(it)), it.name())
210 } 210 }
211 ast::ModuleItemKind::TraitDef(it) => { 211 ast::ModuleItemKind::TraitDef(it) => {
212 (DefKind::Trait(self.source_file_items.ast_id(it)), it.name()) 212 (DefKind::Trait(self.source_ast_id_map.ast_id(it)), it.name())
213 } 213 }
214 ast::ModuleItemKind::TypeAliasDef(it) => { 214 ast::ModuleItemKind::TypeAliasDef(it) => {
215 (DefKind::TypeAlias(self.source_file_items.ast_id(it)), it.name()) 215 (DefKind::TypeAlias(self.source_ast_id_map.ast_id(it)), it.name())
216 } 216 }
217 ast::ModuleItemKind::ConstDef(it) => { 217 ast::ModuleItemKind::ConstDef(it) => {
218 (DefKind::Const(self.source_file_items.ast_id(it)), it.name()) 218 (DefKind::Const(self.source_ast_id_map.ast_id(it)), it.name())
219 } 219 }
220 ast::ModuleItemKind::StaticDef(it) => { 220 ast::ModuleItemKind::StaticDef(it) => {
221 (DefKind::Static(self.source_file_items.ast_id(it)), it.name()) 221 (DefKind::Static(self.source_ast_id_map.ast_id(it)), it.name())
222 } 222 }
223 }; 223 };
224 if let Some(name) = name { 224 if let Some(name) = name {
@@ -233,7 +233,7 @@ impl RawItemsCollector {
233 Some(it) => it.as_name(), 233 Some(it) => it.as_name(),
234 None => return, 234 None => return,
235 }; 235 };
236 let ast_id = self.source_file_items.ast_id(module); 236 let ast_id = self.source_ast_id_map.ast_id(module);
237 if module.has_semi() { 237 if module.has_semi() {
238 let item = self.raw_items.modules.alloc(ModuleData::Declaration { name, ast_id }); 238 let item = self.raw_items.modules.alloc(ModuleData::Declaration { name, ast_id });
239 self.push_item(current_module, RawItem::Module(item)); 239 self.push_item(current_module, RawItem::Module(item));
@@ -297,7 +297,7 @@ impl RawItemsCollector {
297 }; 297 };
298 298
299 let name = m.name().map(|it| it.as_name()); 299 let name = m.name().map(|it| it.as_name());
300 let ast_id = self.source_file_items.ast_id(m); 300 let ast_id = self.source_ast_id_map.ast_id(m);
301 let export = m.has_atom_attr("macro_export"); 301 let export = m.has_atom_attr("macro_export");
302 let m = self.raw_items.macros.alloc(MacroData { ast_id, path, name, export }); 302 let m = self.raw_items.macros.alloc(MacroData { ast_id, path, name, export });
303 self.push_item(current_module, RawItem::Macro(m)); 303 self.push_item(current_module, RawItem::Macro(m));