From e2b28f5bb8043e92b10f6a40696131007fc9dfe2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 19 Jul 2019 10:43:01 +0300 Subject: migrate ra_hir to the new rowan --- crates/ra_hir/src/code_model/docs.rs | 24 ++++++++++---------- crates/ra_hir/src/code_model/src.rs | 44 ++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'crates/ra_hir/src/code_model') 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( def: DocDef, ) -> Option { match def { - DocDef::Module(it) => docs_from_ast(&*it.declaration_source(db)?.ast), + DocDef::Module(it) => docs_from_ast(&it.declaration_source(db)?.ast), DocDef::StructField(it) => match it.source(db).ast { - FieldSource::Named(named) => docs_from_ast(&*named), + FieldSource::Named(named) => docs_from_ast(&named), FieldSource::Pos(..) => None, }, - DocDef::Struct(it) => docs_from_ast(&*it.source(db).ast), - DocDef::Enum(it) => docs_from_ast(&*it.source(db).ast), - DocDef::EnumVariant(it) => docs_from_ast(&*it.source(db).ast), - DocDef::Static(it) => docs_from_ast(&*it.source(db).ast), - DocDef::Const(it) => docs_from_ast(&*it.source(db).ast), - DocDef::Function(it) => docs_from_ast(&*it.source(db).ast), - DocDef::Union(it) => docs_from_ast(&*it.source(db).ast), - DocDef::Trait(it) => docs_from_ast(&*it.source(db).ast), - DocDef::TypeAlias(it) => docs_from_ast(&*it.source(db).ast), - DocDef::MacroDef(it) => docs_from_ast(&*it.source(db).ast), + DocDef::Struct(it) => docs_from_ast(&it.source(db).ast), + DocDef::Enum(it) => docs_from_ast(&it.source(db).ast), + DocDef::EnumVariant(it) => docs_from_ast(&it.source(db).ast), + DocDef::Static(it) => docs_from_ast(&it.source(db).ast), + DocDef::Const(it) => docs_from_ast(&it.source(db).ast), + DocDef::Function(it) => docs_from_ast(&it.source(db).ast), + DocDef::Union(it) => docs_from_ast(&it.source(db).ast), + DocDef::Trait(it) => docs_from_ast(&it.source(db).ast), + DocDef::TypeAlias(it) => docs_from_ast(&it.source(db).ast), + DocDef::MacroDef(it) => docs_from_ast(&it.source(db).ast), } } 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 @@ -use ra_syntax::{ast, TreeArc}; +use ra_syntax::ast; use crate::{ ids::AstItemDef, AstDatabase, Const, DefDatabase, Enum, EnumVariant, FieldSource, Function, @@ -34,7 +34,7 @@ impl Module { pub fn declaration_source( self, db: &(impl DefDatabase + AstDatabase), - ) -> Option>> { + ) -> Option> { let def_map = db.crate_def_map(self.krate); let decl = def_map[self.module_id].declaration?; let ast = decl.to_node(db); @@ -49,62 +49,62 @@ impl HasSource for StructField { } } impl HasSource for Struct { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::StructDef; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.id.source(db) } } impl HasSource for Union { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::StructDef; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.id.source(db) } } impl HasSource for Enum { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::EnumDef; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.id.source(db) } } impl HasSource for EnumVariant { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::EnumVariant; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.source_impl(db) } } impl HasSource for Function { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::FnDef; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.id.source(db) } } impl HasSource for Const { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::ConstDef; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.id.source(db) } } impl HasSource for Static { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::StaticDef; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.id.source(db) } } impl HasSource for Trait { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::TraitDef; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.id.source(db) } } impl HasSource for TypeAlias { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::TypeAliasDef; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { self.id.source(db) } } impl HasSource for MacroDef { - type Ast = TreeArc; - fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source> { + type Ast = ast::MacroCall; + fn source(self, db: &(impl DefDatabase + AstDatabase)) -> Source { Source { file_id: self.id.0.file_id(), ast: self.id.0.to_node(db) } } } -- cgit v1.2.3