aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-19 08:43:01 +0100
committerAleksey Kladov <[email protected]>2019-07-19 11:16:25 +0100
commite2b28f5bb8043e92b10f6a40696131007fc9dfe2 (patch)
treec14306038e386d71ddc894d63415bf8e9a94f7e8 /crates/ra_hir/src/code_model
parent7e02aa0efff228126ffc43e81e5e127e1b9e32dd (diff)
migrate ra_hir to the new rowan
Diffstat (limited to 'crates/ra_hir/src/code_model')
-rw-r--r--crates/ra_hir/src/code_model/docs.rs24
-rw-r--r--crates/ra_hir/src/code_model/src.rs44
2 files changed, 34 insertions, 34 deletions
diff --git a/crates/ra_hir/src/code_model/docs.rs b/crates/ra_hir/src/code_model/docs.rs
index 007ef315d..a2b4d8e97 100644
--- a/crates/ra_hir/src/code_model/docs.rs
+++ b/crates/ra_hir/src/code_model/docs.rs
@@ -71,21 +71,21 @@ pub(crate) fn documentation_query(
71 def: DocDef, 71 def: DocDef,
72) -> Option<Documentation> { 72) -> Option<Documentation> {
73 match def { 73 match def {
74 DocDef::Module(it) => docs_from_ast(&*it.declaration_source(db)?.ast), 74 DocDef::Module(it) => docs_from_ast(&it.declaration_source(db)?.ast),
75 DocDef::StructField(it) => match it.source(db).ast { 75 DocDef::StructField(it) => match it.source(db).ast {
76 FieldSource::Named(named) => docs_from_ast(&*named), 76 FieldSource::Named(named) => docs_from_ast(&named),
77 FieldSource::Pos(..) => None, 77 FieldSource::Pos(..) => None,
78 }, 78 },
79 DocDef::Struct(it) => docs_from_ast(&*it.source(db).ast), 79 DocDef::Struct(it) => docs_from_ast(&it.source(db).ast),
80 DocDef::Enum(it) => docs_from_ast(&*it.source(db).ast), 80 DocDef::Enum(it) => docs_from_ast(&it.source(db).ast),
81 DocDef::EnumVariant(it) => docs_from_ast(&*it.source(db).ast), 81 DocDef::EnumVariant(it) => docs_from_ast(&it.source(db).ast),
82 DocDef::Static(it) => docs_from_ast(&*it.source(db).ast), 82 DocDef::Static(it) => docs_from_ast(&it.source(db).ast),
83 DocDef::Const(it) => docs_from_ast(&*it.source(db).ast), 83 DocDef::Const(it) => docs_from_ast(&it.source(db).ast),
84 DocDef::Function(it) => docs_from_ast(&*it.source(db).ast), 84 DocDef::Function(it) => docs_from_ast(&it.source(db).ast),
85 DocDef::Union(it) => docs_from_ast(&*it.source(db).ast), 85 DocDef::Union(it) => docs_from_ast(&it.source(db).ast),
86 DocDef::Trait(it) => docs_from_ast(&*it.source(db).ast), 86 DocDef::Trait(it) => docs_from_ast(&it.source(db).ast),
87 DocDef::TypeAlias(it) => docs_from_ast(&*it.source(db).ast), 87 DocDef::TypeAlias(it) => docs_from_ast(&it.source(db).ast),
88 DocDef::MacroDef(it) => docs_from_ast(&*it.source(db).ast), 88 DocDef::MacroDef(it) => docs_from_ast(&it.source(db).ast),
89 } 89 }
90} 90}
91 91
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index 72451e0e7..32bd9c661 100644
--- a/crates/ra_hir/src/code_model/src.rs
+++ b/crates/ra_hir/src/code_model/src.rs
@@ -1,4 +1,4 @@
1use ra_syntax::{ast, TreeArc}; 1use ra_syntax::ast;
2 2
3use crate::{ 3use crate::{
4 ids::AstItemDef, AstDatabase, Const, DefDatabase, Enum, EnumVariant, FieldSource, Function, 4 ids::AstItemDef, AstDatabase, Const, DefDatabase, Enum, EnumVariant, FieldSource, Function,
@@ -34,7 +34,7 @@ impl Module {
34 pub fn declaration_source( 34 pub fn declaration_source(
35 self, 35 self,
36 db: &(impl DefDatabase + AstDatabase), 36 db: &(impl DefDatabase + AstDatabase),
37 ) -> Option<Source<TreeArc<ast::Module>>> { 37 ) -> Option<Source<ast::Module>> {
38 let def_map = db.crate_def_map(self.krate); 38 let def_map = db.crate_def_map(self.krate);
39 let decl = def_map[self.module_id].declaration?; 39 let decl = def_map[self.module_id].declaration?;
40 let ast = decl.to_node(db); 40 let ast = decl.to_node(db);
@@ -49,62 +49,62 @@ impl HasSource for StructField {
49 } 49 }
50} 50}
51impl HasSource for Struct { 51impl HasSource for Struct {
52 type Ast = TreeArc<ast::StructDef>; 52 type Ast = ast::StructDef;
53 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::StructDef>> { 53 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::StructDef> {
54 self.id.source(db) 54 self.id.source(db)
55 } 55 }
56} 56}
57impl HasSource for Union { 57impl HasSource for Union {
58 type Ast = TreeArc<ast::StructDef>; 58 type Ast = ast::StructDef;
59 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::StructDef>> { 59 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::StructDef> {
60 self.id.source(db) 60 self.id.source(db)
61 } 61 }
62} 62}
63impl HasSource for Enum { 63impl HasSource for Enum {
64 type Ast = TreeArc<ast::EnumDef>; 64 type Ast = ast::EnumDef;
65 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::EnumDef>> { 65 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::EnumDef> {
66 self.id.source(db) 66 self.id.source(db)
67 } 67 }
68} 68}
69impl HasSource for EnumVariant { 69impl HasSource for EnumVariant {
70 type Ast = TreeArc<ast::EnumVariant>; 70 type Ast = ast::EnumVariant;
71 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::EnumVariant>> { 71 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::EnumVariant> {
72 self.source_impl(db) 72 self.source_impl(db)
73 } 73 }
74} 74}
75impl HasSource for Function { 75impl HasSource for Function {
76 type Ast = TreeArc<ast::FnDef>; 76 type Ast = ast::FnDef;
77 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::FnDef>> { 77 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::FnDef> {
78 self.id.source(db) 78 self.id.source(db)
79 } 79 }
80} 80}
81impl HasSource for Const { 81impl HasSource for Const {
82 type Ast = TreeArc<ast::ConstDef>; 82 type Ast = ast::ConstDef;
83 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::ConstDef>> { 83 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::ConstDef> {
84 self.id.source(db) 84 self.id.source(db)
85 } 85 }
86} 86}
87impl HasSource for Static { 87impl HasSource for Static {
88 type Ast = TreeArc<ast::StaticDef>; 88 type Ast = ast::StaticDef;
89 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::StaticDef>> { 89 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::StaticDef> {
90 self.id.source(db) 90 self.id.source(db)
91 } 91 }
92} 92}
93impl HasSource for Trait { 93impl HasSource for Trait {
94 type Ast = TreeArc<ast::TraitDef>; 94 type Ast = ast::TraitDef;
95 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::TraitDef>> { 95 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::TraitDef> {
96 self.id.source(db) 96 self.id.source(db)
97 } 97 }
98} 98}
99impl HasSource for TypeAlias { 99impl HasSource for TypeAlias {
100 type Ast = TreeArc<ast::TypeAliasDef>; 100 type Ast = ast::TypeAliasDef;
101 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::TypeAliasDef>> { 101 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::TypeAliasDef> {
102 self.id.source(db) 102 self.id.source(db)
103 } 103 }
104} 104}
105impl HasSource for MacroDef { 105impl HasSource for MacroDef {
106 type Ast = TreeArc<ast::MacroCall>; 106 type Ast = ast::MacroCall;
107 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<TreeArc<ast::MacroCall>> { 107 fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source<ast::MacroCall> {
108 Source { file_id: self.id.0.file_id(), ast: self.id.0.to_node(db) } 108 Source { file_id: self.id.0.file_id(), ast: self.id.0.to_node(db) }
109 } 109 }
110} 110}