From 75a6fc914273fa2514b87adbebf6a7f36b26a16e Mon Sep 17 00:00:00 2001 From: Yoshitomo Nakanishi Date: Tue, 26 Nov 2024 22:42:18 +0100 Subject: [PATCH] Add `GlobalVariable::ty` method --- crates/ir/src/global_variable.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/ir/src/global_variable.rs b/crates/ir/src/global_variable.rs index 812657f0..8c80193b 100644 --- a/crates/ir/src/global_variable.rs +++ b/crates/ir/src/global_variable.rs @@ -55,6 +55,12 @@ impl GlobalVariableStore { pub struct GlobalVariable(pub u32); cranelift_entity::entity_impl!(GlobalVariable); +impl GlobalVariable { + pub fn ty(self, module: &ModuleCtx) -> Type { + module.with_gv_store(|s| s.ty(self)) + } +} + impl WriteWithModule for GlobalVariable { fn write(&self, module: &ModuleCtx, w: &mut impl io::Write) -> io::Result<()> { module.with_gv_store(|s| s.gv_data(*self).write(module, w))