aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/descriptors
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/descriptors')
-rw-r--r--crates/ra_analysis/src/descriptors/module/scope.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/scope.rs b/crates/ra_analysis/src/descriptors/module/scope.rs
index 0f8f325ab..846b8b44f 100644
--- a/crates/ra_analysis/src/descriptors/module/scope.rs
+++ b/crates/ra_analysis/src/descriptors/module/scope.rs
@@ -30,8 +30,12 @@ enum EntryKind {
30 30
31impl ModuleScope { 31impl ModuleScope {
32 pub fn new(file: &File) -> ModuleScope { 32 pub fn new(file: &File) -> ModuleScope {
33 ModuleScope::from_items(file.ast().items())
34 }
35
36 pub fn from_items<'a>(items: impl Iterator<Item = ast::ModuleItem<'a>>) -> ModuleScope {
33 let mut entries = Vec::new(); 37 let mut entries = Vec::new();
34 for item in file.ast().items() { 38 for item in items {
35 let entry = match item { 39 let entry = match item {
36 ast::ModuleItem::StructDef(item) => Entry::new(item), 40 ast::ModuleItem::StructDef(item) => Entry::new(item),
37 ast::ModuleItem::EnumDef(item) => Entry::new(item), 41 ast::ModuleItem::EnumDef(item) => Entry::new(item),