Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/lib.rs')
| -rw-r--r-- | crates/hir/src/lib.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index c8b227123f..75969bd899 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -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 { |