aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/references/classify.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-20 10:09:21 +0000
committerAleksey Kladov <[email protected]>2019-11-20 10:09:21 +0000
commit51baaf298d4ac56036062786bf070aeab7ab8e79 (patch)
treebd923b623ffe43df04ef00e1f0662c00c0d919d1 /crates/ra_ide_api/src/references/classify.rs
parentfa50b16cb2309c0c4fcb4e90378993a1f3d2ffb6 (diff)
Rename with_ast -> with_value
Diffstat (limited to 'crates/ra_ide_api/src/references/classify.rs')
-rw-r--r--crates/ra_ide_api/src/references/classify.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/crates/ra_ide_api/src/references/classify.rs b/crates/ra_ide_api/src/references/classify.rs
index 333264540..4a4b030f8 100644
--- a/crates/ra_ide_api/src/references/classify.rs
+++ b/crates/ra_ide_api/src/references/classify.rs
@@ -18,7 +18,7 @@ pub(crate) fn classify_name(db: &RootDatabase, name: Source<&ast::Name>) -> Opti
18 match_ast! { 18 match_ast! {
19 match parent { 19 match parent {
20 ast::BindPat(it) => { 20 ast::BindPat(it) => {
21 let src = name.with_ast(it); 21 let src = name.with_value(it);
22 let local = hir::Local::from_source(db, src)?; 22 let local = hir::Local::from_source(db, src)?;
23 Some(NameDefinition { 23 Some(NameDefinition {
24 visibility: None, 24 visibility: None,
@@ -28,7 +28,7 @@ pub(crate) fn classify_name(db: &RootDatabase, name: Source<&ast::Name>) -> Opti
28 }, 28 },
29 ast::RecordFieldDef(it) => { 29 ast::RecordFieldDef(it) => {
30 let ast = hir::FieldSource::Named(it); 30 let ast = hir::FieldSource::Named(it);
31 let src = name.with_ast(ast); 31 let src = name.with_value(ast);
32 let field = hir::StructField::from_source(db, src)?; 32 let field = hir::StructField::from_source(db, src)?;
33 Some(from_struct_field(db, field)) 33 Some(from_struct_field(db, field))
34 }, 34 },
@@ -36,42 +36,42 @@ pub(crate) fn classify_name(db: &RootDatabase, name: Source<&ast::Name>) -> Opti
36 let def = { 36 let def = {
37 if !it.has_semi() { 37 if !it.has_semi() {
38 let ast = hir::ModuleSource::Module(it); 38 let ast = hir::ModuleSource::Module(it);
39 let src = name.with_ast(ast); 39 let src = name.with_value(ast);
40 hir::Module::from_definition(db, src) 40 hir::Module::from_definition(db, src)
41 } else { 41 } else {
42 let src = name.with_ast(it); 42 let src = name.with_value(it);
43 hir::Module::from_declaration(db, src) 43 hir::Module::from_declaration(db, src)
44 } 44 }
45 }?; 45 }?;
46 Some(from_module_def(db, def.into(), None)) 46 Some(from_module_def(db, def.into(), None))
47 }, 47 },
48 ast::StructDef(it) => { 48 ast::StructDef(it) => {
49 let src = name.with_ast(it); 49 let src = name.with_value(it);
50 let def = hir::Struct::from_source(db, src)?; 50 let def = hir::Struct::from_source(db, src)?;
51 Some(from_module_def(db, def.into(), None)) 51 Some(from_module_def(db, def.into(), None))
52 }, 52 },
53 ast::EnumDef(it) => { 53 ast::EnumDef(it) => {
54 let src = name.with_ast(it); 54 let src = name.with_value(it);
55 let def = hir::Enum::from_source(db, src)?; 55 let def = hir::Enum::from_source(db, src)?;
56 Some(from_module_def(db, def.into(), None)) 56 Some(from_module_def(db, def.into(), None))
57 }, 57 },
58 ast::TraitDef(it) => { 58 ast::TraitDef(it) => {
59 let src = name.with_ast(it); 59 let src = name.with_value(it);
60 let def = hir::Trait::from_source(db, src)?; 60 let def = hir::Trait::from_source(db, src)?;
61 Some(from_module_def(db, def.into(), None)) 61 Some(from_module_def(db, def.into(), None))
62 }, 62 },
63 ast::StaticDef(it) => { 63 ast::StaticDef(it) => {
64 let src = name.with_ast(it); 64 let src = name.with_value(it);
65 let def = hir::Static::from_source(db, src)?; 65 let def = hir::Static::from_source(db, src)?;
66 Some(from_module_def(db, def.into(), None)) 66 Some(from_module_def(db, def.into(), None))
67 }, 67 },
68 ast::EnumVariant(it) => { 68 ast::EnumVariant(it) => {
69 let src = name.with_ast(it); 69 let src = name.with_value(it);
70 let def = hir::EnumVariant::from_source(db, src)?; 70 let def = hir::EnumVariant::from_source(db, src)?;
71 Some(from_module_def(db, def.into(), None)) 71 Some(from_module_def(db, def.into(), None))
72 }, 72 },
73 ast::FnDef(it) => { 73 ast::FnDef(it) => {
74 let src = name.with_ast(it); 74 let src = name.with_value(it);
75 let def = hir::Function::from_source(db, src)?; 75 let def = hir::Function::from_source(db, src)?;
76 if parent.parent().and_then(ast::ItemList::cast).is_some() { 76 if parent.parent().and_then(ast::ItemList::cast).is_some() {
77 Some(from_assoc_item(db, def.into())) 77 Some(from_assoc_item(db, def.into()))
@@ -80,7 +80,7 @@ pub(crate) fn classify_name(db: &RootDatabase, name: Source<&ast::Name>) -> Opti
80 } 80 }
81 }, 81 },
82 ast::ConstDef(it) => { 82 ast::ConstDef(it) => {
83 let src = name.with_ast(it); 83 let src = name.with_value(it);
84 let def = hir::Const::from_source(db, src)?; 84 let def = hir::Const::from_source(db, src)?;
85 if parent.parent().and_then(ast::ItemList::cast).is_some() { 85 if parent.parent().and_then(ast::ItemList::cast).is_some() {
86 Some(from_assoc_item(db, def.into())) 86 Some(from_assoc_item(db, def.into()))
@@ -89,7 +89,7 @@ pub(crate) fn classify_name(db: &RootDatabase, name: Source<&ast::Name>) -> Opti
89 } 89 }
90 }, 90 },
91 ast::TypeAliasDef(it) => { 91 ast::TypeAliasDef(it) => {
92 let src = name.with_ast(it); 92 let src = name.with_value(it);
93 let def = hir::TypeAlias::from_source(db, src)?; 93 let def = hir::TypeAlias::from_source(db, src)?;
94 if parent.parent().and_then(ast::ItemList::cast).is_some() { 94 if parent.parent().and_then(ast::ItemList::cast).is_some() {
95 Some(from_assoc_item(db, def.into())) 95 Some(from_assoc_item(db, def.into()))
@@ -98,11 +98,11 @@ pub(crate) fn classify_name(db: &RootDatabase, name: Source<&ast::Name>) -> Opti
98 } 98 }
99 }, 99 },
100 ast::MacroCall(it) => { 100 ast::MacroCall(it) => {
101 let src = name.with_ast(it); 101 let src = name.with_value(it);
102 let def = hir::MacroDef::from_source(db, src.clone())?; 102 let def = hir::MacroDef::from_source(db, src.clone())?;
103 103
104 let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax())); 104 let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax()));
105 let module = Module::from_definition(db, src.with_ast(module_src))?; 105 let module = Module::from_definition(db, src.with_value(module_src))?;
106 106
107 Some(NameDefinition { 107 Some(NameDefinition {
108 visibility: None, 108 visibility: None,
@@ -149,9 +149,9 @@ pub(crate) fn classify_name_ref(
149 } 149 }
150 } 150 }
151 151
152 let ast = ModuleSource::from_child_node(db, name_ref.with_ast(&parent)); 152 let ast = ModuleSource::from_child_node(db, name_ref.with_value(&parent));
153 // FIXME: find correct container and visibility for each case 153 // FIXME: find correct container and visibility for each case
154 let container = Module::from_definition(db, name_ref.with_ast(ast))?; 154 let container = Module::from_definition(db, name_ref.with_value(ast))?;
155 let visibility = None; 155 let visibility = None;
156 156
157 if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { 157 if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) {