aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/nameres/lower.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-23 14:37:10 +0000
committerAleksey Kladov <[email protected]>2019-01-23 14:37:10 +0000
commit7b901f86cd1d0198994e5a2ab7eea18f444dd148 (patch)
treedfe8364efeeaca6f8f32e1d922fb615119b8012b /crates/ra_hir/src/nameres/lower.rs
parent81fcfc55d247bfe6090741f2e4ae9aa89947bf32 (diff)
move SyntaxPtr to ra_syntax
Diffstat (limited to 'crates/ra_hir/src/nameres/lower.rs')
-rw-r--r--crates/ra_hir/src/nameres/lower.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir/src/nameres/lower.rs b/crates/ra_hir/src/nameres/lower.rs
index 52448644c..ab6f3a9bc 100644
--- a/crates/ra_hir/src/nameres/lower.rs
+++ b/crates/ra_hir/src/nameres/lower.rs
@@ -1,10 +1,10 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use ra_syntax::{ 3use ra_syntax::{
4 SyntaxKind, AstNode, SourceFile, TreeArc, 4 SyntaxKind, AstNode, SourceFile, TreeArc, SyntaxNodePtr,
5 ast::{self, ModuleItemOwner}, 5 ast::{self, ModuleItemOwner},
6}; 6};
7use ra_db::{SourceRootId, LocalSyntaxPtr}; 7use ra_db::{SourceRootId};
8use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; 8use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
9 9
10use crate::{ 10use crate::{
@@ -72,13 +72,13 @@ pub struct LoweredModule {
72 72
73#[derive(Debug, Default, PartialEq, Eq)] 73#[derive(Debug, Default, PartialEq, Eq)]
74pub struct ImportSourceMap { 74pub struct ImportSourceMap {
75 map: ArenaMap<ImportId, LocalSyntaxPtr>, 75 map: ArenaMap<ImportId, SyntaxNodePtr>,
76} 76}
77 77
78impl ImportSourceMap { 78impl ImportSourceMap {
79 fn insert(&mut self, import: ImportId, segment: &ast::PathSegment) { 79 fn insert(&mut self, import: ImportId, segment: &ast::PathSegment) {
80 self.map 80 self.map
81 .insert(import, LocalSyntaxPtr::new(segment.syntax())) 81 .insert(import, SyntaxNodePtr::new(segment.syntax()))
82 } 82 }
83 83
84 pub fn get(&self, source: &ModuleSource, import: ImportId) -> TreeArc<ast::PathSegment> { 84 pub fn get(&self, source: &ModuleSource, import: ImportId) -> TreeArc<ast::PathSegment> {
@@ -87,7 +87,7 @@ impl ImportSourceMap {
87 ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), 87 ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(),
88 }; 88 };
89 89
90 ast::PathSegment::cast(&self.map[import].resolve(file)) 90 ast::PathSegment::cast(self.map[import].to_node(file))
91 .unwrap() 91 .unwrap()
92 .to_owned() 92 .to_owned()
93 } 93 }