mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Move PathResolution
This commit is contained in:
parent
7b6716e50e
commit
7d873fcfa1
3 changed files with 18 additions and 19 deletions
|
@ -45,8 +45,7 @@ pub use crate::{
|
||||||
StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
|
StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
|
||||||
},
|
},
|
||||||
has_source::HasSource,
|
has_source::HasSource,
|
||||||
semantics::{original_range, Semantics, SemanticsScope},
|
semantics::{original_range, PathResolution, Semantics, SemanticsScope},
|
||||||
source_analyzer::PathResolution,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use hir_def::{
|
pub use hir_def::{
|
||||||
|
|
|
@ -20,10 +20,23 @@ use crate::{
|
||||||
db::HirDatabase,
|
db::HirDatabase,
|
||||||
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
|
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
|
||||||
source_analyzer::{resolve_hir_path, SourceAnalyzer},
|
source_analyzer::{resolve_hir_path, SourceAnalyzer},
|
||||||
Function, HirFileId, InFile, Local, MacroDef, Module, ModuleDef, Name, Origin, Path,
|
AssocItem, Function, HirFileId, ImplDef, InFile, Local, MacroDef, Module, ModuleDef, Name,
|
||||||
PathResolution, ScopeDef, StructField, Trait, Type, TypeParam, VariantDef,
|
Origin, Path, ScopeDef, StructField, Trait, Type, TypeParam, VariantDef,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
pub enum PathResolution {
|
||||||
|
/// An item
|
||||||
|
Def(ModuleDef),
|
||||||
|
/// A local binding (only value namespace)
|
||||||
|
Local(Local),
|
||||||
|
/// A generic parameter
|
||||||
|
TypeParam(TypeParam),
|
||||||
|
SelfType(ImplDef),
|
||||||
|
Macro(MacroDef),
|
||||||
|
AssocItem(AssocItem),
|
||||||
|
}
|
||||||
|
|
||||||
/// Primary API to get semantic information, like types, from syntax trees.
|
/// Primary API to get semantic information, like types, from syntax trees.
|
||||||
pub struct Semantics<'db, DB> {
|
pub struct Semantics<'db, DB> {
|
||||||
pub db: &'db DB,
|
pub db: &'db DB,
|
||||||
|
|
|
@ -24,8 +24,8 @@ use ra_syntax::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::HirDatabase, Adt, Const, EnumVariant, Function, Local, MacroDef, ModPath, ModuleDef, Path,
|
db::HirDatabase, semantics::PathResolution, Adt, Const, EnumVariant, Function, Local, MacroDef,
|
||||||
PathKind, Static, Struct, Trait, Type, TypeAlias, TypeParam,
|
ModPath, ModuleDef, Path, PathKind, Static, Struct, Trait, Type, TypeAlias, TypeParam,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// `SourceAnalyzer` is a convenience wrapper which exposes HIR API in terms of
|
/// `SourceAnalyzer` is a convenience wrapper which exposes HIR API in terms of
|
||||||
|
@ -40,19 +40,6 @@ pub(crate) struct SourceAnalyzer {
|
||||||
scopes: Option<Arc<ExprScopes>>,
|
scopes: Option<Arc<ExprScopes>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub enum PathResolution {
|
|
||||||
/// An item
|
|
||||||
Def(crate::ModuleDef),
|
|
||||||
/// A local binding (only value namespace)
|
|
||||||
Local(Local),
|
|
||||||
/// A generic parameter
|
|
||||||
TypeParam(TypeParam),
|
|
||||||
SelfType(crate::ImplDef),
|
|
||||||
Macro(MacroDef),
|
|
||||||
AssocItem(crate::AssocItem),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SourceAnalyzer {
|
impl SourceAnalyzer {
|
||||||
pub(crate) fn new_for_body(
|
pub(crate) fn new_for_body(
|
||||||
db: &impl HirDatabase,
|
db: &impl HirDatabase,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue