use serde::{Deserialize, Serialize};
#[expect(clippy::exhaustive_structs, reason = "public id wrapper")]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct FileId(pub u32);
impl FileId {
pub const SYNTHETIC: Self = Self(0);
#[must_use]
pub const fn is_synthetic(&self) -> bool {
self.0 == 0
}
}
#[expect(clippy::exhaustive_structs, reason = "public IR shape")]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct IrSpan {
pub span: crate::location::Span,
pub file: FileId,
}
impl IrSpan {
#[must_use]
pub const fn new(span: crate::location::Span, file: FileId) -> Self {
Self { span, file }
}
#[must_use]
pub fn is_default(&self) -> bool {
self.span == crate::location::Span::default() && self.file.is_synthetic()
}
}