From 5f95d1530a94901497e22cf579d0fc88542cf8bd Mon Sep 17 00:00:00 2001 From: lyken Date: Wed, 28 Aug 2024 12:53:55 +0800 Subject: [PATCH] FloatKind::{get_float_type -> float_type} --- nac3core/src/codegen/model/float.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nac3core/src/codegen/model/float.rs b/nac3core/src/codegen/model/float.rs index d1aeb025..b71a3032 100644 --- a/nac3core/src/codegen/model/float.rs +++ b/nac3core/src/codegen/model/float.rs @@ -9,7 +9,7 @@ use inkwell::{ use super::*; pub trait FloatKind<'ctx>: fmt::Debug + Clone + Copy { - fn get_float_type(&self, ctx: &'ctx Context) -> FloatType<'ctx>; + fn float_type(&self, ctx: &'ctx Context) -> FloatType<'ctx>; } #[derive(Debug, Clone, Copy, Default)] @@ -18,13 +18,13 @@ pub struct Float32; pub struct Float64; impl<'ctx> FloatKind<'ctx> for Float32 { - fn get_float_type(&self, ctx: &'ctx Context) -> FloatType<'ctx> { + fn float_type(&self, ctx: &'ctx Context) -> FloatType<'ctx> { ctx.f32_type() } } impl<'ctx> FloatKind<'ctx> for Float64 { - fn get_float_type(&self, ctx: &'ctx Context) -> FloatType<'ctx> { + fn float_type(&self, ctx: &'ctx Context) -> FloatType<'ctx> { ctx.f64_type() } } @@ -33,7 +33,7 @@ impl<'ctx> FloatKind<'ctx> for Float64 { pub struct AnyFloat<'ctx>(FloatType<'ctx>); impl<'ctx> FloatKind<'ctx> for AnyFloat<'ctx> { - fn get_float_type(&self, _ctx: &'ctx Context) -> FloatType<'ctx> { + fn float_type(&self, _ctx: &'ctx Context) -> FloatType<'ctx> { self.0 } } @@ -52,7 +52,7 @@ impl<'ctx, N: FloatKind<'ctx>> Float<'ctx, N> { impl<'ctx, N: FloatKind<'ctx>> ModelBase<'ctx> for Float<'ctx, N> { fn llvm_type_impl(&self, _size_t: IntType<'ctx>, ctx: &'ctx Context) -> BasicTypeEnum<'ctx> { - self.kind.get_float_type(ctx).into() + self.kind.float_type(ctx).into() } fn check_type_impl( @@ -65,7 +65,7 @@ impl<'ctx, N: FloatKind<'ctx>> ModelBase<'ctx> for Float<'ctx, N> { return Err(ModelError(format!("Expecting FloatType, but got {ty:?}"))); }; - let expected_ty = self.kind.get_float_type(ctx); + let expected_ty = self.kind.float_type(ctx); if ty != expected_ty { return Err(ModelError(format!("Expecting {expected_ty:?}, but got {ty:?}"))); }