aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_analyzer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/source_analyzer.rs')
-rw-r--r--crates/ra_hir/src/source_analyzer.rs25
1 files changed, 3 insertions, 22 deletions
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index 33c566025..f3f1ed05a 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -20,12 +20,12 @@ use hir_expand::{hygiene::Hygiene, name::AsName, HirFileId, InFile};
20use hir_ty::{InEnvironment, InferenceResult, TraitEnvironment}; 20use hir_ty::{InEnvironment, InferenceResult, TraitEnvironment};
21use ra_syntax::{ 21use ra_syntax::{
22 ast::{self, AstNode}, 22 ast::{self, AstNode},
23 SyntaxNode, SyntaxNodePtr, TextRange, TextUnit, 23 SyntaxNode, SyntaxNodePtr, TextUnit,
24}; 24};
25 25
26use crate::{ 26use crate::{
27 db::HirDatabase, Adt, Const, EnumVariant, Function, Local, MacroDef, ModPath, ModuleDef, Path, 27 db::HirDatabase, semantics::PathResolution, Adt, Const, EnumVariant, Function, Local, MacroDef,
28 PathKind, Static, Struct, Trait, Type, TypeAlias, TypeParam, 28 ModPath, ModuleDef, Path, PathKind, Static, Struct, Trait, Type, TypeAlias, TypeParam,
29}; 29};
30 30
31/// `SourceAnalyzer` is a convenience wrapper which exposes HIR API in terms of 31/// `SourceAnalyzer` is a convenience wrapper which exposes HIR API in terms of
@@ -40,25 +40,6 @@ pub(crate) struct SourceAnalyzer {
40 scopes: Option<Arc<ExprScopes>>, 40 scopes: Option<Arc<ExprScopes>>,
41} 41}
42 42
43#[derive(Debug, Clone, PartialEq, Eq)]
44pub enum PathResolution {
45 /// An item
46 Def(crate::ModuleDef),
47 /// A local binding (only value namespace)
48 Local(Local),
49 /// A generic parameter
50 TypeParam(TypeParam),
51 SelfType(crate::ImplDef),
52 Macro(MacroDef),
53 AssocItem(crate::AssocItem),
54}
55
56#[derive(Debug)]
57pub struct ReferenceDescriptor {
58 pub range: TextRange,
59 pub name: String,
60}
61
62impl SourceAnalyzer { 43impl SourceAnalyzer {
63 pub(crate) fn new_for_body( 44 pub(crate) fn new_for_body(
64 db: &impl HirDatabase, 45 db: &impl HirDatabase,