mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Make LikdId private
This commit is contained in:
parent
3b8d0c215a
commit
d475e3b29f
1 changed files with 5 additions and 9 deletions
|
@ -142,7 +142,7 @@ impl crate::loc2id::NumericId for ModuleId {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||||
pub(crate) struct LinkId(u32);
|
struct LinkId(u32);
|
||||||
|
|
||||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
pub enum Problem {
|
pub enum Problem {
|
||||||
|
@ -159,7 +159,7 @@ impl ModuleId {
|
||||||
pub(crate) fn source(self, tree: &ModuleTree) -> ModuleSource {
|
pub(crate) fn source(self, tree: &ModuleTree) -> ModuleSource {
|
||||||
tree.module(self).source
|
tree.module(self).source
|
||||||
}
|
}
|
||||||
pub(crate) fn parent_link(self, tree: &ModuleTree) -> Option<LinkId> {
|
fn parent_link(self, tree: &ModuleTree) -> Option<LinkId> {
|
||||||
tree.module(self).parent
|
tree.module(self).parent
|
||||||
}
|
}
|
||||||
pub(crate) fn parent(self, tree: &ModuleTree) -> Option<ModuleId> {
|
pub(crate) fn parent(self, tree: &ModuleTree) -> Option<ModuleId> {
|
||||||
|
@ -207,17 +207,13 @@ impl ModuleId {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LinkId {
|
impl LinkId {
|
||||||
pub(crate) fn owner(self, tree: &ModuleTree) -> ModuleId {
|
fn owner(self, tree: &ModuleTree) -> ModuleId {
|
||||||
tree.link(self).owner
|
tree.link(self).owner
|
||||||
}
|
}
|
||||||
pub(crate) fn name(self, tree: &ModuleTree) -> SmolStr {
|
fn name(self, tree: &ModuleTree) -> SmolStr {
|
||||||
tree.link(self).name.clone()
|
tree.link(self).name.clone()
|
||||||
}
|
}
|
||||||
pub(crate) fn bind_source<'a>(
|
fn bind_source<'a>(self, tree: &ModuleTree, db: &impl SyntaxDatabase) -> ast::ModuleNode {
|
||||||
self,
|
|
||||||
tree: &ModuleTree,
|
|
||||||
db: &impl SyntaxDatabase,
|
|
||||||
) -> ast::ModuleNode {
|
|
||||||
let owner = self.owner(tree);
|
let owner = self.owner(tree);
|
||||||
match owner.source(tree).resolve(db) {
|
match owner.source(tree).resolve(db) {
|
||||||
ModuleSourceNode::SourceFile(root) => {
|
ModuleSourceNode::SourceFile(root) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue