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

@ -913,8 +913,8 @@ impl SourceAnalyzer {
let (expr, args) = body_source_map.asm_template_args(asm)?;
Some(*def).zip(
args.iter()
.find(|(range, _, _)| range.contains_inclusive(offset))
.map(|(range, idx, _)| (expr, *range, *idx)),
.find(|(range, _)| range.contains_inclusive(offset))
.map(|(range, idx)| (expr, *range, *idx)),
)
}
@ -944,7 +944,7 @@ impl SourceAnalyzer {
pub(crate) fn as_asm_parts(
&self,
asm: InFile<&ast::AsmExpr>,
) -> Option<(DefWithBodyId, (ExprId, &[(TextRange, usize, Option<Name>)]))> {
) -> Option<(DefWithBodyId, (ExprId, &[(TextRange, usize)]))> {
let (def, _, body_source_map) = self.def.as_ref()?;
Some(*def).zip(body_source_map.asm_template_args(asm))
}