use crate::{ast::ty::TyKind, common::BodyId, ffi::FfiOption};
use super::CommonItemData;
#[repr(C)]
#[derive(Debug)]
pub struct ConstItem<'ast> {
data: CommonItemData<'ast>,
ty: TyKind<'ast>,
body_id: FfiOption<BodyId>,
}
impl<'ast> ConstItem<'ast> {
pub fn ty(&self) -> TyKind<'ast> {
self.ty
}
pub fn body_id(&self) -> Option<BodyId> {
self.body_id.copy()
}
}
#[cfg(feature = "driver-api")]
impl<'ast> ConstItem<'ast> {
pub fn new(data: CommonItemData<'ast>, ty: TyKind<'ast>, body_id: Option<BodyId>) -> Self {
Self {
data,
ty,
body_id: body_id.into(),
}
}
}
super::impl_item_data!(ConstItem, Const);