mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Add ExternCrateDecl to HIR
This commit is contained in:
parent
151c750dac
commit
bcff166b3a
39 changed files with 585 additions and 167 deletions
|
@ -11,9 +11,9 @@ use hir_expand::{HirFileId, InFile};
|
|||
use syntax::ast;
|
||||
|
||||
use crate::{
|
||||
db::HirDatabase, Adt, Const, Enum, Field, FieldSource, Function, Impl, LifetimeParam,
|
||||
LocalSource, Macro, Module, Static, Struct, Trait, TraitAlias, TypeAlias, TypeOrConstParam,
|
||||
Union, Variant,
|
||||
db::HirDatabase, Adt, Const, Enum, ExternCrateDecl, Field, FieldSource, Function, Impl,
|
||||
LifetimeParam, LocalSource, Macro, Module, Static, Struct, Trait, TraitAlias, TypeAlias,
|
||||
TypeOrConstParam, Union, Variant,
|
||||
};
|
||||
|
||||
pub trait HasSource {
|
||||
|
@ -207,3 +207,11 @@ impl HasSource for LocalSource {
|
|||
Some(self.source)
|
||||
}
|
||||
}
|
||||
|
||||
impl HasSource for ExternCrateDecl {
|
||||
type Ast = ast::ExternCrate;
|
||||
|
||||
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
|
||||
Some(self.id.lookup(db.upcast()).source(db.upcast()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue