aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/descriptors
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-25 21:46:13 +0000
committerAleksey Kladov <[email protected]>2018-11-27 11:23:06 +0000
commited023929d5f3a53a3989371452291176d3ce543c (patch)
tree96b005cb9dd8e6ba304310a3358601a3e4a0273c /crates/ra_analysis/src/descriptors
parent8a572043e7effe1d0b36a0d247960111312edc2a (diff)
Switch to id-arena
Diffstat (limited to 'crates/ra_analysis/src/descriptors')
-rw-r--r--crates/ra_analysis/src/descriptors/function/scope.rs4
-rw-r--r--crates/ra_analysis/src/descriptors/module/mod.rs8
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/descriptors/function/scope.rs b/crates/ra_analysis/src/descriptors/function/scope.rs
index 54d7fa456..5307a0a8e 100644
--- a/crates/ra_analysis/src/descriptors/function/scope.rs
+++ b/crates/ra_analysis/src/descriptors/function/scope.rs
@@ -58,13 +58,13 @@ impl FnScopes {
58 }) 58 })
59 } 59 }
60 fn root_scope(&mut self) -> ScopeId { 60 fn root_scope(&mut self) -> ScopeId {
61 self.scopes.push(ScopeData { 61 self.scopes.alloc(ScopeData {
62 parent: None, 62 parent: None,
63 entries: vec![], 63 entries: vec![],
64 }) 64 })
65 } 65 }
66 fn new_scope(&mut self, parent: ScopeId) -> ScopeId { 66 fn new_scope(&mut self, parent: ScopeId) -> ScopeId {
67 self.scopes.push(ScopeData { 67 self.scopes.alloc(ScopeData {
68 parent: Some(parent), 68 parent: Some(parent),
69 entries: vec![], 69 entries: vec![],
70 }) 70 })
diff --git a/crates/ra_analysis/src/descriptors/module/mod.rs b/crates/ra_analysis/src/descriptors/module/mod.rs
index 54ff95b66..a6eaec178 100644
--- a/crates/ra_analysis/src/descriptors/module/mod.rs
+++ b/crates/ra_analysis/src/descriptors/module/mod.rs
@@ -166,12 +166,12 @@ pub(crate) struct ModuleTree {
166 166
167impl ModuleTree { 167impl ModuleTree {
168 fn modules<'a>(&'a self) -> impl Iterator<Item = ModuleId> + 'a { 168 fn modules<'a>(&'a self) -> impl Iterator<Item = ModuleId> + 'a {
169 self.mods.keys() 169 self.mods.iter().map(|(id, _)| id)
170 } 170 }
171 171
172 fn modules_for_source(&self, source: ModuleSource) -> Vec<ModuleId> { 172 fn modules_for_source(&self, source: ModuleSource) -> Vec<ModuleId> {
173 self.mods 173 self.mods
174 .items() 174 .iter()
175 .filter(|(_idx, it)| it.source == source) 175 .filter(|(_idx, it)| it.source == source)
176 .map(|(idx, _)| idx) 176 .map(|(idx, _)| idx)
177 .collect() 177 .collect()
@@ -333,11 +333,11 @@ struct LinkData {
333 333
334impl ModuleTree { 334impl ModuleTree {
335 fn push_mod(&mut self, data: ModuleData) -> ModuleId { 335 fn push_mod(&mut self, data: ModuleData) -> ModuleId {
336 self.mods.push(data) 336 self.mods.alloc(data)
337 } 337 }
338 fn push_link(&mut self, data: LinkData) -> LinkId { 338 fn push_link(&mut self, data: LinkData) -> LinkId {
339 let owner = data.owner; 339 let owner = data.owner;
340 let id = self.links.push(data); 340 let id = self.links.alloc(data);
341 self.mods[owner].children.push(id); 341 self.mods[owner].children.push(id);
342 id 342 id
343 } 343 }