mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Implemented basic enum const eval
This commit is contained in:
parent
f64c95600c
commit
997fc46efa
14 changed files with 227 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
//! File symbol extraction.
|
||||
|
||||
use base_db::FileRange;
|
||||
use hir_def::db::DefDatabase;
|
||||
use hir_def::{
|
||||
item_tree::ItemTreeNode, src::HasSource, AdtId, AssocItemId, AssocItemLoc, DefWithBodyId,
|
||||
HasModule, ImplId, ItemContainerId, Lookup, MacroId, ModuleDefId, ModuleId, TraitId,
|
||||
|
@ -244,6 +245,10 @@ impl<'a> SymbolCollector<'a> {
|
|||
DefWithBodyId::ConstId(id) => Some(
|
||||
id.lookup(self.db.upcast()).source(self.db.upcast()).value.name()?.text().into(),
|
||||
),
|
||||
DefWithBodyId::VariantId(id) => Some({
|
||||
let up_db: &dyn DefDatabase = self.db.upcast();
|
||||
up_db.lookup_intern_enum(id.parent).source(up_db).value.name()?.text().into()
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue