Fix name fetching being incorrect for asm operands

This commit is contained in:
Lukas Wirth 2024-09-05 13:41:03 +02:00
parent 564926ac99
commit c075a9980e
10 changed files with 107 additions and 93 deletions

View file

@ -5259,13 +5259,10 @@ impl InlineAsmOperand {
}
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())
match &db.body(self.owner)[self.expr] {
hir_def::hir::Expr::InlineAsm(e) => e.operands.get(self.index)?.0.clone(),
_ => None,
}
}
}