Skip to content

Commit 7d873fc

Browse files
committed
Move PathResolution
1 parent 7b6716e commit 7d873fc

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

crates/ra_hir/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ pub use crate::{
4545
StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
4646
},
4747
has_source::HasSource,
48-
semantics::{original_range, Semantics, SemanticsScope},
49-
source_analyzer::PathResolution,
48+
semantics::{original_range, PathResolution, Semantics, SemanticsScope},
5049
};
5150

5251
pub use hir_def::{

crates/ra_hir/src/semantics.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,23 @@ use crate::{
2020
db::HirDatabase,
2121
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
2222
source_analyzer::{resolve_hir_path, SourceAnalyzer},
23-
Function, HirFileId, InFile, Local, MacroDef, Module, ModuleDef, Name, Origin, Path,
24-
PathResolution, ScopeDef, StructField, Trait, Type, TypeParam, VariantDef,
23+
AssocItem, Function, HirFileId, ImplDef, InFile, Local, MacroDef, Module, ModuleDef, Name,
24+
Origin, Path, ScopeDef, StructField, Trait, Type, TypeParam, VariantDef,
2525
};
2626

27+
#[derive(Debug, Clone, PartialEq, Eq)]
28+
pub enum PathResolution {
29+
/// An item
30+
Def(ModuleDef),
31+
/// A local binding (only value namespace)
32+
Local(Local),
33+
/// A generic parameter
34+
TypeParam(TypeParam),
35+
SelfType(ImplDef),
36+
Macro(MacroDef),
37+
AssocItem(AssocItem),
38+
}
39+
2740
/// Primary API to get semantic information, like types, from syntax trees.
2841
pub struct Semantics<'db, DB> {
2942
pub db: &'db DB,

crates/ra_hir/src/source_analyzer.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use ra_syntax::{
2424
};
2525

2626
use crate::{
27-
db::HirDatabase, Adt, Const, EnumVariant, Function, Local, MacroDef, ModPath, ModuleDef, Path,
28-
PathKind, Static, Struct, Trait, Type, TypeAlias, TypeParam,
27+
db::HirDatabase, semantics::PathResolution, Adt, Const, EnumVariant, Function, Local, MacroDef,
28+
ModPath, ModuleDef, Path, PathKind, Static, Struct, Trait, Type, TypeAlias, TypeParam,
2929
};
3030

3131
/// `SourceAnalyzer` is a convenience wrapper which exposes HIR API in terms of
@@ -40,19 +40,6 @@ pub(crate) struct SourceAnalyzer {
4040
scopes: Option<Arc<ExprScopes>>,
4141
}
4242

43-
#[derive(Debug, Clone, PartialEq, Eq)]
44-
pub 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-
5643
impl SourceAnalyzer {
5744
pub(crate) fn new_for_body(
5845
db: &impl HirDatabase,

0 commit comments

Comments
 (0)