Support more IDE features for asm operands

This commit is contained in:
Lukas Wirth 2024-09-05 13:19:02 +02:00
parent 811905fce8
commit 95d8d8e697
13 changed files with 180 additions and 40 deletions

View file

@ -5253,6 +5253,22 @@ pub struct InlineAsmOperand {
index: usize,
}
impl InlineAsmOperand {
pub fn parent(self, _db: &dyn HirDatabase) -> DefWithBody {
self.owner.into()
}
pub fn name(&self, db: &dyn HirDatabase) -> Option<Name> {
db.body_with_source_map(self.owner)
.1
.template_map()?
.1
.get(&self.expr)?
.get(self.index)
.and_then(|(_, _, name)| name.clone())
}
}
// FIXME: Document this
#[derive(Debug)]
pub struct Callable {