diff options
author | Aleksey Kladov <[email protected]> | 2019-07-19 08:43:01 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-19 11:16:25 +0100 |
commit | e2b28f5bb8043e92b10f6a40696131007fc9dfe2 (patch) | |
tree | c14306038e386d71ddc894d63415bf8e9a94f7e8 /crates/ra_hir/src/ids.rs | |
parent | 7e02aa0efff228126ffc43e81e5e127e1b9e32dd (diff) |
migrate ra_hir to the new rowan
Diffstat (limited to 'crates/ra_hir/src/ids.rs')
-rw-r--r-- | crates/ra_hir/src/ids.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 83f5c3f39..05a18eb56 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs | |||
@@ -6,7 +6,7 @@ use std::{ | |||
6 | use mbe::MacroRules; | 6 | use mbe::MacroRules; |
7 | use ra_db::{salsa, FileId}; | 7 | use ra_db::{salsa, FileId}; |
8 | use ra_prof::profile; | 8 | use ra_prof::profile; |
9 | use ra_syntax::{ast, AstNode, Parse, SyntaxNode, TreeArc}; | 9 | use ra_syntax::{ast, AstNode, Parse, SyntaxNode}; |
10 | 10 | ||
11 | use crate::{AstDatabase, AstId, DefDatabase, FileAstId, InternDatabase, Module, Source}; | 11 | use crate::{AstDatabase, AstId, DefDatabase, FileAstId, InternDatabase, Module, Source}; |
12 | 12 | ||
@@ -58,11 +58,11 @@ impl HirFileId { | |||
58 | pub(crate) fn parse_or_expand_query( | 58 | pub(crate) fn parse_or_expand_query( |
59 | db: &impl AstDatabase, | 59 | db: &impl AstDatabase, |
60 | file_id: HirFileId, | 60 | file_id: HirFileId, |
61 | ) -> Option<TreeArc<SyntaxNode>> { | 61 | ) -> Option<SyntaxNode> { |
62 | match file_id.0 { | 62 | match file_id.0 { |
63 | HirFileIdRepr::File(file_id) => Some(db.parse(file_id).tree().syntax().to_owned()), | 63 | HirFileIdRepr::File(file_id) => Some(db.parse(file_id).tree().syntax().clone()), |
64 | HirFileIdRepr::Macro(macro_file) => { | 64 | HirFileIdRepr::Macro(macro_file) => { |
65 | db.parse_macro(macro_file).map(|it| it.tree().to_owned()) | 65 | db.parse_macro(macro_file).map(|it| it.syntax_node()) |
66 | } | 66 | } |
67 | } | 67 | } |
68 | } | 68 | } |
@@ -123,7 +123,7 @@ pub struct MacroDefId(pub(crate) AstId<ast::MacroCall>); | |||
123 | pub(crate) fn macro_def_query(db: &impl AstDatabase, id: MacroDefId) -> Option<Arc<MacroRules>> { | 123 | pub(crate) fn macro_def_query(db: &impl AstDatabase, id: MacroDefId) -> Option<Arc<MacroRules>> { |
124 | let macro_call = id.0.to_node(db); | 124 | let macro_call = id.0.to_node(db); |
125 | let arg = macro_call.token_tree()?; | 125 | let arg = macro_call.token_tree()?; |
126 | let (tt, _) = mbe::ast_to_token_tree(arg).or_else(|| { | 126 | let (tt, _) = mbe::ast_to_token_tree(&arg).or_else(|| { |
127 | log::warn!("fail on macro_def to token tree: {:#?}", arg); | 127 | log::warn!("fail on macro_def to token tree: {:#?}", arg); |
128 | None | 128 | None |
129 | })?; | 129 | })?; |
@@ -138,7 +138,7 @@ pub(crate) fn macro_arg_query(db: &impl AstDatabase, id: MacroCallId) -> Option< | |||
138 | let loc = id.loc(db); | 138 | let loc = id.loc(db); |
139 | let macro_call = loc.ast_id.to_node(db); | 139 | let macro_call = loc.ast_id.to_node(db); |
140 | let arg = macro_call.token_tree()?; | 140 | let arg = macro_call.token_tree()?; |
141 | let (tt, _) = mbe::ast_to_token_tree(arg)?; | 141 | let (tt, _) = mbe::ast_to_token_tree(&arg)?; |
142 | Some(Arc::new(tt)) | 142 | Some(Arc::new(tt)) |
143 | } | 143 | } |
144 | 144 | ||
@@ -262,7 +262,7 @@ pub(crate) trait AstItemDef<N: AstNode>: salsa::InternKey + Clone { | |||
262 | let loc = ItemLoc { module: ctx.module, ast_id: ast_id.with_file_id(ctx.file_id) }; | 262 | let loc = ItemLoc { module: ctx.module, ast_id: ast_id.with_file_id(ctx.file_id) }; |
263 | Self::intern(ctx.db, loc) | 263 | Self::intern(ctx.db, loc) |
264 | } | 264 | } |
265 | fn source(self, db: &(impl AstDatabase + DefDatabase)) -> Source<TreeArc<N>> { | 265 | fn source(self, db: &(impl AstDatabase + DefDatabase)) -> Source<N> { |
266 | let loc = self.lookup_intern(db); | 266 | let loc = self.lookup_intern(db); |
267 | let ast = loc.ast_id.to_node(db); | 267 | let ast = loc.ast_id.to_node(db); |
268 | Source { file_id: loc.ast_id.file_id(), ast } | 268 | Source { file_id: loc.ast_id.file_id(), ast } |