diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-27 20:33:47 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-27 20:33:47 +0000 |
commit | efb63a7666cc9532d97fa7e0da14b540ae8bd5df (patch) | |
tree | c4c1b80d8e2dfbb6533cfbdf0bb647ddbeff9419 /crates/ra_hir/src/query_definitions.rs | |
parent | b26ab3603d8f73c8e57e9e90d44486a608bc9370 (diff) | |
parent | e0660506719476a0546e10bee816d7220be85440 (diff) |
Merge #330
330: WIP: introduce hir::Name r=matklad a=matklad
Currently we are using `SmolStr` throughout the hir as a name, but that is really suboptimal choice: we'll probably want some kind of interning in the future, and we'll definitely need to add hygene info to names. This PR aims to replace strings with a slightly more abstract `Name` type.
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r-- | crates/ra_hir/src/query_definitions.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs index 4a7958a12..e6241342a 100644 --- a/crates/ra_hir/src/query_definitions.rs +++ b/crates/ra_hir/src/query_definitions.rs | |||
@@ -11,7 +11,7 @@ use ra_syntax::{ | |||
11 | use ra_db::{SourceRootId, FileId, Cancelable,}; | 11 | use ra_db::{SourceRootId, FileId, Cancelable,}; |
12 | 12 | ||
13 | use crate::{ | 13 | use crate::{ |
14 | SourceFileItems, SourceItemId, DefKind, Function, DefId, | 14 | SourceFileItems, SourceItemId, DefKind, Function, DefId, Name, AsName, |
15 | db::HirDatabase, | 15 | db::HirDatabase, |
16 | function::{FnScopes, FnId}, | 16 | function::{FnScopes, FnId}, |
17 | module::{ | 17 | module::{ |
@@ -130,14 +130,14 @@ pub(crate) fn submodules( | |||
130 | 130 | ||
131 | pub(crate) fn modules<'a>( | 131 | pub(crate) fn modules<'a>( |
132 | root: impl ast::ModuleItemOwner<'a>, | 132 | root: impl ast::ModuleItemOwner<'a>, |
133 | ) -> impl Iterator<Item = (SmolStr, ast::Module<'a>)> { | 133 | ) -> impl Iterator<Item = (Name, ast::Module<'a>)> { |
134 | root.items() | 134 | root.items() |
135 | .filter_map(|item| match item { | 135 | .filter_map(|item| match item { |
136 | ast::ModuleItem::Module(m) => Some(m), | 136 | ast::ModuleItem::Module(m) => Some(m), |
137 | _ => None, | 137 | _ => None, |
138 | }) | 138 | }) |
139 | .filter_map(|module| { | 139 | .filter_map(|module| { |
140 | let name = module.name()?.text(); | 140 | let name = module.name()?.as_name(); |
141 | Some((name, module)) | 141 | Some((name, module)) |
142 | }) | 142 | }) |
143 | } | 143 | } |