aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/display
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-20 06:40:36 +0000
committerAleksey Kladov <[email protected]>2019-11-20 06:42:30 +0000
commit36e3fc9d5413f7e6e17e82867aae1318645880a3 (patch)
tree166ee3c45f99611f7c20740c2a246f5b3bed41a3 /crates/ra_ide_api/src/display
parente975f6364cb3caf50467835afb0dafce887f51f0 (diff)
Rename Source::ast -> Source::value
Diffstat (limited to 'crates/ra_ide_api/src/display')
-rw-r--r--crates/ra_ide_api/src/display/function_signature.rs8
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs28
2 files changed, 18 insertions, 18 deletions
diff --git a/crates/ra_ide_api/src/display/function_signature.rs b/crates/ra_ide_api/src/display/function_signature.rs
index 9075ca443..f42dffc87 100644
--- a/crates/ra_ide_api/src/display/function_signature.rs
+++ b/crates/ra_ide_api/src/display/function_signature.rs
@@ -48,12 +48,12 @@ impl FunctionSignature {
48 48
49 pub(crate) fn from_hir(db: &db::RootDatabase, function: hir::Function) -> Self { 49 pub(crate) fn from_hir(db: &db::RootDatabase, function: hir::Function) -> Self {
50 let doc = function.docs(db); 50 let doc = function.docs(db);
51 let ast_node = function.source(db).ast; 51 let ast_node = function.source(db).value;
52 FunctionSignature::from(&ast_node).with_doc_opt(doc) 52 FunctionSignature::from(&ast_node).with_doc_opt(doc)
53 } 53 }
54 54
55 pub(crate) fn from_struct(db: &db::RootDatabase, st: hir::Struct) -> Option<Self> { 55 pub(crate) fn from_struct(db: &db::RootDatabase, st: hir::Struct) -> Option<Self> {
56 let node: ast::StructDef = st.source(db).ast; 56 let node: ast::StructDef = st.source(db).value;
57 match node.kind() { 57 match node.kind() {
58 ast::StructKind::Named(_) => return None, 58 ast::StructKind::Named(_) => return None,
59 _ => (), 59 _ => (),
@@ -87,7 +87,7 @@ impl FunctionSignature {
87 db: &db::RootDatabase, 87 db: &db::RootDatabase,
88 variant: hir::EnumVariant, 88 variant: hir::EnumVariant,
89 ) -> Option<Self> { 89 ) -> Option<Self> {
90 let node: ast::EnumVariant = variant.source(db).ast; 90 let node: ast::EnumVariant = variant.source(db).value;
91 match node.kind() { 91 match node.kind() {
92 ast::StructKind::Named(_) | ast::StructKind::Unit => return None, 92 ast::StructKind::Named(_) | ast::StructKind::Unit => return None,
93 _ => (), 93 _ => (),
@@ -126,7 +126,7 @@ impl FunctionSignature {
126 } 126 }
127 127
128 pub(crate) fn from_macro(db: &db::RootDatabase, macro_def: hir::MacroDef) -> Option<Self> { 128 pub(crate) fn from_macro(db: &db::RootDatabase, macro_def: hir::MacroDef) -> Option<Self> {
129 let node: ast::MacroCall = macro_def.source(db).ast; 129 let node: ast::MacroCall = macro_def.source(db).value;
130 130
131 let params = vec![]; 131 let params = vec![];
132 132
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index b30ef8e05..50accafd0 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -86,9 +86,9 @@ impl NavigationTarget {
86 name, 86 name,
87 None, 87 None,
88 frange.range, 88 frange.range,
89 src.ast.syntax().kind(), 89 src.value.syntax().kind(),
90 src.ast.doc_comment_text(), 90 src.value.doc_comment_text(),
91 src.ast.short_label(), 91 src.value.short_label(),
92 ); 92 );
93 } 93 }
94 module.to_nav(db) 94 module.to_nav(db)
@@ -146,9 +146,9 @@ impl NavigationTarget {
146 description: Option<String>, 146 description: Option<String>,
147 ) -> NavigationTarget { 147 ) -> NavigationTarget {
148 //FIXME: use `_` instead of empty string 148 //FIXME: use `_` instead of empty string
149 let name = node.ast.name().map(|it| it.text().clone()).unwrap_or_default(); 149 let name = node.value.name().map(|it| it.text().clone()).unwrap_or_default();
150 let focus_range = 150 let focus_range =
151 node.ast.name().map(|it| original_range(db, node.with_ast(it.syntax())).range); 151 node.value.name().map(|it| original_range(db, node.with_ast(it.syntax())).range);
152 let frange = original_range(db, node.map(|it| it.syntax())); 152 let frange = original_range(db, node.map(|it| it.syntax()));
153 153
154 NavigationTarget::from_syntax( 154 NavigationTarget::from_syntax(
@@ -156,7 +156,7 @@ impl NavigationTarget {
156 name, 156 name,
157 focus_range, 157 focus_range,
158 frange.range, 158 frange.range,
159 node.ast.syntax().kind(), 159 node.value.syntax().kind(),
160 docs, 160 docs,
161 description, 161 description,
162 ) 162 )
@@ -220,8 +220,8 @@ where
220 NavigationTarget::from_named( 220 NavigationTarget::from_named(
221 db, 221 db,
222 src.as_ref().map(|it| it as &dyn ast::NameOwner), 222 src.as_ref().map(|it| it as &dyn ast::NameOwner),
223 src.ast.doc_comment_text(), 223 src.value.doc_comment_text(),
224 src.ast.short_label(), 224 src.value.short_label(),
225 ) 225 )
226 } 226 }
227} 227}
@@ -230,7 +230,7 @@ impl ToNav for hir::Module {
230 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 230 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
231 let src = self.definition_source(db); 231 let src = self.definition_source(db);
232 let name = self.name(db).map(|it| it.to_string().into()).unwrap_or_default(); 232 let name = self.name(db).map(|it| it.to_string().into()).unwrap_or_default();
233 match &src.ast { 233 match &src.value {
234 ModuleSource::SourceFile(node) => { 234 ModuleSource::SourceFile(node) => {
235 let frange = original_range(db, src.with_ast(node.syntax())); 235 let frange = original_range(db, src.with_ast(node.syntax()));
236 236
@@ -271,7 +271,7 @@ impl ToNav for hir::ImplBlock {
271 "impl".into(), 271 "impl".into(),
272 None, 272 None,
273 frange.range, 273 frange.range,
274 src.ast.syntax().kind(), 274 src.value.syntax().kind(),
275 None, 275 None,
276 None, 276 None,
277 ) 277 )
@@ -282,7 +282,7 @@ impl ToNav for hir::StructField {
282 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 282 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
283 let src = self.source(db); 283 let src = self.source(db);
284 284
285 match &src.ast { 285 match &src.value {
286 FieldSource::Named(it) => NavigationTarget::from_named( 286 FieldSource::Named(it) => NavigationTarget::from_named(
287 db, 287 db,
288 src.with_ast(it), 288 src.with_ast(it),
@@ -308,11 +308,11 @@ impl ToNav for hir::StructField {
308impl ToNav for hir::MacroDef { 308impl ToNav for hir::MacroDef {
309 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 309 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
310 let src = self.source(db); 310 let src = self.source(db);
311 log::debug!("nav target {:#?}", src.ast.syntax()); 311 log::debug!("nav target {:#?}", src.value.syntax());
312 NavigationTarget::from_named( 312 NavigationTarget::from_named(
313 db, 313 db,
314 src.as_ref().map(|it| it as &dyn ast::NameOwner), 314 src.as_ref().map(|it| it as &dyn ast::NameOwner),
315 src.ast.doc_comment_text(), 315 src.value.doc_comment_text(),
316 None, 316 None,
317 ) 317 )
318 } 318 }
@@ -341,7 +341,7 @@ impl ToNav for hir::AssocItem {
341impl ToNav for hir::Local { 341impl ToNav for hir::Local {
342 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 342 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
343 let src = self.source(db); 343 let src = self.source(db);
344 let (full_range, focus_range) = match src.ast { 344 let (full_range, focus_range) = match src.value {
345 Either::A(it) => { 345 Either::A(it) => {
346 (it.syntax().text_range(), it.name().map(|it| it.syntax().text_range())) 346 (it.syntax().text_range(), it.name().map(|it| it.syntax().text_range()))
347 } 347 }